mirror of
https://github.com/imapsync/imapsync.git
synced 2025-07-25 19:48:14 +02:00
1.337
This commit is contained in:
parent
250d6fab28
commit
26a302f586
11 changed files with 323 additions and 134 deletions
118
imapsync
118
imapsync
|
@ -19,7 +19,7 @@ tool. Synchronise mailboxes between two imap servers. Good
|
|||
at IMAP migration. More than 32 different IMAP server softwares
|
||||
supported with success.
|
||||
|
||||
$Revision: 1.333 $
|
||||
$Revision: 1.337 $
|
||||
|
||||
=head1 INSTALL
|
||||
|
||||
|
@ -247,14 +247,10 @@ softwares. Do not hesitate to pay him for that services.
|
|||
|
||||
=head1 BUG REPORT GUIDELINES
|
||||
|
||||
Report any bugs or feature requests to the public mailing-list
|
||||
or to the author.
|
||||
|
||||
Help us to help you: follow the following guidelines.
|
||||
|
||||
One time in your life, read the paper
|
||||
"How To Ask Questions The Smart Way"
|
||||
http://www.catb.org/~esr/faqs/smart-questions.html
|
||||
Report any bugs or feature requests to the public mailing-list
|
||||
or to the author.
|
||||
|
||||
Before reporting bugs, read the FAQ, the README and the
|
||||
TODO files. http://www.linux-france.org/prj/imapsync/
|
||||
|
@ -264,10 +260,11 @@ is already fixed.
|
|||
|
||||
Upgrade to last Mail-IMAPClient Perl module.
|
||||
http://search.cpan.org/dist/Mail-IMAPClient/
|
||||
maybe the bug is already fixed.
|
||||
|
||||
Make a good title with word "imapsync" in it (my spam filter won't filter it),
|
||||
Don't write an email title with just "imapsync" or "problem",
|
||||
a good title is made of keywords summary, not too long (one visible line).
|
||||
a good title is made of keywords summary, not too long (one visible line).
|
||||
|
||||
Don't write imapsync in uppercase in the email title, we'll
|
||||
know you run windows(tm) and you haven't read the README yet.
|
||||
|
@ -275,18 +272,31 @@ know you run windows(tm) and you haven't read the README yet.
|
|||
Help us to help you: in your report, please include:
|
||||
|
||||
- imapsync version.
|
||||
|
||||
- output given with --debug --debugimap near the failure point.
|
||||
Isolate a message in a folder 'BUG' and use --folder 'BUG'
|
||||
Isolate a message or two in a folder 'BUG' and use
|
||||
--folder 'BUG' --debug --debugimap
|
||||
|
||||
- imap server software on both side and their version number.
|
||||
|
||||
- imapsync with all the options you use, the full command line
|
||||
you use (except the passwords of course).
|
||||
|
||||
- IMAPClient.pm version.
|
||||
|
||||
- operating system running imapsync.
|
||||
|
||||
- operating systems on both sides and the third side in case
|
||||
you run imapsync on a foreign host from the both.
|
||||
|
||||
- virtual software context (vmware, xen etc.)
|
||||
|
||||
Most of those values can be found as a copy/paste at the begining of the output.
|
||||
Most of those values can be found as a copy/paste at the begining of the output.
|
||||
|
||||
One time in your life, read the paper
|
||||
"How To Ask Questions The Smart Way"
|
||||
http://www.catb.org/~esr/faqs/smart-questions.html
|
||||
and forget it.
|
||||
|
||||
=head1 IMAP SERVERS
|
||||
|
||||
|
@ -444,7 +454,7 @@ Entries for imapsync:
|
|||
|
||||
Feedback (good or bad) will always be welcome.
|
||||
|
||||
$Id: imapsync,v 1.333 2010/07/14 23:55:13 gilles Exp gilles $
|
||||
$Id: imapsync,v 1.337 2010/07/16 23:23:40 gilles Exp gilles $
|
||||
|
||||
=cut
|
||||
|
||||
|
@ -486,6 +496,7 @@ my(
|
|||
$sep1, $sep2,
|
||||
$syncinternaldates,
|
||||
$idatefromheader,
|
||||
$usedatemanip,
|
||||
$syncacls,
|
||||
$fastio1, $fastio2,
|
||||
$maxsize, $maxage, $minage,
|
||||
|
@ -507,6 +518,8 @@ my(
|
|||
$nb_msg_skipped_dry_mode,
|
||||
$h1_nb_msg_duplicate,
|
||||
$h2_nb_msg_duplicate,
|
||||
$h1_nb_msg_noheader,
|
||||
$h2_nb_msg_noheader,
|
||||
$h1_total_bytes_duplicate,
|
||||
$h2_total_bytes_duplicate,
|
||||
$h1_nb_msg_deleted,
|
||||
|
@ -529,7 +542,7 @@ my(
|
|||
|
||||
# global variables initialisation
|
||||
|
||||
$rcs = '$Id: imapsync,v 1.333 2010/07/14 23:55:13 gilles Exp gilles $ ';
|
||||
$rcs = '$Id: imapsync,v 1.337 2010/07/16 23:23:40 gilles Exp gilles $ ';
|
||||
|
||||
$total_bytes_transferred = 0;
|
||||
$total_bytes_skipped = 0;
|
||||
|
@ -537,7 +550,8 @@ $total_bytes_error = 0;
|
|||
$nb_msg_transferred = 0;
|
||||
$nb_msg_skipped = $nb_msg_skipped_dry_mode = 0;
|
||||
$h1_nb_msg_deleted = $h2_nb_msg_deleted = 0;
|
||||
$h1_nb_msg_duplicate = $h2_nb_msg_duplicate =0;
|
||||
$h1_nb_msg_duplicate = $h2_nb_msg_duplicate = 0;
|
||||
$h1_nb_msg_noheader = $h2_nb_msg_noheader = 0;
|
||||
$h1_total_bytes_duplicate = $h2_total_bytes_duplicate = 0;
|
||||
|
||||
$nb_errors = 0;
|
||||
|
@ -559,8 +573,8 @@ $pidfile ||= $tmpdir . '/imapsync.pid';
|
|||
# allow Mail::IMAPClient 3.0.xx by default
|
||||
$allow3xx = defined($allow3xx) ? $allow3xx : 1;
|
||||
|
||||
check_lib_version() or
|
||||
die "imapsync needs perl lib Mail::IMAPClient release 2.2.9, or 3.0.25 or superior \n";
|
||||
# Does not use Date::Manip by default: buggy 5.x vs 6.x and slow
|
||||
$usedatemanip = defined($usedatemanip) ? $usedatemanip : 0;
|
||||
|
||||
print banner_imapsync(@argv_copy);
|
||||
|
||||
|
@ -570,6 +584,8 @@ is_valid_directory($tmpdir);
|
|||
write_pidfile($pidfile) if ($pidfile);
|
||||
|
||||
print "Modules version list:\n", modules_VERSION(), "\n";
|
||||
check_lib_version() or
|
||||
die "imapsync needs perl lib Mail::IMAPClient release 2.2.9, or 3.0.25 or superior \n";
|
||||
|
||||
exit_clean(0) if ($justbanner);
|
||||
|
||||
|
@ -635,7 +651,7 @@ if ($justconnect) {
|
|||
$user1 || missing_option("--user1");
|
||||
$user2 || missing_option("--user2");
|
||||
|
||||
$syncinternaldates = defined($syncinternaldates) ? defined($syncinternaldates) : 1;
|
||||
$syncinternaldates = defined($syncinternaldates) ? $syncinternaldates : 1;
|
||||
|
||||
if($idatefromheader) {
|
||||
print "Turned ON idatefromheader, ",
|
||||
|
@ -651,16 +667,28 @@ if ($syncinternaldates) {
|
|||
}
|
||||
|
||||
if ($syncinternaldates || $idatefromheader) {
|
||||
|
||||
# Date::Manip is an ugly module it exits (confess) for reading an unset value
|
||||
# I should write a bug report but too lazy.
|
||||
|
||||
no warnings 'redefine';
|
||||
local *Carp::confess = sub { return undef; };
|
||||
require Date::Manip;
|
||||
Date::Manip->import(qw(ParseDate UnixDate Date_Init Date_TimeZone));
|
||||
#print "Date_init: [", join(" ",Date_Init()), "]\n";
|
||||
print "TimeZone:[", Date_TimeZone(), "]\n";
|
||||
if (not (Date_TimeZone())) {
|
||||
warn "TimeZone not defined, setting it to GMT";
|
||||
Date_Init("TZ=GMT");
|
||||
|
||||
if ($OSNAME eq "MSWin32") {
|
||||
# It seems that local *Carp does not work on win32
|
||||
my $TZ = $ENV{TZ} || 'GMT';
|
||||
Date_Init("TZ=$TZ");
|
||||
print "TimeZone: [", Date_TimeZone(), "]\n";
|
||||
}else{
|
||||
#print "Date_init: [", join(" ",Date_Init()), "]\n";
|
||||
print "TimeZone:[", Date_TimeZone(), "]\n";
|
||||
if (not (Date_TimeZone())) {
|
||||
warn "TimeZone not defined, setting it to GMT";
|
||||
Date_Init("TZ=GMT");
|
||||
print "TimeZone: [", Date_TimeZone(), "]\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1196,7 +1224,7 @@ foreach my $h1_fold (@h1_folders) {
|
|||
|
||||
if ($foldersizes) {
|
||||
foldersizes("Host1", $imap1, \@h1_folders);
|
||||
foldersizes("Host2", $imap2, \@h2_folders);
|
||||
foldersizes("Host2", $imap2, \@h2_folders);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1610,11 +1638,13 @@ FOLDER: foreach my $h1_fold (@h1_folders) {
|
|||
print "+ Skipping msg #$m:$h1_size on host1 folder $h1_fold (no header so we ignore this message)\n";
|
||||
$total_bytes_skipped += $h1_size;
|
||||
$nb_msg_skipped += 1;
|
||||
$h1_nb_msg_noheader +=1;
|
||||
} elsif(0 == $rc) {
|
||||
# duplicate
|
||||
push(@h1_msgs_duplicate, $m);
|
||||
# duplicate, same id same size?
|
||||
my $h1_size = $h1_fir->{$m}->{"RFC822.SIZE"} || 0;
|
||||
$nb_msg_skipped += 1;
|
||||
$h1_total_bytes_duplicate += $h1_size;
|
||||
$h1_nb_msg_duplicate += 1;
|
||||
}
|
||||
|
@ -1639,6 +1669,7 @@ FOLDER: foreach my $h1_fold (@h1_folders) {
|
|||
if (! defined($rc)) {
|
||||
my $h2_size = $h2_fir->{$m}->{"RFC822.SIZE"} || 0;
|
||||
print "+ Skipping msg #$m:$h2_size in host2 folder $h2_fold (no header so we ignore this message)\n";
|
||||
$h2_nb_msg_noheader += 1 ;
|
||||
} elsif(0 == $rc) {
|
||||
# duplicate
|
||||
my $h2_size = $h2_fir->{$m}->{"RFC822.SIZE"} || 0;
|
||||
|
@ -1847,6 +1878,7 @@ Bye.'
|
|||
|
||||
sub good_date {
|
||||
my ($d) = @_;
|
||||
return($d) if (! $usedatemanip);
|
||||
$d = UnixDate(ParseDate($d), "%d-%b-%Y %H:%M:%S %z");
|
||||
$d = "\"$d\"";
|
||||
return($d);
|
||||
|
@ -1863,6 +1895,7 @@ Bye.'
|
|||
print "flags & date from: [$h1_flags][$d]\n";
|
||||
last FOLDER if $imap1->IsUnconnected();
|
||||
last FOLDER if $imap2->IsUnconnected();
|
||||
$d = undef;
|
||||
unless ($dry) {
|
||||
|
||||
if ($OSNAME eq "MSWin32") {
|
||||
|
@ -2062,7 +2095,7 @@ exit_clean(0);
|
|||
# subroutines
|
||||
|
||||
sub imapsync_version {
|
||||
my $rcs = '$Id: imapsync,v 1.333 2010/07/14 23:55:13 gilles Exp gilles $ ';
|
||||
my $rcs = '$Id: imapsync,v 1.337 2010/07/16 23:23:40 gilles Exp gilles $ ';
|
||||
$rcs =~ m/,v (\d+\.\d+)/;
|
||||
my $VERSION = ($1) ? $1: "UNKNOWN";
|
||||
return($VERSION);
|
||||
|
@ -2146,8 +2179,8 @@ sub banner_imapsync {
|
|||
my @argv_copy = @_;
|
||||
my $banner_imapsync = join("",
|
||||
'$RCSfile: imapsync,v $ ',
|
||||
'$Revision: 1.333 $ ',
|
||||
'$Date: 2010/07/14 23:55:13 $ ',
|
||||
'$Revision: 1.337 $ ',
|
||||
'$Date: 2010/07/16 23:23:40 $ ',
|
||||
"\n",localhost_info(), "\n",
|
||||
"Command line used:\n",
|
||||
"$0 ", command_line_nopassword(@argv_copy), "\n",
|
||||
|
@ -2235,25 +2268,27 @@ sub select_msgs {
|
|||
|
||||
sub stats {
|
||||
print "++++ Statistics ++++\n";
|
||||
print "Transfer time : $timediff sec\n";
|
||||
print "Messages transferred : $nb_msg_transferred ";
|
||||
print "Transfer time : $timediff sec\n";
|
||||
print "Messages transferred : $nb_msg_transferred ";
|
||||
print "(could be $nb_msg_skipped_dry_mode without dry mode)" if ($dry);
|
||||
print "\n";
|
||||
print "Messages skipped : $nb_msg_skipped\n";
|
||||
print "Messages duplicate on host1 : $h1_nb_msg_duplicate\n";
|
||||
print "Messages duplicate on host2 : $h2_nb_msg_duplicate\n";
|
||||
print "Messages deleted on host1 : $h1_nb_msg_deleted\n";
|
||||
print "Messages deleted on host2 : $h2_nb_msg_deleted\n";
|
||||
print "Total bytes transferred : $total_bytes_transferred\n";
|
||||
print "Total bytes duplicate host1 : $h1_total_bytes_duplicate\n";
|
||||
print "Total bytes duplicate host2 : $h2_total_bytes_duplicate\n";
|
||||
print "Total bytes skipped : $total_bytes_skipped\n";
|
||||
print "Total bytes error : $total_bytes_error\n";
|
||||
print "Messages skipped : $nb_msg_skipped\n";
|
||||
print "Messages found duplicate on host1 : $h1_nb_msg_duplicate\n";
|
||||
print "Messages found duplicate on host2 : $h2_nb_msg_duplicate\n";
|
||||
print "Messages void (noheader) on host1 : $h1_nb_msg_noheader\n";
|
||||
print "Messages void (noheader) on host2 : $h2_nb_msg_noheader\n";
|
||||
print "Messages deleted on host1 : $h1_nb_msg_deleted\n";
|
||||
print "Messages deleted on host2 : $h2_nb_msg_deleted\n";
|
||||
print "Total bytes transferred : $total_bytes_transferred\n";
|
||||
print "Total bytes duplicate host1 : $h1_total_bytes_duplicate\n";
|
||||
print "Total bytes duplicate host2 : $h2_total_bytes_duplicate\n";
|
||||
print "Total bytes skipped : $total_bytes_skipped\n";
|
||||
print "Total bytes error : $total_bytes_error\n";
|
||||
$timediff ||= 1; # No division per 0
|
||||
printf ("Message rate : %.1f messages/s\n", $nb_msg_transferred / $timediff);
|
||||
printf ("Average bandwidth rate : %.1f KiB/s\n", $total_bytes_transferred / 1024 / $timediff);
|
||||
print "Reconnections to host1 : $host1_reconnect_count\n";
|
||||
print "Reconnections to host2 : $host2_reconnect_count\n";
|
||||
printf ("Message rate : %.1f messages/s\n", $nb_msg_transferred / $timediff);
|
||||
printf ("Average bandwidth rate : %.1f KiB/s\n", $total_bytes_transferred / 1024 / $timediff);
|
||||
print "Reconnections to host1 : $host1_reconnect_count\n";
|
||||
print "Reconnections to host2 : $host2_reconnect_count\n";
|
||||
print "Detected $nb_errors errors\n\n";
|
||||
print thank_author();
|
||||
}
|
||||
|
@ -2308,6 +2343,7 @@ sub get_options {
|
|||
"delete2!" => \$delete2,
|
||||
"syncinternaldates!" => \$syncinternaldates,
|
||||
"idatefromheader!" => \$idatefromheader,
|
||||
"usedatemanip!" => \$usedatemanip,
|
||||
"syncacls!" => \$syncacls,
|
||||
"maxsize=i" => \$maxsize,
|
||||
"maxage=i" => \$maxage,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue