From a50a15a2c16685611155064e2260bea5a785ace1 Mon Sep 17 00:00:00 2001 From: Nick Bebout Date: Sat, 12 Mar 2011 02:43:47 +0000 Subject: [PATCH] 1.40 --- ChangeLog | 17 +++++++++++++++-- README | 7 ++++--- VERSION | 2 +- imapsync | 29 ++++++++++++----------------- tests.sh | 29 +++++++++++++++++++++++++++-- 5 files changed, 59 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5845f30..0c80212 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,15 +1,28 @@ RCS file: RCS/imapsync,v Working file: imapsync -head: 1.37 +head: 1.40 branch: locks: strict access list: symbolic names: keyword substitution: kv -total revisions: 37; selected revisions: 37 +total revisions: 40; selected revisions: 40 description: ---------------------------- +revision 1.40 +date: 2003/10/17 01:34:59; author: gilles; state: Exp; lines: +5 -5 +Added condition to add prefix2 +---------------------------- +revision 1.39 +date: 2003/10/17 01:26:20; author: gilles; state: Exp; lines: +4 -14 +Removed commented code +---------------------------- +revision 1.38 +date: 2003/10/17 01:25:40; author: gilles; state: Exp; lines: +12 -7 +Added --prefix2 option for the INBOX. namespace problem +with cyrus imap servers. +---------------------------- revision 1.37 date: 2003/10/16 01:37:52; author: gilles; state: Exp; lines: +9 -8 Added a loop in case there is several identical key header diff --git a/README b/README index 89ad4e4..40d0813 100644 --- a/README +++ b/README @@ -1,7 +1,7 @@ NAME imapsync - synchronize mailboxes between two imap servers. - $Revision: 1.37 $ + $Revision: 1.40 $ INSTALL Get imapsync at http://www.linux-france.org/prj/imapsync/dist/ @@ -19,7 +19,8 @@ SYNOPSIS [--user1 ] [--passfile1 ] [--host2 server2] [--port2 ] [--user2 ] [--passfile2 ] - [--folder --folder ...] + [--folder --folder ...] + [--prefix2 ] [--delete] [--expunge] [--dry] [--debug] [--debugimap] @@ -126,5 +127,5 @@ SIMILAR SOFTWARES Feedback (good or bad) will be always welcome. - $Id: imapsync,v 1.37 2003/10/16 01:37:52 gilles Exp $ + $Id: imapsync,v 1.40 2003/10/17 01:34:59 gilles Exp $ diff --git a/VERSION b/VERSION index c7fafb2..6477a57 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.37 +1.40 diff --git a/imapsync b/imapsync index 1b90c9c..d26ba4a 100755 --- a/imapsync +++ b/imapsync @@ -4,7 +4,7 @@ imapsync - synchronize mailboxes between two imap servers. -$Revision: 1.37 $ +$Revision: 1.40 $ =head1 INSTALL @@ -24,7 +24,8 @@ $Revision: 1.37 $ [--user1 ] [--passfile1 ] [--host2 server2] [--port2 ] [--user2 ] [--passfile2 ] - [--folder --folder ...] + [--folder --folder ...] + [--prefix2 ] [--delete] [--expunge] [--dry] [--debug] [--debugimap] @@ -146,7 +147,7 @@ Rate imapsync : http://freshmeat.net/projects/imapsync/ Feedback (good or bad) will be always welcome. -$Id: imapsync,v 1.37 2003/10/16 01:37:52 gilles Exp $ +$Id: imapsync,v 1.40 2003/10/17 01:34:59 gilles Exp $ =cut @@ -158,10 +159,10 @@ use Mail::IMAPClient; use Digest::MD5 qw(md5_base64); my( - $rcs, $debug, $debugimap, $error, + $rcs, $debug, $debugimap, $error, $host1, $host2, $port1, $port2, $user1, $user2, $password1, $password2, $passfile1, $passfile2, - @folder, + @folder, $prefix2, $delete, $expunge, $dry, $version, $VERSION, $help, ); @@ -169,12 +170,12 @@ my( use vars qw ($opt_G); # missing code for this will be option. -$rcs = ' $Id: imapsync,v 1.37 2003/10/16 01:37:52 gilles Exp $ '; +$rcs = ' $Id: imapsync,v 1.40 2003/10/17 01:34:59 gilles Exp $ '; $rcs =~ m/,v (\d+\.\d+)/; $VERSION = ($1) ? $1 : "UNKNOWN"; $error=0; -my $banner = '$RCSfile: imapsync,v $ ' . '$Revision: 1.37 $ ' . '$Date: 2003/10/16 01:37:52 $ ' . "\n"; +my $banner = '$RCSfile: imapsync,v $ ' . '$Revision: 1.40 $ ' . '$Date: 2003/10/17 01:34:59 $ ' . "\n"; get_options(); @@ -248,16 +249,6 @@ print "To separator : [$t_sep]\n"; # needed for setting flags my $tohasuidplus = $to->has_capability("UIDPLUS"); -#if (scalar(@folder)) { -# # folders are given as argument. -# foreach my $f_fold (@folder) { -# push (@f_folders, @{$from->folders($f_fold)}); -# } -#}else{ -# # no folder given so select all -# @f_folders = @{$from->folders()}; -#} - @t_folders = @{$to->folders()}; print @@ -270,6 +261,7 @@ FOLDER: foreach my $f_fold (@f_folders) { print "From Folder [$f_fold]\n"; $t_fold = $f_fold; $t_fold =~ s@\Q$f_sep@$t_sep@g unless ($f_sep eq $t_sep); + $t_fold = $prefix2 . $t_fold if ($prefix2); print "To Folder [$t_fold]\n"; unless ($from->select($f_fold)) { warn @@ -435,6 +427,7 @@ sub get_options "passfile1=s" => \$passfile1, "passfile2=s" => \$passfile2, "folder=s" => \@folder, + "prefix2=s" => \$prefix2, "delete!" => \$delete, "dry!" => \$dry, "expunge!" => \$expunge, @@ -509,6 +502,8 @@ Several options are mandatory. --folder : sync only this folder and its children. --folder : and this one (and its children). --folder : and this one, etc. +--prefix2 : Add prefix to all destination folders + (usually INBOX. for cyrus imap servers) --delete : delete messages in "from" imap server after a successful transfert. useful in case you want to migrate from one server to another one. diff --git a/tests.sh b/tests.sh index 7930da8..b645e50 100644 --- a/tests.sh +++ b/tests.sh @@ -1,8 +1,11 @@ #!/bin/sh -# $Id: tests.sh,v 1.6 2003/08/24 01:56:49 gilles Exp $ +# $Id: tests.sh,v 1.7 2003/10/17 01:34:16 gilles Exp $ # $Log: tests.sh,v $ +# Revision 1.7 2003/10/17 01:34:16 gilles +# Added lp_folder_qqq() test +# # Revision 1.6 2003/08/24 01:56:49 gilles # Indented long lines # @@ -125,6 +128,24 @@ lp_folder() { fi } +lp_folder_qqq() { + if test X`hostname` = X"plume"; then + echo3 Here is plume + ./imapsync \ + --host2 plume --user2 tata@est.belle \ + --passfile2 /var/tmp/secret.tata \ + --folder INBOX.qqq \ + --prefix2 INBOX. \ + --host1 loul --user1 tata \ + --passfile1 /var/tmp/secret.tata + else + : + fi +} + + + + pl_folder() { if test X`hostname` = X"plume"; then echo3 Here is plume @@ -140,6 +161,9 @@ pl_folder() { } + + + # mandatory tests run_tests perl_syntax @@ -152,7 +176,8 @@ test $# -eq 0 && run_tests \ loulplume \ plumeloul \ lp_folder \ - pl_folder + pl_folder \ + lp_folder_qqq # selective tests