This commit is contained in:
Nick Bebout 2011-03-12 02:44:54 +00:00
parent 2a3f1b08ab
commit 1afcfe91ff
6 changed files with 69 additions and 37 deletions

View file

@ -1,17 +1,29 @@
RCS file: RCS/imapsync,v RCS file: RCS/imapsync,v
Working file: imapsync Working file: imapsync
head: 1.318 head: 1.321
branch: branch:
locks: strict locks: strict
gilles: 1.318 gilles: 1.321
access list: access list:
symbolic names: symbolic names:
keyword substitution: kv keyword substitution: kv
total revisions: 318; selected revisions: 318 total revisions: 321; selected revisions: 321
description: 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 date: 2010/07/07 23:44:35; author: gilles; state: Exp; lines: +43 -39
Added --subscribe_all option. Added --subscribe_all option.
Reviewed and updated inline help. Reviewed and updated inline help.

6
README
View file

@ -3,7 +3,7 @@ NAME
Synchronise mailboxes between two imap servers. Good at IMAP migration. Synchronise mailboxes between two imap servers. Good at IMAP migration.
More than 32 different IMAP server softwares supported with success. More than 32 different IMAP server softwares supported with success.
$Revision: 1.318 $ $Revision: 1.321 $
INSTALL INSTALL
imapsync works fine under any Unix OS with perl. imapsync works fine under any Unix OS with perl.
@ -297,7 +297,7 @@ IMAP SERVERS
- Rockliffe Mailsite 5.3.11, 4.5.6 - Rockliffe Mailsite 5.3.11, 4.5.6
- Samsung Contact IMAP server 8.5.0 - Samsung Contact IMAP server 8.5.0
- Scalix v10.1, 10.0.1.3, 11.0.0.431 - 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) - 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 - Sun Java(tm) System Messaging Server 6.2-2.05, 6.2-7.05
- Surgemail 3.6f5-5 - Surgemail 3.6f5-5
@ -375,5 +375,5 @@ SIMILAR SOFTWARES
Feedback (good or bad) will always be welcome. 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 $

2
TIME
View file

@ -1,4 +1,6 @@
600 split maxcommandlenght, email, reconnect better.
25 reconnect AUTOLOADING bug?
80 --subscribe_all. 1.318 80 --subscribe_all. 1.318
70 Risko email. 1.315 on debian. 70 Risko email. 1.315 on debian.
130 130

View file

@ -1 +1 @@
1.318 1.321

View file

@ -9,7 +9,7 @@ tool. Synchronise mailboxes between two imap servers. Good
at IMAP migration. More than 32 different IMAP server softwares at IMAP migration. More than 32 different IMAP server softwares
supported with success. supported with success.
$Revision: 1.318 $ $Revision: 1.321 $
=head1 INSTALL =head1 INSTALL
@ -333,7 +333,7 @@ Success stories reported with the following 36 imap servers
- Rockliffe Mailsite 5.3.11, 4.5.6 - Rockliffe Mailsite 5.3.11, 4.5.6
- Samsung Contact IMAP server 8.5.0 - Samsung Contact IMAP server 8.5.0
- Scalix v10.1, 10.0.1.3, 11.0.0.431 - 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) - 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 - Sun Java(tm) System Messaging Server 6.2-2.05, 6.2-7.05
- Surgemail 3.6f5-5 - Surgemail 3.6f5-5
@ -433,7 +433,7 @@ Entries for imapsync:
Feedback (good or bad) will always be welcome. 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 =cut
@ -507,7 +507,7 @@ my(
use vars qw ($opt_G); # missing code for this will be option. 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+)/; $rcs =~ m/,v (\d+\.\d+)/;
$VERSION = ($1) ? $1: "UNKNOWN"; $VERSION = ($1) ? $1: "UNKNOWN";
@ -572,8 +572,8 @@ while (@argv_copy) {
my $banner = join("", my $banner = join("",
'$RCSfile: imapsync,v $ ', '$RCSfile: imapsync,v $ ',
'$Revision: 1.318 $ ', '$Revision: 1.321 $ ',
'$Date: 2010/07/07 23:44:35 $ ', '$Date: 2010/07/09 03:27:31 $ ',
"\n",localhost_info(), "\n",localhost_info(),
" and the module Mail::IMAPClient version used here is ", " and the module Mail::IMAPClient version used here is ",
$VERSION_IMAPClient,"\n", $VERSION_IMAPClient,"\n",
@ -2037,8 +2037,8 @@ sub lost_connection {
} }
} }
$imap1->logout() unless (lost_connection($imap1,"host1 [$host1]")); $imap1->logout();
$imap2->logout() unless (lost_connection($imap2,"host2 [$host2]")); $imap2->logout();
$timeend = time(); $timeend = time();
@ -3081,6 +3081,12 @@ no warnings 'once';
return $self->{SSL}; return $self->{SSL};
}; };
*Mail::IMAPClient::exists = sub {
my ( $self, $folder ) = @_;
$self->status($folder) ? $self : undef;
};
*Mail::IMAPClient::Authuser = sub { *Mail::IMAPClient::Authuser = sub {
my $self = shift; my $self = shift;
@ -3141,23 +3147,14 @@ no warnings 'once';
#print "call @_ done [$rc] [$retry][" . $self->IsUnconnected . "]\n"; #print "call @_ done [$rc] [$retry][" . $self->IsUnconnected . "]\n";
} }
if ( !defined($rc) and $retry and $self->IsUnconnected) { if ( !defined($rc) and $retry and $self->IsUnconnected
#print "maybe not good: $!\n"; and $self->LastIMAPCommand !~ /LOGOUT/) {
last print "\nWarning: disconnected. ";
unless ( if ( $self->reconnect ) {
$! == EPIPE print "Reconnect successful on try #$tries\n";
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";
} }
else { else {
print "reconnect failed on try #$tries"; print "Reconnect failed on try #$tries\n";
push( @err, $self->LastError ) if $self->LastError; push( @err, $self->LastError ) if $self->LastError;
} }
} }
@ -3619,11 +3616,13 @@ sub starttls {
package Mail::IMAPClient; package Mail::IMAPClient;
sub Split { sub Split {
my $self = shift; my $self = shift;
if (@_) { $self->{SPLIT} = shift } if (@_) {
$self->{SPLIT} = shift;
$self->{Maxcommandlength} = 10 * $self->{SPLIT};
}
return $self->{SPLIT}; return $self->{SPLIT};
} }

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/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: # Example:
# CMD_PERL='perl -I./Mail-IMAPClient-3.14/lib' sh -x tests.sh # CMD_PERL='perl -I./Mail-IMAPClient-3.14/lib' sh -x tests.sh
@ -157,6 +157,8 @@ locallocal() {
--allow3xx --allow3xx
} }
ll_ask_password() { ll_ask_password() {
{ sleep 2; cat ../../var/pass/secret.tata; } | \ { sleep 2; cat ../../var/pass/secret.tata; } | \
$CMD_PERL ./imapsync \ $CMD_PERL ./imapsync \
@ -176,6 +178,8 @@ ll_timeout() {
--allow3xx --allow3xx
} }
ll_timeout_ssl() { ll_timeout_ssl() {
$CMD_PERL ./imapsync \ $CMD_PERL ./imapsync \
--host1 $HOST1 --user1 tata \ --host1 $HOST1 --user1 tata \
@ -357,8 +361,23 @@ ll_justfoldersizes()
--passfile1 ../../var/pass/secret.tata \ --passfile1 ../../var/pass/secret.tata \
--host2 $HOST2 --user2 titi \ --host2 $HOST2 --user2 titi \
--passfile2 ../../var/pass/secret.titi \ --passfile2 ../../var/pass/secret.titi \
--justfoldersizes \ --justfoldersizes
--allow3xx }
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
} }