diff --git a/CREDITS b/CREDITS index 5b4a556..caa75b6 100644 --- a/CREDITS +++ b/CREDITS @@ -1,5 +1,9 @@ #!/bin/cat +Ivan Zilic Schmidt +Made me start the FAQ. +Suggested the --regextrans2 option. + Leon Koch Gave Microsoft Exchange 2000 server and Domino IMAP4 Server Release 6.5.1 diff --git a/ChangeLog b/ChangeLog index 81c9e5b..e4a3941 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,15 +1,19 @@ RCS file: RCS/imapsync,v Working file: imapsync -head: 1.89 +head: 1.90 branch: locks: strict access list: symbolic names: keyword substitution: kv -total revisions: 89; selected revisions: 89 +total revisions: 90; selected revisions: 90 description: ---------------------------- +revision 1.90 +date: 2004/04/07 18:14:05; author: gilles; state: Exp; lines: +13 -6 +Added --regextrans2 option +---------------------------- revision 1.89 date: 2004/03/31 17:37:23; author: gilles; state: Exp; lines: +17 -13 Changed debug output diff --git a/FAQ b/FAQ new file mode 100644 index 0000000..e085f13 --- /dev/null +++ b/FAQ @@ -0,0 +1,29 @@ + ++------------------+ +| FAQ for imapsync | ++------------------+ + +Q. I'm migrating from WU to Cyrus, and the mail folders are +under /home/user/mail but the tool copies everything in +/home/user, how can i avoid that? + +R. Use + imapsync ... --include '^mail' +or (better) + imapsync ... --subscribed --subscribe + + + +Q. I'm migrating from WU to Cyrus, and the mail folders are +under /home/user/mail directory. When imapsync creates the +folders in the new cyrus imap server, it makes a folder +"mail" and below that folder puts all the mail folders the +user have in /home/user/mail, i would like to have all those +folders directly under INBOX. + +R. Use + imapsync ... --regextrans2 's/^mail/INBOX/' --dry + look at the simulation and if all transformations seem + good then remove the --dry option. + + diff --git a/README b/README index 26928d4..4d30af0 100644 --- a/README +++ b/README @@ -2,7 +2,7 @@ NAME imapsync - IMAP sync or copy tool. Synchronize mailboxes between two imap servers. - $Revision: 1.89 $ + $Revision: 1.90 $ INSTALL imapsync works fine under any Unix OS. @@ -229,5 +229,5 @@ AUTHOR teaching free open and gratis softwares. Don't hesitate to pay him for that services. - $Id: imapsync,v 1.89 2004/03/31 17:37:23 gilles Exp $ + $Id: imapsync,v 1.90 2004/04/07 18:14:05 gilles Exp $ diff --git a/VERSION b/VERSION index 9313299..e87fb34 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.89 +1.90 diff --git a/imapsync b/imapsync index 4c4fe6b..2bc408c 100755 --- a/imapsync +++ b/imapsync @@ -4,7 +4,7 @@ imapsync - IMAP sync or copy tool. Synchronize mailboxes between two imap servers. -$Revision: 1.89 $ +$Revision: 1.90 $ =head1 INSTALL @@ -269,7 +269,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.89 2004/03/31 17:37:23 gilles Exp $ +$Id: imapsync,v 1.90 2004/04/07 18:14:05 gilles Exp $ =cut @@ -288,7 +288,7 @@ my( $rcs, $debug, $debugimap, $error, $host1, $host2, $port1, $port2, $user1, $user2, $password1, $password2, $passfile1, $passfile2, - @folder, $include, $exclude, $prefix2, + @folder, $include, $exclude, $prefix2, $regextrans2, $sep1, $sep2, $syncinternaldates, $maxsize, $maxage, @@ -307,7 +307,7 @@ my( use vars qw ($opt_G); # missing code for this will be option. -$rcs = ' $Id: imapsync,v 1.89 2004/03/31 17:37:23 gilles Exp $ '; +$rcs = ' $Id: imapsync,v 1.90 2004/04/07 18:14:05 gilles Exp $ '; $rcs =~ m/,v (\d+\.\d+)/; $VERSION = ($1) ? $1 : "UNKNOWN"; @@ -343,8 +343,8 @@ $error=0; my $banner = join("", '$RCSfile: imapsync,v $ ', - '$Revision: 1.89 $ ', - '$Date: 2004/03/31 17:37:23 $ ', + '$Revision: 1.90 $ ', + '$Date: 2004/04/07 18:14:05 $ ', "\n", "Mail::IMAPClient version used here is ", $VERSION_IMAPClient, " auth md5 : $md5_supported", @@ -544,6 +544,7 @@ print "From subscribed folders : ", map("[$_] ", sort keys(%fs_folders)), "\n"; sub separator_invert { + # The separator we hope we'll never encounter my $o_sep="\000"; my($f_fold, $f_sep, $t_sep) = @_; @@ -560,6 +561,10 @@ FOLDER: foreach my $f_fold (@f_folders) { print "From Folder [$f_fold]\n"; $t_fold = separator_invert($f_fold,$f_sep, $t_sep); + if ($regextrans2) { + $debug and print "eval \$t_fold =~ $regextrans2\n"; + eval("\$t_fold =~ $regextrans2"); + } $t_fold = $prefix2 . $t_fold if ($prefix2); print "To Folder [$t_fold]\n"; @@ -763,6 +768,7 @@ sub get_options "include=s" => \$include, "exclude=s" => \$exclude, "prefix2=s" => \$prefix2, + "regextrans2=s" => \$regextrans2, "delete!" => \$delete, "syncinternaldates!" => \$syncinternaldates, "maxsize=i" => \$maxsize, @@ -869,6 +875,7 @@ Several options are mandatory. is specified) --prefix2 : add prefix to all destination folders (usually INBOX. for cyrus imap servers) +--regextrans2 : Apply the whole regex to each destination folders. --sep1 : separator in case namespace is not supported. --sep2 : idem. --delete : delete messages in "from" imap server after diff --git a/tests.sh b/tests.sh index d190a0c..a6eb914 100644 --- a/tests.sh +++ b/tests.sh @@ -1,8 +1,11 @@ #!/bin/sh -# $Id: tests.sh,v 1.16 2004/03/21 23:24:42 gilles Exp $ +# $Id: tests.sh,v 1.17 2004/04/07 18:13:29 gilles Exp $ # $Log: tests.sh,v $ +# Revision 1.17 2004/04/07 18:13:29 gilles +# Added lp_regextrans2() +# # Revision 1.16 2004/03/21 23:24:42 gilles # Added # lp_skipsize() @@ -379,6 +382,24 @@ lp_include() fi } +lp_regextrans2() +{ + sendtestmessage + if test X`hostname` = X"plume"; then + echo3 Here is plume + ./imapsync \ + --host2 plume --user2 tata@est.belle \ + --passfile2 /var/tmp/secret.tata \ + --host1 loul --user1 tata \ + --passfile1 /var/tmp/secret.tata \ + --regextrans2 's/yop/yopX/' --dry + else + : + fi +} + + + bad_login() { ! ./imapsync \ @@ -427,7 +448,8 @@ test $# -eq 0 && run_tests \ bad_host \ lp_noauthmd5 \ lp_skipsize \ - lp_skipheader + lp_skipheader \ + lp_regextrans2 # selective tests