From 1afcfe91ff84c51f163a6d133a7e1342210e5f7f Mon Sep 17 00:00:00 2001 From: Nick Bebout Date: Sat, 12 Mar 2011 02:44:54 +0000 Subject: [PATCH] 1.321 --- ChangeLog | 20 ++++++++++++++++---- README | 6 +++--- TIME | 2 ++ VERSION | 2 +- imapsync | 51 +++++++++++++++++++++++++-------------------------- tests.sh | 25 ++++++++++++++++++++++--- 6 files changed, 69 insertions(+), 37 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7a7b2f7..537d20c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,17 +1,29 @@ RCS file: RCS/imapsync,v Working file: imapsync -head: 1.318 +head: 1.321 branch: locks: strict - gilles: 1.318 + gilles: 1.321 access list: symbolic names: keyword substitution: kv -total revisions: 318; selected revisions: 318 +total revisions: 321; selected revisions: 321 description: ---------------------------- -revision 1.318 locked by: gilles; +revision 1.321 locked by: gilles; +date: 2010/07/09 03:27:31; author: gilles; state: Exp; lines: +6 -6 +Added Smarter Mail 5.0 success. +---------------------------- +revision 1.320 +date: 2010/07/09 03:02:07; author: gilles; state: Exp; lines: +20 -23 +Better reconnect handling. +---------------------------- +revision 1.319 +date: 2010/07/09 00:49:26; author: gilles; state: Exp; lines: +9 -7 +Added Maxcommandlength call. +---------------------------- +revision 1.318 date: 2010/07/07 23:44:35; author: gilles; state: Exp; lines: +43 -39 Added --subscribe_all option. Reviewed and updated inline help. diff --git a/README b/README index 997d7b3..0a7b582 100644 --- a/README +++ b/README @@ -3,7 +3,7 @@ NAME Synchronise mailboxes between two imap servers. Good at IMAP migration. More than 32 different IMAP server softwares supported with success. - $Revision: 1.318 $ + $Revision: 1.321 $ INSTALL imapsync works fine under any Unix OS with perl. @@ -297,7 +297,7 @@ IMAP SERVERS - Rockliffe Mailsite 5.3.11, 4.5.6 - Samsung Contact IMAP server 8.5.0 - Scalix v10.1, 10.0.1.3, 11.0.0.431 - - SmarterMail + - SmarterMail, Smarter Mail 5.0 Enterprise. - SunONE Messaging server 5.2, 6.0 (SUN JES - Java Enterprise System) - Sun Java(tm) System Messaging Server 6.2-2.05, 6.2-7.05 - Surgemail 3.6f5-5 @@ -375,5 +375,5 @@ SIMILAR SOFTWARES Feedback (good or bad) will always be welcome. - $Id: imapsync,v 1.318 2010/07/07 23:44:35 gilles Exp gilles $ + $Id: imapsync,v 1.321 2010/07/09 03:27:31 gilles Exp gilles $ diff --git a/TIME b/TIME index 5f29385..004cd87 100644 --- a/TIME +++ b/TIME @@ -1,4 +1,6 @@ +600 split maxcommandlenght, email, reconnect better. +25 reconnect AUTOLOADING bug? 80 --subscribe_all. 1.318 70 Risko email. 1.315 on debian. 130 diff --git a/VERSION b/VERSION index b46816d..d361114 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.318 +1.321 diff --git a/imapsync b/imapsync index 0d9df07..c46e2e6 100755 --- a/imapsync +++ b/imapsync @@ -9,7 +9,7 @@ tool. Synchronise mailboxes between two imap servers. Good at IMAP migration. More than 32 different IMAP server softwares supported with success. -$Revision: 1.318 $ +$Revision: 1.321 $ =head1 INSTALL @@ -333,7 +333,7 @@ Success stories reported with the following 36 imap servers - Rockliffe Mailsite 5.3.11, 4.5.6 - Samsung Contact IMAP server 8.5.0 - Scalix v10.1, 10.0.1.3, 11.0.0.431 - - SmarterMail + - SmarterMail, Smarter Mail 5.0 Enterprise. - SunONE Messaging server 5.2, 6.0 (SUN JES - Java Enterprise System) - Sun Java(tm) System Messaging Server 6.2-2.05, 6.2-7.05 - Surgemail 3.6f5-5 @@ -433,7 +433,7 @@ Entries for imapsync: Feedback (good or bad) will always be welcome. -$Id: imapsync,v 1.318 2010/07/07 23:44:35 gilles Exp gilles $ +$Id: imapsync,v 1.321 2010/07/09 03:27:31 gilles Exp gilles $ =cut @@ -507,7 +507,7 @@ my( use vars qw ($opt_G); # missing code for this will be option. -$rcs = '$Id: imapsync,v 1.318 2010/07/07 23:44:35 gilles Exp gilles $ '; +$rcs = '$Id: imapsync,v 1.321 2010/07/09 03:27:31 gilles Exp gilles $ '; $rcs =~ m/,v (\d+\.\d+)/; $VERSION = ($1) ? $1: "UNKNOWN"; @@ -572,8 +572,8 @@ while (@argv_copy) { my $banner = join("", '$RCSfile: imapsync,v $ ', - '$Revision: 1.318 $ ', - '$Date: 2010/07/07 23:44:35 $ ', + '$Revision: 1.321 $ ', + '$Date: 2010/07/09 03:27:31 $ ', "\n",localhost_info(), " and the module Mail::IMAPClient version used here is ", $VERSION_IMAPClient,"\n", @@ -2037,8 +2037,8 @@ sub lost_connection { } } -$imap1->logout() unless (lost_connection($imap1,"host1 [$host1]")); -$imap2->logout() unless (lost_connection($imap2,"host2 [$host2]")); +$imap1->logout(); +$imap2->logout(); $timeend = time(); @@ -3081,6 +3081,12 @@ no warnings 'once'; return $self->{SSL}; }; +*Mail::IMAPClient::exists = sub { + my ( $self, $folder ) = @_; + $self->status($folder) ? $self : undef; +}; + + *Mail::IMAPClient::Authuser = sub { my $self = shift; @@ -3140,24 +3146,15 @@ no warnings 'once'; push( @err, $self->LastError ) if $self->LastError; #print "call @_ done [$rc] [$retry][" . $self->IsUnconnected . "]\n"; } - - if ( !defined($rc) and $retry and $self->IsUnconnected) { - #print "maybe not good: $!\n"; - last - unless ( - $! == EPIPE - or $! == ECONNRESET - or $self->LastError =~ /(?:error\(.*?\)|timeout) waiting\b/i - or $self->LastError =~ /(?:socket closed|\* BYE)\b/i - - # BUG? reconnect if caller ignored/missed earlier errors? - # or $self->LastError =~ /NO not connected/ - ); - if ( $self->reconnect ) { - print "reconnect successful on try #$tries"; + + if ( !defined($rc) and $retry and $self->IsUnconnected + and $self->LastIMAPCommand !~ /LOGOUT/) { + print "\nWarning: disconnected. "; + if ( $self->reconnect ) { + print "Reconnect successful on try #$tries\n"; } else { - print "reconnect failed on try #$tries"; + print "Reconnect failed on try #$tries\n"; push( @err, $self->LastError ) if $self->LastError; } } @@ -3619,11 +3616,13 @@ sub starttls { package Mail::IMAPClient; - sub Split { my $self = shift; - if (@_) { $self->{SPLIT} = shift } + if (@_) { + $self->{SPLIT} = shift; + $self->{Maxcommandlength} = 10 * $self->{SPLIT}; + } return $self->{SPLIT}; } diff --git a/tests.sh b/tests.sh index 28c6b89..9ab5ec3 100644 --- a/tests.sh +++ b/tests.sh @@ -1,6 +1,6 @@ #!/bin/sh -# $Id: tests.sh,v 1.102 2010/06/11 02:50:28 gilles Exp gilles $ +# $Id: tests.sh,v 1.104 2010/07/09 03:06:44 gilles Exp gilles $ # Example: # CMD_PERL='perl -I./Mail-IMAPClient-3.14/lib' sh -x tests.sh @@ -157,6 +157,8 @@ locallocal() { --allow3xx } + + ll_ask_password() { { sleep 2; cat ../../var/pass/secret.tata; } | \ $CMD_PERL ./imapsync \ @@ -176,6 +178,8 @@ ll_timeout() { --allow3xx } + + ll_timeout_ssl() { $CMD_PERL ./imapsync \ --host1 $HOST1 --user1 tata \ @@ -357,8 +361,23 @@ ll_justfoldersizes() --passfile1 ../../var/pass/secret.tata \ --host2 $HOST2 --user2 titi \ --passfile2 ../../var/pass/secret.titi \ - --justfoldersizes \ - --allow3xx + --justfoldersizes +} + +ll_dev_reconnect() +{ +# in another terminal: +# +# while :; do killall -u vmail imapd; sleepenh 3; done +# + $CMD_PERL ./imapsync \ + --host1 $HOST1 --user1 tata \ + --passfile1 ../../var/pass/secret.tata \ + --host2 $HOST2 --user2 titi \ + --passfile2 ../../var/pass/secret.titi + + #--folder INBOX + #--debug --debugimap }