This commit is contained in:
Nick Bebout 2011-03-12 02:44:16 +00:00
parent 1ba81f554e
commit 2a4d29a7c2
7 changed files with 71 additions and 47 deletions

View file

@ -6,7 +6,7 @@ imapsync - IMAP synchronization, copy or migration
tool. Synchronize mailboxes between two imap servers. Good
at IMAP migration.
$Revision: 1.133 $
$Revision: 1.135 $
=head1 INSTALL
@ -200,7 +200,7 @@ Success stories reported with the following imap servers
- Cyrus IMAP 1.5, 1.6, 2.1, 2.1.15, 2.1.16, 2.1.18
2.2.1, 2.2.2-BETA, 2.2.10
- DBMail 1.2.1
- Dovecot 0.99.10.4
- Dovecot 0.99.10.4 0.99.14
- Domino (Notes) 6.5, 5.0.6, 5.0.7
- Groupwise IMAP (Novell). Buggy so see the FAQ.
- iPlanet Messaging server 4.15, 5.1
@ -296,7 +296,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.133 2005/05/21 02:33:29 gilles Exp $
$Id: imapsync,v 1.135 2005/06/21 01:29:44 gilles Exp $
=cut
@ -341,34 +341,34 @@ my(
use vars qw ($opt_G); # missing code for this will be option.
$rcs = ' $Id: imapsync,v 1.133 2005/05/21 02:33:29 gilles Exp $ ';
$rcs = ' $Id: imapsync,v 1.135 2005/06/21 01:29:44 gilles Exp $ ';
$rcs =~ m/,v (\d+\.\d+)/;
$VERSION = ($1) ? $1 : "UNKNOWN";
my $VERSION_IMAPClient = $Mail::IMAPClient::VERSION;
my $md5_supported = 0;
$md5_supported = md5_supported();
check_lib_version() or
die "Upgrade perl lib Mail::IMAPClient to release 2.2.9 at least\n";
$mess_size_total_trans = 0;
$mess_size_total_skipped = 0;
$mess_size_total_error = 0;
$mess_trans = $mess_skipped = 0;
sub md5_supported {
# before 2.2.6 no md5 native
sub check_lib_version {
# I know this is ugly, I should write a sort function
if ($VERSION_IMAPClient =~ m/(\d+)\.(\d+)\.(\d+)/) {
$debug and print "VERSION_IMAPClient $1 $2 $3\n";
my($major,$minor,$sub) = ($1, $2, $3);
return(1) if($major >=3);
return(0) if($major <=1);
return(1) if($minor >=3);
return(0) if($minor <=1);
return(1) if($sub >=6);
return(0) if($sub <=5);
return(1) if($sub >=8);
return(0) if($sub <=7);
}else{
return 0; # don't match regex => bad
}
@ -378,12 +378,11 @@ $error=0;
my $banner = join("",
'$RCSfile: imapsync,v $ ',
'$Revision: 1.133 $ ',
'$Date: 2005/05/21 02:33:29 $ ',
'$Revision: 1.135 $ ',
'$Date: 2005/06/21 01:29:44 $ ',
"\n",
"Mail::IMAPClient version used here is ",
$VERSION_IMAPClient, " auth md5 : $md5_supported",
"\n"
$VERSION_IMAPClient,"\n"
);
unless(defined(&_SYSEXITS_H)) {
@ -439,11 +438,6 @@ my $to = ();
my $authmech = "CRAM-MD5";
unless ($md5_supported) {
print "Auth $authmech not supported by IMAPClient $VERSION_IMAPClient\n";
}else{
print "Auth $authmech supported by IMAPClient $VERSION_IMAPClient\n";
}
$timestart = time();
$timebefore = $timestart;
@ -491,9 +485,7 @@ sub login_imap {
sub md5auth() {
my ($imap) = @_;
unless ($md5_supported) {
return;
}
unless ($authmd5) {
print "$authmech not wanted by you\n";
return;
@ -775,17 +767,17 @@ FOLDER: foreach my $f_fold (@f_folders) {
print "From Buffer I/O : ", $from->Buffer(), "\n";
print "To Buffer I/O : ", $to->Buffer(), "\n";
#print "From Buffer I/O : ", $from->Buffer(), "\n";
#print "To Buffer I/O : ", $to->Buffer(), "\n";
print "++++ From Parse 1 ++++\n";
my $f_heads = $from->parse_headers($from->Range([@f_msgs]),@useheader)
if (@f_msgs) ;
print "Time headers: ", timenext(), " s\n";
$debug and print "Time headers: ", timenext(), " s\n";
my $f_size = $from->fetch_hash("RFC822.SIZE") if (@f_msgs);
print "Time sizes : ", timenext(), " s\n";
$debug and print "Time sizes : ", timenext(), " s\n";
#my $f_flags = $from->flags(@f_msgs) ;
#print "Time flags : ", timenext(), " s\n";
use Data::Dumper;
@ -796,24 +788,24 @@ FOLDER: foreach my $f_fold (@f_folders) {
foreach my $m (@f_msgs) {
parse_header_msg1($m, $f_heads, $f_size, "F", \%f_hash);
}
print "Time headers: ", timenext(), " s\n";
$debug and print "Time headers: ", timenext(), " s\n";
print "\n++++ To Parse 1 ++++\n";
print "++++ To Parse 1 ++++\n";
my $t_heads = $to->parse_headers($to->Range([@t_msgs]),@useheader)
if (@t_msgs);
print "Time headers: ", timenext(), " s\n";
$debug and print "Time headers: ", timenext(), " s\n";
my $t_size = $to->fetch_hash("RFC822.SIZE") if (@t_msgs);
print "Time sizes : ", timenext(), " s\n";
$debug and print "Time sizes : ", timenext(), " s\n";
#my $t_flags = $to->flags(@t_msgs) ;
#print "Time flags : ", timenext(), " s\n";
foreach my $m (@t_msgs) {
parse_header_msg1($m, $t_heads, $t_size, "T", \%t_hash);
}
print "Time headers: ", timenext(), " s\n";
$debug and print "Time headers: ", timenext(), " s\n";
#exit;
print "\n++++ Verifying ++++\n";
print "++++ Verifying ++++\n";
# messages in "from" that are not good in "to"
my @f_hash_keys_sorted_by_uid
@ -1154,7 +1146,7 @@ Several options are mandatory.
--(no)foldersizes : Calculate the size of each "From" folder in bytes
and message counts. Meant to be used with
--justconnect. Turned on by default.
--syncacls : Synchronizes acls.
--syncacls : Synchronizes acls (Access Control Lists).
--nosyncacls : Does not synchronize acls. This is the default.
--debug : debug mode.
--debugimap : imap debug mode.
@ -1162,7 +1154,7 @@ Several options are mandatory.
--justconnect : just connect to both servers and print useful
information.
--justfolders : just do things about folders (ignore messages).
--fast : be faster.
--fast : be faster (does not sync flags).
--timeout <int> : imap connect timeout.
--help : print this.