This commit is contained in:
Nick Bebout 2011-03-12 02:43:49 +00:00
parent 1e4ee2aa4f
commit 3ad00c786c
8 changed files with 824 additions and 25 deletions

View file

@ -4,7 +4,7 @@
imapsync - synchronize mailboxes between two imap servers.
$Revision: 1.53 $
$Revision: 1.55 $
=head1 INSTALL
@ -39,7 +39,7 @@ $Revision: 1.53 $
[--sep2 <char>]
[--syncinternaldate]
[--delete] [--expunge]
[--subscribed]
[--subscribed] [--subscribe]
[--dry]
[--debug] [--debugimap]
[--version] [--help]
@ -153,12 +153,13 @@ Report any bugs to the author: lamiral@linux-france.org
Success stories reported :
- Courier IMAP 1.5.1, 2.1.1
- Cyrus IMAP 1.5, 1.6, 2.1, 2.1.15, 2.2.1
- Cyrus IMAP 1.5, 1.6, 2.1, 2.1.15, 2.2.1, Cyrus 2.2.2-BETA
- Netscape Mail Server 3.6 (Wintel)
- CommunicatePro server (Redhat 8.0)
- SunONE Messaging server 5.2
- iPlanet Messaging server 4.15
- dovecot ?.??
- UW-imap servers (imap-2000b) rijkkramer IMAP4rev1 2000.287
Please report to the author any success or bad story with
imapsync and don't forget to mention the IMAP server
@ -175,6 +176,12 @@ Rate imapsync : http://freshmeat.net/projects/imapsync/
=head1 HUGE MIGRATION
Have a special attention on options
--subscribed
--subscribe
--delete
--expunge
If you have many mailboxes to migrate think about a little
shell program. Write a file called file.csv (for example)
containing users and passwords.
@ -207,7 +214,7 @@ Welcome in shell programming !
Feedback (good or bad) will be always welcome.
$Id: imapsync,v 1.53 2003/12/12 17:34:45 gilles Exp $
$Id: imapsync,v 1.55 2003/12/13 18:16:56 gilles Exp $
=cut
@ -228,14 +235,15 @@ my(
@folder, $prefix2,
$sep1, $sep2,
$syncinternaldates,
$delete, $expunge, $dry, $subscribed, $subscribe,
$delete, $expunge, $dry,
$subscribed, $subscribe,
$version, $VERSION, $help,
);
use vars qw ($opt_G); # missing code for this will be option.
$rcs = ' $Id: imapsync,v 1.53 2003/12/12 17:34:45 gilles Exp $ ';
$rcs = ' $Id: imapsync,v 1.55 2003/12/13 18:16:56 gilles Exp $ ';
$rcs =~ m/,v (\d+\.\d+)/;
$VERSION = ($1) ? $1 : "UNKNOWN";
@ -243,8 +251,8 @@ $error=0;
my $banner = join("",
'$RCSfile: imapsync,v $ ',
'$Revision: 1.53 $ ',
'$Date: 2003/12/12 17:34:45 $ ',
'$Revision: 1.55 $ ',
'$Date: 2003/12/13 18:16:56 $ ',
"\n",
"Mail::IMAPClient version used here is ",
$Mail::IMAPClient::VERSION,
@ -313,16 +321,17 @@ print "To software : ", ($to->Report())[0];
print "From capability : ", join(" ", $from->capability()), "\n";
print "To capability : ", join(" ", $to->capability()), "\n";
my (@f_folders, @t_folders);
my (@f_folders, @t_folders, %fs_folders);
#@f_folders = (scalar(@folder)) ? @folder : @{$from->folders()};
# Make a hash of subscribed folders in source server.
map { $fs_folders{$_}=1 } $from->subscribed();
if (scalar(@folder)) {
# folders given by option --folder
@f_folders = @folder;
}elsif ($subscribed) {
# option --subscribed
@f_folders = $from->subscribed();
@f_folders = keys (%fs_folders);
}else {
# no option, all folders
@f_folders = $from->folders()
@ -364,6 +373,10 @@ print "To separator : [$t_sep]\n";
print
"From folders : ", map("[$_] ",@f_folders),"\n",
"To folders : ", map("[$_] ",@t_folders),"\n";
print
"From subscribed folders : ", map("[$_] ", keys(%fs_folders)), "\n";
#exit;
FOLDER: foreach my $f_fold (@f_folders) {
@ -406,13 +419,13 @@ FOLDER: foreach my $f_fold (@f_folders) {
if ($expunge){
print "Expunging $f_fold and $t_fold\n";
$from->expunge();
$to->expunge();
unless($dry) { $from->expunge() };
unless($dry) { $to->expunge() };
}
if ($subscribe) {
if ($subscribe and exists $fs_folders{$f_fold}) {
print "Subscribing to folder $t_fold on destination server\n";
$to->subscribe($t_fold);
unless($dry) { $to->subscribe($t_fold) };
}
my @f_msgs = $from->search("ALL");
@ -644,11 +657,14 @@ Several options are mandatory.
are not really deleted. See expunge.
--expunge : expunge messages on both account.
expunge delete messages marked deleted.
expunge is made at the begining so newly
transfered messages won't be expunged.
--syncinternaldates : set the internal dates on host2 same as host1
--dry : do nothing, just print what would be done.
--subscribed : transfer only subscribed folders.
--subscribe : subscribe to the folders transfered on the
"destination" server.
"destination" server that are subscribed
on the "source" server.
--debug : debug mode.
--debugimap : imap debug mode.
--version : print sotfware version.