This commit is contained in:
Nick Bebout 2011-03-12 02:44:08 +00:00
parent 2c60274596
commit 496c895c56
5 changed files with 60 additions and 15 deletions

View file

@ -6,7 +6,7 @@ imapsync - IMAP synchronization, copy or migration
tool. Synchronize mailboxes between two imap servers. Good
at IMAP migration.
$Revision: 1.106 $
$Revision: 1.107 $
=head1 INSTALL
@ -281,7 +281,7 @@ Gilles LAMIRAL earn his living writing, installing,
configuring and teaching free open and gratis
softwares. Don't hesitate to pay him for that services.
$Id: imapsync,v 1.106 2004/12/28 03:35:00 gilles Exp $
$Id: imapsync,v 1.107 2004/12/28 23:24:05 gilles Exp $
=cut
@ -302,14 +302,14 @@ my(
$user1, $user2, $password1, $password2, $passfile1, $passfile2,
@folder, $include, $exclude, $prefix2, $regextrans2,
$sep1, $sep2,
$syncinternaldates,
$syncinternaldates, $syncacls,
$maxsize, $maxage,
$skipheader, $skipsize, $foldersizes,
$delete, $expunge, $dry,
$authmd5,
$subscribed, $subscribe,
$version, $VERSION, $help,
$justconnect,
$justconnect, $justfolders,
$mess_size_total_trans,
$mess_size_total_skipped,
$mess_size_total_error,
@ -323,7 +323,7 @@ my(
use vars qw ($opt_G); # missing code for this will be option.
$rcs = ' $Id: imapsync,v 1.106 2004/12/28 03:35:00 gilles Exp $ ';
$rcs = ' $Id: imapsync,v 1.107 2004/12/28 23:24:05 gilles Exp $ ';
$rcs =~ m/,v (\d+\.\d+)/;
$VERSION = ($1) ? $1 : "UNKNOWN";
@ -360,8 +360,8 @@ $error=0;
my $banner = join("",
'$RCSfile: imapsync,v $ ',
'$Revision: 1.106 $ ',
'$Date: 2004/12/28 03:35:00 $ ',
'$Revision: 1.107 $ ',
'$Date: 2004/12/28 23:24:05 $ ',
"\n",
"Mail::IMAPClient version used here is ",
$VERSION_IMAPClient, " auth md5 : $md5_supported",
@ -395,6 +395,8 @@ $password2 = (defined($passfile2)) ? firstline ($passfile2) : $password2;
$authmd5 = (defined($authmd5)) ? $authmd5 : 1;
$syncacls = (defined($syncacls)) ? $syncacls : 1;
print "From imap server [$host1] port [$port1] user [$user1]\n";
print "To imap server [$host2] port [$port2] user [$user2]\n";
@ -691,6 +693,21 @@ FOLDER: foreach my $f_fold (@f_folders) {
unless($dry) { $to->subscribe($t_fold) };
}
my $hash = $from->getacl($f_fold)
or warn "Could not getacl for $f_fold: $@\n";
foreach my $user (keys(%$hash)) {
my $acl = $hash->{$user};
print "acl $user : " . $acl . "\n";
if ($syncacls and ! $dry) {
print "setting acl $t_fold $user $acl\n";
$to->setacl($t_fold, $user, $acl)
or warn "Could not set acl: $@\n";
}
}
next FOLDER if ($justfolders);
my @f_msgs = $maxage ? $from->since(time - 86400 * $maxage) : $from->search("ALL");
$debug and print "LIST FROM : @f_msgs\n";
# internal dates on "TO" are after the ones on "FROM"
@ -872,6 +889,7 @@ sub get_options
"regextrans2=s" => \$regextrans2,
"delete!" => \$delete,
"syncinternaldates!" => \$syncinternaldates,
"syncacls!" => \$syncacls,
"maxsize=i" => \$maxsize,
"maxage=i" => \$maxage,
"foldersizes" => \$foldersizes,
@ -880,6 +898,7 @@ sub get_options
"subscribed!" => \$subscribed,
"subscribe!" => \$subscribe,
"justconnect!"=> \$justconnect,
"justfolders!"=> \$justfolders,
"version" => \$version,
"help" => \$help,
"timeout=i" => \$timeout,
@ -978,8 +997,8 @@ Several options are mandatory.
--prefix2 <string> : add prefix to all destination folders
(usually INBOX. for cyrus imap servers)
--regextrans2 <regex> : Apply the whole regex to each destination folders.
--sep1 <char> : separator in case namespace is not supported.
--sep2 <char> : idem.
--sep1 <string> : separator in case namespace is not supported.
--sep2 <string> : idem.
--delete : delete messages in source imap server after
a successful transfert. Useful in case you
want to migrate from one server to another one.
@ -1007,11 +1026,13 @@ Several options are mandatory.
--foldersizes : Discover the size of each "From" folder in bytes
and message counts. Meant to be used with
--justconnect.
--nosyncacls : Don't synchronizes acls.
--debug : debug mode.
--debugimap : imap debug mode.
--version : print sotfware version.
--justconnect : just connect to both servers and print useful
information.
--justfolders : just do things about folders (ignore messages).
--timeout <int> : imap connect timeout.
--help : print this.