From d5e50a6fb9f86a66706eed7426a3523612716e75 Mon Sep 17 00:00:00 2001 From: Nick Bebout Date: Sat, 12 Mar 2011 02:43:50 +0000 Subject: [PATCH] 1.68 --- ChangeLog | 18 +++++- INSTALL | 20 ++++-- README | 30 +++++---- TODO | 4 +- VERSION | 2 +- imapsync | 36 ++++++----- patches/imapsync.diff | 146 ++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 219 insertions(+), 37 deletions(-) create mode 100644 patches/imapsync.diff diff --git a/ChangeLog b/ChangeLog index 26d58ce..8d7e14a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,15 +1,29 @@ RCS file: RCS/imapsync,v Working file: imapsync -head: 1.65 +head: 1.68 branch: locks: strict access list: symbolic names: keyword substitution: kv -total revisions: 65; selected revisions: 65 +total revisions: 68; selected revisions: 68 description: ---------------------------- +revision 1.68 +date: 2004/01/28 03:49:29; author: gilles; state: Exp; lines: +17 -13 +Added "Success stories" +Sorted "Success stories" +Added windows note. +---------------------------- +revision 1.67 +date: 2004/01/28 03:10:24; author: gilles; state: Exp; lines: +6 -6 +Better description for google. +---------------------------- +revision 1.66 +date: 2004/01/23 20:27:28; author: gilles; state: Exp; lines: +6 -6 +Added IMAP sync words for google response. +---------------------------- revision 1.65 date: 2003/12/24 03:04:34; author: gilles; state: Exp; lines: +20 -7 Wrote separator_invert() diff --git a/INSTALL b/INSTALL index 3dcc44d..99287db 100644 --- a/INSTALL +++ b/INSTALL @@ -1,7 +1,7 @@ -# $Id: INSTALL,v 1.6 2003/11/21 03:13:52 gilles Exp gilles $ +# $Id: INSTALL,v 1.7 2004/01/28 04:00:55 gilles Exp gilles $ # -# INSTALL file for ftpsync - +# INSTALL file for imapsync +# imapsync : IMAP sync or copy tool. GETTING ------- @@ -26,10 +26,20 @@ You need : http://search.cpan.org/~djkernen/ http://search.cpan.org/~djkernen/Mail-IMAPClient-2.2.9/ - In fact I use Mail-IMAPClient-2.1.4 + In fact I use Mail-IMAPClient-2.1.4 (debian package) To know the version you have on your system try : perl -mMail::IMAPClient -e 'print $Mail::IMAPClient::VERSION, "\n"' - + +- Perl Digest::MD5 module. + http://search.cpan.org/ + http://search.cpan.org/~gaas/Digest-MD5-2.33/ + To know the version you have on your system try : + perl -mDigest::MD5 -e 'print $Digest::MD5::VERSION, "\n"' + I use 2.20 (debian package) + +- (Option) Perl Digest::HMAC_MD5 module + Good for non plain text password over network. + INSTALLING ---------- diff --git a/README b/README index 8ca7bd0..bf7b461 100644 --- a/README +++ b/README @@ -1,9 +1,13 @@ NAME - imapsync - synchronize mailboxes between two imap servers. + imapsync - IMAP sync or copy tool. Synchronize mailboxes between two + imap servers. - $Revision: 1.65 $ + $Revision: 1.68 $ INSTALL + imapsync works fine under any Unix OS. + imapsync works fine under Windows 2000 (at least) and ActiveState's 5.8 Perl + Get imapsync at http://www.linux-france.org/prj/imapsync/dist/ @@ -128,18 +132,20 @@ BUGS Report any bugs to the author: lamiral@linux-france.org IMAP SERVERS - Success stories reported : + Success stories reported (softwares in alphabetic order) : - - Courier IMAP 1.5.1, 2.2.0, 2.1.1 - - Cyrus IMAP 1.5, 1.6, 2.1, 2.1.15, 2.2.1, Cyrus 2.2.2-BETA - - Netscape Mail Server 3.6 (Wintel) - - CommunicatePro server (Redhat 8.0) - - SunONE Messaging server 5.2 - - iPlanet Messaging server 4.15 - - dovecot ?.?? - - UW-imap servers (imap-2000b) rijkkramer IMAP4rev1 2000.287 - BincImap 1.2.3 + - CommunicatePro server (Redhat 8.0) + - Courier IMAP 1.5.1, 2.2.0, 2.1.1 + - Critical Path (7.0.020) + - Cyrus IMAP 1.5, 1.6, 2.1, 2.1.15, 2.2.1, Cyrus 2.2.2-BETA - DBMail 1.2.1 + - dovecot ?.?? + - iPlanet Messaging server 4.15 + - Netscape Mail Server 3.6 (Wintel !) + - SunONE Messaging server 5.2, 6.0 (SUN JES - Java Enterprise System) + - UW-imap servers (imap-2000b) rijkkramer IMAP4rev1 2000.287 + - UW - QMail v2.1 Please report to the author any success or bad story with imapsync and don't forget to mention the IMAP server software names and version on @@ -184,5 +190,5 @@ SIMILAR SOFTWARES Feedback (good or bad) will be always welcome. - $Id: imapsync,v 1.65 2003/12/24 03:04:34 gilles Exp $ + $Id: imapsync,v 1.68 2004/01/28 03:49:29 gilles Exp $ diff --git a/TODO b/TODO index b72edd2..5213f3a 100644 --- a/TODO +++ b/TODO @@ -1,8 +1,10 @@ TODO file for imapsync ---------------------- +Look at http://freshmeat.net/projects/freshmeat-submit/ +Look at comp.mail.imap -Add a --recurse option. +Add a --recurse option when --folder option is used. Add --prefix1 option. Don't know what is the need exactly. diff --git a/VERSION b/VERSION index 5b6cd6b..083b97b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.65 +1.68 diff --git a/imapsync b/imapsync index 74d540f..700065f 100755 --- a/imapsync +++ b/imapsync @@ -2,12 +2,15 @@ =head1 NAME -imapsync - synchronize mailboxes between two imap servers. +imapsync - IMAP sync or copy tool. Synchronize mailboxes between two imap servers. -$Revision: 1.65 $ +$Revision: 1.68 $ =head1 INSTALL + imapsync works fine under any Unix OS. + imapsync works fine under Windows 2000 (at least) and ActiveState's 5.8 Perl + Get imapsync at http://www.linux-france.org/prj/imapsync/dist/ @@ -150,19 +153,20 @@ Report any bugs to the author: lamiral@linux-france.org =head1 IMAP SERVERS -Success stories reported : +Success stories reported (softwares in alphabetic order) : - - Courier IMAP 1.5.1, 2.2.0, 2.1.1 - - Cyrus IMAP 1.5, 1.6, 2.1, 2.1.15, 2.2.1, Cyrus 2.2.2-BETA - - Netscape Mail Server 3.6 (Wintel) - - CommunicatePro server (Redhat 8.0) - - SunONE Messaging server 5.2 - - iPlanet Messaging server 4.15 - - dovecot ?.?? - - UW-imap servers (imap-2000b) rijkkramer IMAP4rev1 2000.287 - BincImap 1.2.3 + - CommunicatePro server (Redhat 8.0) + - Courier IMAP 1.5.1, 2.2.0, 2.1.1 + - Critical Path (7.0.020) + - Cyrus IMAP 1.5, 1.6, 2.1, 2.1.15, 2.2.1, Cyrus 2.2.2-BETA - DBMail 1.2.1 - + - dovecot ?.?? + - iPlanet Messaging server 4.15 + - Netscape Mail Server 3.6 (Wintel !) + - SunONE Messaging server 5.2, 6.0 (SUN JES - Java Enterprise System) + - UW-imap servers (imap-2000b) rijkkramer IMAP4rev1 2000.287 + - UW - QMail v2.1 Please report to the author any success or bad story with imapsync and don't forget to mention the IMAP server @@ -220,7 +224,7 @@ Welcome in shell programming ! Feedback (good or bad) will be always welcome. -$Id: imapsync,v 1.65 2003/12/24 03:04:34 gilles Exp $ +$Id: imapsync,v 1.68 2004/01/28 03:49:29 gilles Exp $ =cut @@ -251,7 +255,7 @@ my( use vars qw ($opt_G); # missing code for this will be option. -$rcs = ' $Id: imapsync,v 1.65 2003/12/24 03:04:34 gilles Exp $ '; +$rcs = ' $Id: imapsync,v 1.68 2004/01/28 03:49:29 gilles Exp $ '; $rcs =~ m/,v (\d+\.\d+)/; $VERSION = ($1) ? $1 : "UNKNOWN"; @@ -282,8 +286,8 @@ $error=0; my $banner = join("", '$RCSfile: imapsync,v $ ', - '$Revision: 1.65 $ ', - '$Date: 2003/12/24 03:04:34 $ ', + '$Revision: 1.68 $ ', + '$Date: 2004/01/28 03:49:29 $ ', "\n", "Mail::IMAPClient version used here is ", $VERSION_IMAPClient, " auth md5 : $md5_supported", diff --git a/patches/imapsync.diff b/patches/imapsync.diff new file mode 100644 index 0000000..6cd0b1f --- /dev/null +++ b/patches/imapsync.diff @@ -0,0 +1,146 @@ +--- imapsync.orig Wed Dec 24 04:04:34 2003 ++++ imapsync Wed Jan 21 10:32:24 2004 +@@ -34,10 +34,13 @@ + [--host2 server2] [--port2 ] + [--user2 ] [--passfile2 ] + [--folder --folder ...] ++ [--include ] [--exclude ] + [--prefix2 ] + [--sep1 ] + [--sep2 ] +- [--syncinternaldate] ++ [--syncinternaldates] ++ [--maxsize ] ++ [--maxage ] + [--delete] [--expunge] + [--subscribed] [--subscribe] + [--dry] +@@ -239,9 +242,10 @@ + $rcs, $debug, $debugimap, $error, + $host1, $host2, $port1, $port2, + $user1, $user2, $password1, $password2, $passfile1, $passfile2, +- @folder, $prefix2, ++ @folder, $include, $exclude, $prefix2, + $sep1, $sep2, + $syncinternaldates, ++ $maxsize, $maxage, + $delete, $expunge, $dry, + $subscribed, $subscribe, + $version, $VERSION, $help, +@@ -369,10 +373,19 @@ + @f_folders = @folder; + }elsif ($subscribed) { + # option --subscribed +- @f_folders = keys (%fs_folders); ++ @f_folders = sort keys (%fs_folders); + }else { + # no option, all folders +- @f_folders = $from->folders() ++ @f_folders = sort $from->folders(); ++ # consider (optional) includes and excludes ++ if ($include) { ++ @f_folders = grep /$include/,@f_folders; ++ print "Only including folders matching pattern '$include'\n"; ++ } ++ if ($exclude) { ++ @f_folders = grep !/$exclude/,@f_folders; ++ print "Excluding folders matching pattern '$exclude'\n"; ++ } + } + + my($f_sep,$t_sep); +@@ -415,13 +428,13 @@ + # my $tohasuidplus = $to->has_capability("UIDPLUS"); + + +-@t_folders = @{$to->folders()}; ++@t_folders = sort @{$to->folders()}; + print + "From folders : ", map("[$_] ",@f_folders),"\n", + "To folders : ", map("[$_] ",@t_folders),"\n"; + + print +- "From subscribed folders : ", map("[$_] ", keys(%fs_folders)), "\n"; ++ "From subscribed folders : ", map("[$_] ", sort keys(%fs_folders)), "\n"; + + sub separator_invert { + my $o_sep="\000"; +@@ -485,9 +498,9 @@ + unless($dry) { $to->subscribe($t_fold) }; + } + +- my @f_msgs = $from->search("ALL"); ++ my @f_msgs = $maxage ? $from->since(time - 86400 * $maxage) : $from->search("ALL"); + $debug and print "LIST FROM : @f_msgs\n"; +- my @t_msgs = $to->search("ALL"); ++ my @t_msgs = $maxage ? $to->since(time - 86400 * $maxage) : $to->search("ALL"); + $debug and print "LIST TO : @t_msgs\n"; + + my %f_hash = (); +@@ -508,6 +521,10 @@ + MESS: foreach my $m_id (keys(%f_hash)) { + my $f_size = $f_hash{$m_id}{'s'}; + my $f_msg = $f_hash{$m_id}{'m'}; ++ if (defined $maxsize and $f_size > $maxsize) { ++ print "Skipping msg #$f_msg:$f_size in folder $f_fold (exceeds maxsize limit)\n"; ++ next MESS; ++ } + $debug and print "key $m_id #$f_msg\n"; + unless (exists($t_hash{$m_id})) { + print "NO msg #$f_msg [$m_id] in $t_fold\n"; +@@ -526,7 +543,7 @@ + my $new_id; + print "flags from : [$flags_f][$d]\n"; + unless($new_id = $to->append_string($t_fold,$string, $flags_f, $d)){ +- warn "Couldn't append msg #$f_msg to folder $t_fold", ++ warn "Couldn't append msg #$f_msg (Subject: ".$from->subject($f_msg).") to folder $t_fold: ", + $to->LastError, "\n"; + $error++; + next MESS; +@@ -619,9 +636,13 @@ + "sep1=s" => \$sep1, + "sep2=s" => \$sep2, + "folder=s" => \@folder, ++ "include=s" => \$include, ++ "exclude=s" => \$exclude, + "prefix2=s" => \$prefix2, + "delete!" => \$delete, + "syncinternaldates!" => \$syncinternaldates, ++ "maxsize=i" => \$maxsize, ++ "maxage=i" => \$maxage, + "dry!" => \$dry, + "expunge!" => \$expunge, + "subscribed!" => \$subscribed, +@@ -656,8 +677,8 @@ + return unless(scalar(keys(%$head))); + foreach my $h (sort keys(%$head)){ + foreach my $val ( @{$head->{$h}}) { +- # no accent in headers ! +- $val =~ y/יטאש/XXXX/; ++ # no 8-bit data in headers ! ++ $val =~ s/[\x80-\xff]/X/g; + $debug and print "${s}H $h:", $val, "\n"; + $headstr .= "$h:". $val; + } +@@ -704,6 +725,12 @@ + --folder : sync only this folder. + --folder : and this one. + --folder : and this one, etc. ++--include : only sync folders matching this regular expression ++ (only effective if neither --folder nor --subscribed ++ is specified) ++--exclude : skip folders matching this regular expression ++ (only effective if neither --folder nor --subscribed ++ is specified) + --prefix2 : add prefix to all destination folders + (usually INBOX. for cyrus imap servers) + --sep1 : separator in case namespace is not supported. +@@ -718,6 +745,8 @@ + expunge is made at the begining so newly + transfered messages won't be expunged. + --syncinternaldates : set the internal dates on host2 same as host1 ++--maxsize : skip messages larger than bytes ++--maxage : skip messages older than days + --dry : do nothing, just print what would be done. + --subscribed : transfer only subscribed folders. + --subscribe : subscribe to the folders transfered on the