diff --git a/ChangeLog b/ChangeLog index 38d531b..0f97c7b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,15 +1,21 @@ RCS file: RCS/imapsync,v Working file: imapsync -head: 1.106 +head: 1.107 branch: locks: strict access list: symbolic names: keyword substitution: kv -total revisions: 106; selected revisions: 106 +total revisions: 107; selected revisions: 107 description: ---------------------------- +revision 1.107 +date: 2004/12/28 23:24:05; author: gilles; state: Exp; lines: +30 -9 +Added option --nosyncacls +Added synchronization of acls (by default) +Added --justfolders +---------------------------- revision 1.106 date: 2004/12/28 03:35:00; author: gilles; state: Exp; lines: +9 -8 If --sep2 or --sep1 is given then it has precedence over the diff --git a/README b/README index 0191c9c..4984241 100644 --- a/README +++ b/README @@ -2,7 +2,7 @@ NAME imapsync - IMAP synchronization, copy or migration tool. Synchronize mailboxes between two imap servers. Good at IMAP migration. - $Revision: 1.106 $ + $Revision: 1.107 $ INSTALL imapsync works fine under any Unix OS. @@ -239,5 +239,5 @@ AUTHOR 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 $ diff --git a/VERSION b/VERSION index 8bc474f..8de7690 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.106 +1.107 diff --git a/imapsync b/imapsync index 3ac8b65..935ae3f 100755 --- a/imapsync +++ b/imapsync @@ -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 : add prefix to all destination folders (usually INBOX. for cyrus imap servers) --regextrans2 : Apply the whole regex to each destination folders. ---sep1 : separator in case namespace is not supported. ---sep2 : idem. +--sep1 : separator in case namespace is not supported. +--sep2 : 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 : imap connect timeout. --help : print this. diff --git a/tests.sh b/tests.sh index 67e766b..1eef4cf 100644 --- a/tests.sh +++ b/tests.sh @@ -1,8 +1,11 @@ #!/bin/sh -# $Id: tests.sh,v 1.29 2004/12/28 04:03:12 gilles Exp $ +# $Id: tests.sh,v 1.30 2004/12/28 23:22:02 gilles Exp $ # $Log: tests.sh,v $ +# Revision 1.30 2004/12/28 23:22:02 gilles +# Added lp_justfolders() +# # Revision 1.29 2004/12/28 04:03:12 gilles # Added lp_sep2() # @@ -207,6 +210,21 @@ lp_folder() { fi } +lp_justfolders() { + if test X`hostname` = X"plume"; then + echo3 Here is plume + ./imapsync \ + --host2 plume --user2 tata@est.belle \ + --passfile2 /var/tmp/secret.tata \ + --folder INBOX.yop --folder INBOX.Trash \ + --host1 loul --user1 tata \ + --passfile1 /var/tmp/secret.tata \ + --justfolders + else + : + fi +} + pl_folder_qqq() { if test X`hostname` = X"plume"; then