From c7f1a384114542dd479edcf7b4f133d147c2a04e Mon Sep 17 00:00:00 2001 From: Nick Bebout Date: Sat, 12 Mar 2011 02:44:12 +0000 Subject: [PATCH] 1.118 --- CREDITS | 3 ++ ChangeLog | 13 ++++- README | 4 +- VERSION | 2 +- imapsync | 36 ++++++++------ tests.sh | 139 ++++++++++-------------------------------------------- 6 files changed, 65 insertions(+), 132 deletions(-) diff --git a/CREDITS b/CREDITS index 945f937..cfebf92 100644 --- a/CREDITS +++ b/CREDITS @@ -1,5 +1,8 @@ #!/bin/cat +Jean-Michel besnard +Pb with woody, Mail::ImapClient and fetch_hash + Jamie Neil Suggested --regexmess option diff --git a/ChangeLog b/ChangeLog index e1af250..478a409 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,15 +1,24 @@ RCS file: RCS/imapsync,v Working file: imapsync -head: 1.116 +head: 1.118 branch: locks: strict access list: symbolic names: keyword substitution: kv -total revisions: 116; selected revisions: 116 +total revisions: 118; selected revisions: 118 description: ---------------------------- +revision 1.118 +date: 2005/01/17 14:45:25; author: gilles; state: Exp; lines: +10 -8 +--regexmess option can be repeated +---------------------------- +revision 1.117 +date: 2005/01/16 13:51:49; author: gilles; state: Exp; lines: +17 -11 +Changed get_separator() +Calling namespace capability if needed +---------------------------- revision 1.116 date: 2005/01/16 01:50:23; author: gilles; state: Exp; lines: +50 -49 Added --regexmess option diff --git a/README b/README index bb2294d..2868434 100644 --- a/README +++ b/README @@ -2,7 +2,7 @@ NAME imapsync - IMAP synchronization, copy or migration tool. Synchronize mailboxes between two imap servers. Good at IMAP migration. - $Revision: 1.116 $ + $Revision: 1.118 $ INSTALL imapsync works fine under any Unix OS. @@ -239,5 +239,5 @@ AUTHOR teaching free open and gratis softwares. Don't hesitate to pay him for that services. - $Id: imapsync,v 1.116 2005/01/16 01:50:23 gilles Exp $ + $Id: imapsync,v 1.118 2005/01/17 14:45:25 gilles Exp $ diff --git a/VERSION b/VERSION index 1773304..be96d5c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.116 +1.118 diff --git a/imapsync b/imapsync index c98ed5a..70687aa 100755 --- a/imapsync +++ b/imapsync @@ -6,7 +6,7 @@ imapsync - IMAP synchronization, copy or migration tool. Synchronize mailboxes between two imap servers. Good at IMAP migration. -$Revision: 1.116 $ +$Revision: 1.118 $ =head1 INSTALL @@ -281,7 +281,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.116 2005/01/16 01:50:23 gilles Exp $ +$Id: imapsync,v 1.118 2005/01/17 14:45:25 gilles Exp $ =cut @@ -300,7 +300,7 @@ my( $rcs, $debug, $debugimap, $error, $host1, $host2, $port1, $port2, $user1, $user2, $password1, $password2, $passfile1, $passfile2, - @folder, $include, $exclude, $prefix2, $regextrans2, $regexmess, + @folder, $include, $exclude, $prefix2, $regextrans2, @regexmess, $sep1, $sep2, $syncinternaldates, $syncacls, $maxsize, $maxage, @@ -324,7 +324,7 @@ my( use vars qw ($opt_G); # missing code for this will be option. -$rcs = ' $Id: imapsync,v 1.116 2005/01/16 01:50:23 gilles Exp $ '; +$rcs = ' $Id: imapsync,v 1.118 2005/01/17 14:45:25 gilles Exp $ '; $rcs =~ m/,v (\d+\.\d+)/; $VERSION = ($1) ? $1 : "UNKNOWN"; @@ -361,8 +361,8 @@ $error=0; my $banner = join("", '$RCSfile: imapsync,v $ ', - '$Revision: 1.116 $ ', - '$Date: 2005/01/16 01:50:23 $ ', + '$Revision: 1.118 $ ', + '$Date: 2005/01/17 14:45:25 $ ', "\n", "Mail::IMAPClient version used here is ", $VERSION_IMAPClient, " auth md5 : $md5_supported", @@ -515,6 +515,8 @@ if (scalar(@folder)) { } } +@t_folders = sort @{$to->folders()}; + my($f_sep,$t_sep); # what are the private folders separators for each server ? @@ -526,12 +528,17 @@ $t_sep = get_separator($to, $sep2, "--sep2"); sub get_separator { my($imap, $sep_in, $sep_opt) = @_; my($sep_out); - $debug and print "Calling namespace capability\n"; + if ($sep_in) { + print "Using [$sep_in] given by $sep_opt\n"; $sep_out = $sep_in; - }elsif ($imap->has_capability("namespace")) { + return($sep_out); + } + $debug and print "Calling namespace capability\n"; + if ($imap->has_capability("namespace")) { $sep_out = $imap->separator(); + return($sep_out); }else{ print "No NAMESPACE capability in imap server ", @@ -539,7 +546,6 @@ sub get_separator { "Give the separator caracter with the $sep_opt option\n"; exit(1); } - return($sep_out); } @@ -606,7 +612,7 @@ exit if ($justconnect); my $tohasuidplus = $to->has_capability("UIDPLUS"); -@t_folders = sort @{$to->folders()}; + print "From folders : ", map("[$_] ",@f_folders),"\n", "To folders : ", map("[$_] ",@t_folders),"\n"; @@ -735,7 +741,7 @@ FOLDER: foreach my $f_fold (@f_folders) { use Data::Dumper; #print Data::Dumper->Dump([$f_heads]); #print Data::Dumper->Dump([$f_flags]); - + #exit; foreach my $m (@f_msgs) { parse_header_msg1($m, $f_heads, $f_size, "F", \%f_hash); @@ -779,7 +785,7 @@ FOLDER: foreach my $f_fold (@f_folders) { # copy print "+ Copying msg #$f_msg:$f_size to folder $t_fold\n"; my $string = $from->message_string($f_msg); - if ($regexmess) { + while (my $regexmess = shift(@regexmess)) { $debug and print "eval \$string =~ $regexmess\n"; eval("\$string =~ $regexmess"); @@ -926,13 +932,13 @@ sub get_options "exclude=s" => \$exclude, "prefix2=s" => \$prefix2, "regextrans2=s" => \$regextrans2, - "regexmess=s" => \$regexmess, + "regexmess=s" => \@regexmess, "delete!" => \$delete, "syncinternaldates!" => \$syncinternaldates, "syncacls!" => \$syncacls, "maxsize=i" => \$maxsize, "maxage=i" => \$maxage, - "foldersizes" => \$foldersizes, + "foldersizes!" => \$foldersizes, "dry!" => \$dry, "expunge!" => \$expunge, "subscribed!" => \$subscribed, @@ -1076,6 +1082,8 @@ Several options are mandatory. --regextrans2 : Apply the whole regex to each destination folders. --regexmess : Apply the whole regex to each message before transfer. Exemple : 's/\\000/ /g' # to replace null by space. +--regexmess : and this one. +--regexmess : and this one, etc. --sep1 : separator in case namespace is not supported. --sep2 : idem. --delete : delete messages in source imap server after diff --git a/tests.sh b/tests.sh index 786cab9..aea17d1 100644 --- a/tests.sh +++ b/tests.sh @@ -1,116 +1,6 @@ #!/bin/sh -# $Id: tests.sh,v 1.33 2005/01/16 01:49:49 gilles Exp $ - -# $Log: tests.sh,v $ -# Revision 1.33 2005/01/16 01:49:49 gilles -# Added regexmess() test -# -# Revision 1.32 2005/01/10 00:15:41 gilles -# Added --fast for big_transfert() -# -# Revision 1.31 2005/01/04 04:50:12 gilles -# essnet update -# -# Revision 1.30 2004/12/28 23:22:02 gilles -# Added lp_justfolders() -# -# Revision 1.29 2004/12/28 04:03:12 gilles -# Added lp_sep2() -# -# Revision 1.28 2004/12/28 03:15:28 gilles -# essnet tests -# -# Revision 1.27 2004/11/18 03:56:43 gilles -# Added essnet_justconnect() -# -# Revision 1.26 2004/11/04 22:41:54 gilles -# renamed big_transfert2 -> dprof -# -# Revision 1.25 2004/10/15 14:40:05 gilles -# Added big_transfert_sizes_only() -# -# Revision 1.24 2004/10/12 21:18:10 gilles -# Added big_transfert2() -# -# Revision 1.23 2004/09/07 00:38:36 gilles -# Added noauthmd5 to first_sync test -# -# Revision 1.22 2004/07/09 09:11:28 gilles -# comment about pl and lp -# -# Revision 1.21 2004/07/09 09:00:13 gilles -# Added foldersizes2() to check old Mail-IMAPClient lib -# -# Revision 1.20 2004/07/08 23:32:36 gilles -# Added foldersizes() test -# -# Revision 1.19 2004/06/15 03:42:16 gilles -# success on bigtransfer() -# -# Revision 1.18 2004/06/14 23:03:41 gilles -# Added big_transfert() -# -# 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() -# lp_skipheader() -# -# Revision 1.15 2004/03/11 05:32:08 gilles -# Added bad_login() -# Added bad_host() -# Added lp_noauthmd5() -# -# Revision 1.14 2004/02/07 03:34:35 gilles -# Added lp_include() -# -# Revision 1.13 2004/01/29 04:21:54 gilles -# Added lp_maxage -# Added lp_maxsize -# -# Revision 1.12 2003/12/23 18:16:09 gilles -# Added lp_justconnect() -# Added lp_md5auth() -# -# Revision 1.11 2003/12/12 17:48:02 gilles -# Added lp_subscribe() test -# -# Revision 1.10 2003/11/21 03:20:14 gilles -# Renamed lp_folder_qqq() pl_folder_qqq() -# Removed --prefix2 INBOX. in pl_folder_qqq() -# Added lp_subscribed() test. -# -# Revision 1.9 2003/10/20 22:53:29 gilles -# Added lp_internaldate() -# -# Revision 1.8 2003/10/20 21:49:47 gilles -# wrote sendtestmessage() -# -# 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 -# -# Revision 1.5 2003/08/24 01:05:35 gilles -# Removed some variables -# -# Revision 1.4 2003/08/21 15:40:32 gilles -# Added a email in loulplume test -# -# Revision 1.3 2003/05/05 22:32:01 gilles -# Added pl_folder() test -# -# Revision 1.2 2003/05/05 21:05:49 gilles -# Added lp_folder to test --folder option -# -# Revision 1.1 2003/03/12 23:14:45 gilles -# Initial revision -# - +# $Id: tests.sh,v 1.35 2005/01/17 14:47:49 gilles Exp $ #### Shell pragmas @@ -186,12 +76,31 @@ loulplume() { --host1 loul --user1 tata \ --passfile1 /var/tmp/secret.tata \ --host2 plume --user2 tata@est.belle \ - --passfile2 /var/tmp/secret.tata + --passfile2 /var/tmp/secret.tata \ + --nosyncacls else : fi } +loulloul() { + if test X`hostname` = X"plume"; then + echo3 Here is plume + sendtestmessage + #sleep 10 + ./imapsync \ + --host1 loul --user1 tata \ + --passfile1 /var/tmp/secret.tata \ + --host2 loul --user2 titi \ + --passfile2 /var/tmp/secret.tata \ + --sep2 . + else + : + fi +} + + + plumeloul() { if test X`hostname` = X"plume"; then echo3 Here is plume @@ -658,7 +567,11 @@ regexmess() --host1 loul --user1 tata \ --passfile1 /var/tmp/secret.tata \ --folder INBOX.yop.yap \ - --regexmess 's/\157/O/g' --dry --debug + --regexmess 's/\157/O/g' \ + --regexmess 's/p/Z/g' \ + --dry --debug + + echo 'rm /home/vmail/tata/.yop.yap/cur/*' else : fi