This commit is contained in:
Nick Bebout 2011-03-12 02:43:56 +00:00
parent f800803e4a
commit a4913ee70d
8 changed files with 1101 additions and 16 deletions

View file

@ -5,7 +5,7 @@
imapsync - IMAP sync or copy tool. Synchronize mailboxes
between two imap servers.
$Revision: 1.94 $
$Revision: 1.95 $
=head1 INSTALL
@ -49,6 +49,7 @@ $Revision: 1.94 $
[--skipsize]
[--delete] [--expunge]
[--subscribed] [--subscribe]
[--foldersizes]
[--dry]
[--debug] [--debugimap]
[--timeout <int>]
@ -271,7 +272,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.94 2004/06/15 03:42:56 gilles Exp gilles $
$Id: imapsync,v 1.95 2004/07/08 23:31:53 gilles Exp $
=cut
@ -294,7 +295,7 @@ my(
$sep1, $sep2,
$syncinternaldates,
$maxsize, $maxage,
$skipheader, $skipsize,
$skipheader, $skipsize, $foldersizes,
$delete, $expunge, $dry,
$authmd5,
$subscribed, $subscribe,
@ -312,7 +313,7 @@ my(
use vars qw ($opt_G); # missing code for this will be option.
$rcs = ' $Id: imapsync,v 1.94 2004/06/15 03:42:56 gilles Exp gilles $ ';
$rcs = ' $Id: imapsync,v 1.95 2004/07/08 23:31:53 gilles Exp $ ';
$rcs =~ m/,v (\d+\.\d+)/;
$VERSION = ($1) ? $1 : "UNKNOWN";
@ -349,8 +350,8 @@ $error=0;
my $banner = join("",
'$RCSfile: imapsync,v $ ',
'$Revision: 1.94 $ ',
'$Date: 2004/06/15 03:42:56 $ ',
'$Revision: 1.95 $ ',
'$Date: 2004/07/08 23:31:53 $ ',
"\n",
"Mail::IMAPClient version used here is ",
$VERSION_IMAPClient, " auth md5 : $md5_supported",
@ -535,6 +536,39 @@ sub get_separator {
print "From separator : [$f_sep]\n";
print "To separator : [$t_sep]\n";
if ($foldersizes)
{
my $tot = 0;
my $tmess = 0;
print "Calculating sizes...\n";
foreach my $f_fold (@f_folders)
{
print "From Folder [$f_fold]\n";
my $stot = 0;
my $smess = 0;
unless ($from->select($f_fold)) {
warn
"From Folder $f_fold : Could not select ",
$from->LastError, "\n";
$error++;
next;
}
my $szs = $from->fetch_hash("RFC822.SIZE") || (warn("Can't get sizes for $f_fold: ",$from->LastError),$error++,next);
my ($k,$v);
while (($k,$v) = each(%$szs))
{
$stot += $v->{'RFC822.SIZE'};
$smess++;
}
print "Size of $f_fold: $stot\n";
print "Messages in $f_fold: $smess\n";
$tot += $stot;
$tmess += $smess;
}
print "Total size: $tot\n";
print "Total messages: $tmess\n";
}
exit if ($justconnect);
# needed for setting flags
@ -789,6 +823,7 @@ sub get_options
"syncinternaldates!" => \$syncinternaldates,
"maxsize=i" => \$maxsize,
"maxage=i" => \$maxage,
"foldersizes" => \$foldersizes,
"dry!" => \$dry,
"expunge!" => \$expunge,
"subscribed!" => \$subscribed,
@ -918,6 +953,9 @@ Several options are mandatory.
--subscribe : subscribe to the folders transfered on the
"destination" server that are subscribed
on the "source" server.
--foldersizes : Discover the size of each "From" folder in bytes
and message counts. Meant to be used with
--justconnect.
--debug : debug mode.
--debugimap : imap debug mode.
--version : print sotfware version.