From 25948aab90a27c7eaca24f855abc688b04953708 Mon Sep 17 00:00:00 2001 From: Nick Bebout Date: Sat, 12 Mar 2011 02:44:25 +0000 Subject: [PATCH] 1.168 --- ChangeLog | 9 +++++++-- README | 10 ++++++---- TODO | 6 +++--- VERSION | 2 +- freshmeat_submition | 8 +++++--- imapsync | 42 ++++++++++++++++++++++++++++++++---------- tests.sh | 17 ++++++++++++++++- 7 files changed, 70 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6b2b3ca..397731b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,15 +1,20 @@ RCS file: RCS/imapsync,v Working file: imapsync -head: 1.167 +head: 1.168 branch: locks: strict access list: symbolic names: keyword substitution: kv -total revisions: 167; selected revisions: 167 +total revisions: 168; selected revisions: 168 description: ---------------------------- +revision 1.168 +date: 2006/04/02 01:49:10; author: gilles; state: Exp; lines: +32 -10 +Added --delete2 option: remove messages on destination that +are not on the source server. +---------------------------- revision 1.167 date: 2006/03/30 02:33:00; author: gilles; state: Exp; lines: +6 -6 SPLIT print in debug mode only. diff --git a/README b/README index a61e902..7de1d1b 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.167 $ + $Revision: 1.168 $ INSTALL imapsync works fine under any Unix OS. @@ -52,7 +52,8 @@ SYNOPSIS [--skipheader ] [--useheader ] [--useheader ] [--skipsize] - [--delete] [--expunge] [--expunge1] [--expunge2] + [--delete] [--delete2] + [--expunge] [--expunge1] [--expunge2] [--subscribed] [--subscribe] [--nofoldersizes] [--dry] @@ -239,7 +240,8 @@ IMAP SERVERS HUGE MIGRATION Have a special attention on options --subscribed --subscribe --delete - --expunge --expunge1 --expunge2 --maxage --minage --maxsize --useheader + --delete2 --expunge --expunge1 --expunge2 --maxage --minage --maxsize + --useheader If you have many mailboxes to migrate think about a little shell program. Write a file called file.csv (for example) containing users and @@ -287,5 +289,5 @@ AUTHOR teaching free open and gratis softwares. Don't hesitate to pay him for that services. - $Id: imapsync,v 1.167 2006/03/30 02:33:00 gilles Exp $ + $Id: imapsync,v 1.168 2006/04/02 01:49:10 gilles Exp $ diff --git a/TODO b/TODO index 80680b6..ae583ee 100644 --- a/TODO +++ b/TODO @@ -9,9 +9,6 @@ http://groups.google.fr/group/comp.mail.imap Add my amazon wishlist link. -Add an --exactsync option to remove target messages -that are not on source. Maybe --delete2 is a better name. - Read the IMAP RFC http://www.faqs.org/rfcs/rfc3501.html Add debian packaging in the Makefile. @@ -31,6 +28,9 @@ http://asg.web.cmu.edu/cyrus/download/imapd/altnamespace.html Explain expunge behavior. +DONE. Add an --exactsync option to remove target messages +that are not on source. Maybe --delete2 is a better name. + DONE. Fix the "word too large" or "Command line too long" bug with some imap servers. diff --git a/VERSION b/VERSION index 05670cf..7747ee2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.167 +1.168 diff --git a/freshmeat_submition b/freshmeat_submition index 459cbb0..153e480 100644 --- a/freshmeat_submition +++ b/freshmeat_submition @@ -1,8 +1,10 @@ Project: imapsync -Version: 1.166 -Release-Focus: Major bugfixes +Version: 1.167 +Release-Focus: Minor feature enhancements Hide: Y Home-Page-URL: http://www.linux-france.org/prj/imapsync/ Gzipped-Tar-URL: http://www.linux-france.org/prj/imapsync/dist/ -Code cleanup. +Added --delete2 option: removes messages on destination that +are not on the source server. + diff --git a/imapsync b/imapsync index ab74273..fa3e8d3 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.167 $ +$Revision: 1.168 $ =head1 INSTALL @@ -58,7 +58,8 @@ $Revision: 1.167 $ [--skipheader ] [--useheader ] [--useheader ] [--skipsize] - [--delete] [--expunge] [--expunge1] [--expunge2] + [--delete] [--delete2] + [--expunge] [--expunge1] [--expunge2] [--subscribed] [--subscribe] [--nofoldersizes] [--dry] @@ -275,6 +276,7 @@ Have a special attention on options --subscribed --subscribe --delete +--delete2 --expunge --expunge1 --expunge2 @@ -337,7 +339,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.167 2006/03/30 02:33:00 gilles Exp $ +$Id: imapsync,v 1.168 2006/04/02 01:49:10 gilles Exp $ =cut @@ -369,7 +371,8 @@ my( $maxsize, $maxage, $minage, $skipheader, @useheader, $skipsize, $foldersizes, $buffersize, - $delete, $expunge, $expunge1, $expunge2, $dry, + $delete, $delete2, + $expunge, $expunge1, $expunge2, $dry, $justfoldersizes, $authmd5, $subscribed, $subscribe, @@ -392,7 +395,7 @@ my( use vars qw ($opt_G); # missing code for this will be option. -$rcs = ' $Id: imapsync,v 1.167 2006/03/30 02:33:00 gilles Exp $ '; +$rcs = ' $Id: imapsync,v 1.168 2006/04/02 01:49:10 gilles Exp $ '; $rcs =~ m/,v (\d+\.\d+)/; $VERSION = ($1) ? $1 : "UNKNOWN"; @@ -429,8 +432,8 @@ $error=0; my $banner = join("", '$RCSfile: imapsync,v $ ', - '$Revision: 1.167 $ ', - '$Date: 2006/03/30 02:33:00 $ ', + '$Revision: 1.168 $ ', + '$Date: 2006/04/02 01:49:10 $ ', "\n", "Mail::IMAPClient version used here is ", $VERSION_IMAPClient,"\n" @@ -981,6 +984,21 @@ FOLDER: foreach my $f_fold (@f_folders) { #print map { $f_hash{$_}{'m'} . " "} @f_hash_keys_sorted_by_uid; + my @t_hash_keys_sorted_by_uid + = sort {$t_hash{$a}{'m'} <=> $t_hash{$b}{'m'}} keys(%t_hash); + + + if($delete2) { + foreach my $m_id (@t_hash_keys_sorted_by_uid) { + #print "$m_id "; + unless (exists($f_hash{$m_id})) { + my $t_msg = $t_hash{$m_id}{'m'}; + print "deleting message $m_id $t_msg\n"; + $to->delete_message($t_msg) unless ($dry); + } + } + } + MESS: foreach my $m_id (@f_hash_keys_sorted_by_uid) { my $f_size = $f_hash{$m_id}{'s'}; my $f_msg = $f_hash{$m_id}{'m'}; @@ -1196,6 +1214,7 @@ sub get_options "regextrans2=s" => \@regextrans2, "regexmess=s" => \@regexmess, "delete!" => \$delete, + "delete2!" => \$delete2, "syncinternaldates!" => \$syncinternaldates, "syncacls!" => \$syncacls, "maxsize=i" => \$maxsize, @@ -1366,11 +1385,13 @@ Several options are mandatory. --regexmess : and this one, etc. --sep1 : separator in case namespace is not supported. --sep2 : idem. ---delete : delete messages in source imap server after +--delete : delete messages on source imap server after a successful transfert. Useful in case you want to migrate from one server to another one. With imap, delete tags messages as deleted, they are not really deleted. See expunge. +--delete2 : delete messages on the destination imap server that + are not on the source server. --expunge : expunge messages on source account. expunge really deletes messages marked deleted. expunge is made at the begining on the @@ -1417,8 +1438,9 @@ Several options are mandatory. information. Need only --host1 and --host2 options. --justfolders : just do things about folders (ignore messages). --fast : be faster (just does not sync flags). ---split1 : split the requests in several parts on source server. ---split2 : same thing on the "destination" server. +--split1 : split the requests in several parts on source server. + is the number of messages handled per request. +--split2 : same thing on the "destination" server. --nofastio1 : don't use fastio with the "from" server. --nofastio2 : don't use fastio with the "destination" server. --timeout : imap connect timeout. diff --git a/tests.sh b/tests.sh index fa5c391..618e0b2 100644 --- a/tests.sh +++ b/tests.sh @@ -1,6 +1,6 @@ #!/bin/sh -# $Id: tests.sh,v 1.51 2006/03/30 02:22:56 gilles Exp $ +# $Id: tests.sh,v 1.52 2006/04/02 03:32:55 gilles Exp $ #### Shell pragmas @@ -763,6 +763,21 @@ lp_authmech_CRAMMD5() { fi } +lp_delete2() { + if test X`hostname` = X"plume"; then + echo3 Here is plume + ./imapsync \ + --host2 plume --user2 tata@est.belle \ + --passfile2 /var/tmp/secret.tata \ + --host1 loul --user1 tata \ + --passfile1 /var/tmp/secret.tata \ + --folder INBOX \ + --delete2 --expunge2 + else + : + fi +} + # mandatory tests