From 068b792ce613e6a5c61897cb51a6964c63b450cb Mon Sep 17 00:00:00 2001 From: Nick Bebout Date: Sat, 12 Mar 2011 02:44:30 +0000 Subject: [PATCH] 1.197 --- CREDITS | 4 ++++ ChangeLog | 15 +++++++++++++-- README | 4 ++-- VERSION | 2 +- imapsync | 47 +++++++++++++++++++++++++---------------------- tests.sh | 20 +++++++++++++++++++- 6 files changed, 64 insertions(+), 28 deletions(-) diff --git a/CREDITS b/CREDITS index 8f510f3..fe571a2 100644 --- a/CREDITS +++ b/CREDITS @@ -7,6 +7,10 @@ http://www.amazon.com/gp/registry/wishlist/1C9UNDIH3P7R7/ I thank very much all of these people. +Jalal +Found --include and --include unuseful +Wrote --include or --include patch + Daniel Ammann Made me finally write the --folderrec option. Gave OpenMail to Cyrus success diff --git a/ChangeLog b/ChangeLog index 6623df7..61a34bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,15 +1,26 @@ RCS file: RCS/imapsync,v Working file: imapsync -head: 1.195 +head: 1.197 branch: locks: strict access list: symbolic names: keyword substitution: kv -total revisions: 195; selected revisions: 195 +total revisions: 197; selected revisions: 197 description: ---------------------------- +revision 1.197 +date: 2006/12/10 02:49:39; author: gilles; state: Exp; lines: +7 -10 +Updated online documantation about new +--include and --exclude behavior +---------------------------- +revision 1.196 +date: 2006/12/10 02:41:37; author: gilles; state: Exp; lines: +21 -15 +- Now IO::Socket::SSL is loaded only with -ssl* +- multiple --include are taken like a "or" list , + not an "and" list. +---------------------------- revision 1.195 date: 2006/12/08 04:48:54; author: gilles; state: Exp; lines: +10 -8 Added OpenMail success diff --git a/README b/README index 7fb77d5..6674063 100644 --- a/README +++ b/README @@ -3,7 +3,7 @@ NAME Synchronise mailboxes between two imap servers. Good at IMAP migration. More than 25 different IMAP server softwares supported with success. - $Revision: 1.195 $ + $Revision: 1.197 $ INSTALL imapsync works fine under any Unix OS. @@ -297,5 +297,5 @@ AUTHOR teaching free open and gratis softwares. Don't hesitate to pay him for that services. - $Id: imapsync,v 1.195 2006/12/08 04:48:54 gilles Exp $ + $Id: imapsync,v 1.197 2006/12/10 02:49:39 gilles Exp $ diff --git a/VERSION b/VERSION index 4c353d4..c568913 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.195 +1.197 diff --git a/imapsync b/imapsync index 1fc0c60..70822c7 100755 --- a/imapsync +++ b/imapsync @@ -7,7 +7,7 @@ tool. Synchronise mailboxes between two imap servers. Good at IMAP migration. More than 25 different IMAP server softwares supported with success. -$Revision: 1.195 $ +$Revision: 1.197 $ =head1 INSTALL @@ -347,7 +347,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.195 2006/12/08 04:48:54 gilles Exp $ +$Id: imapsync,v 1.197 2006/12/10 02:49:39 gilles Exp $ =cut @@ -358,8 +358,7 @@ use Getopt::Long; use Mail::IMAPClient; use Digest::MD5 qw(md5_base64); use Term::ReadKey; -#use Digest::HMAC_MD5; -use IO::Socket::SSL; +#use IO::Socket::SSL; use MIME::Base64; use English; use POSIX qw(uname); @@ -404,7 +403,7 @@ my( use vars qw ($opt_G); # missing code for this will be option. -$rcs = ' $Id: imapsync,v 1.195 2006/12/08 04:48:54 gilles Exp $ '; +$rcs = ' $Id: imapsync,v 1.197 2006/12/10 02:49:39 gilles Exp $ '; $rcs =~ m/,v (\d+\.\d+)/; $VERSION = ($1) ? $1 : "UNKNOWN"; @@ -441,8 +440,8 @@ $error=0; my $banner = join("", '$RCSfile: imapsync,v $ ', - '$Revision: 1.195 $ ', - '$Date: 2006/12/08 04:48:54 $ ', + '$Revision: 1.197 $ ', + '$Date: 2006/12/10 02:49:39 $ ', "\n", "Mail::IMAPClient version used here is ", $VERSION_IMAPClient,"\n" @@ -586,6 +585,7 @@ sub login_imap { $ssl, $authmech, $authuser) = @_; my ($imap); if ($ssl) { + require IO::Socket::SSL; my $socssl = new IO::Socket::SSL("$host:$port"); die "Error connecting to $host:$port: $@\n" unless $socssl; $socssl->autoflush(1); @@ -693,18 +693,24 @@ if (scalar(@folder) or $subscribed or scalar(@folderrec)) { }else { # no folder/subscribed/folderrec options => all folders @f_folders = sort $from->folders(); - # consider (optional) includes and excludes - # WARNING the following two loops are bad with more than one pass. - foreach my $include (@include) { - @f_folders = grep /$include/,@f_folders; - print "Only including folders matching pattern '$include'\n"; - } - foreach my $exclude (@exclude) { - @f_folders = grep !/$exclude/,@f_folders; - print "Excluding folders matching pattern '$exclude'\n"; - } } +# consider (optional) includes and excludes +if (scalar(@include)) { + my @f_folders_inc; + foreach my $include (@include) { + push(@f_folders_inc, grep /$include/, @f_folders); + print "Including folders matching pattern '$include'\n"; + } + @f_folders = sort @f_folders_inc; +} + +foreach my $exclude (@exclude) { + @f_folders = grep !/$exclude/,@f_folders; + print "Excluding folders matching pattern '$exclude'\n"; +} + + @t_folders = sort @{$to->folders()}; my($f_sep,$t_sep); @@ -1428,14 +1434,11 @@ Several options are mandatory. --folderrec : sync only this folder recursively. --folderrec : and this one, etc. --include : only sync folders matching this regular expression - (only effective if neither --folder nor --subscribed - is specified). ---include : and this one, etc. +--include : or this one, etc. in case both --include --exclude options are use, include is done before. --exclude : skips folders matching this regular expression - (only effective if neither --folder nor --subscribed - is specified). Several folders to avoid: + Several folders to avoid: --exclude 'fold1|fold2|f3' skips fold1, fold2 and f3. --exclude : and this one, etc. --prefix1 : remove prefix to all destination folders diff --git a/tests.sh b/tests.sh index f5623ba..b82ea30 100644 --- a/tests.sh +++ b/tests.sh @@ -1,6 +1,6 @@ #!/bin/sh -# $Id: tests.sh,v 1.56 2006/12/08 04:05:01 gilles Exp $ +# $Id: tests.sh,v 1.57 2006/12/10 02:48:14 gilles Exp gilles $ #### Shell pragmas @@ -61,6 +61,8 @@ no_args() { # tata@est.belle # used on locallocal() +# tata titi on most ll_*() tests + # tutu@est.belle # not used # tete@est.belle # used on big size tests @@ -629,6 +631,22 @@ ll_delete2() { fi } +ll_bigmail() { + if test X`hostname` = X"plume"; then + echo3 Here is plume + ./imapsync \ + --host1 localhost --user1 tata@est.belle \ + --passfile1 /var/tmp/secret.tata \ + --host2 localhost --user2 titi@est.belle \ + --passfile2 /var/tmp/secret.titi \ + --folder INBOX.bigmail + else + : + fi +} + + + ########################## # specific tests ##########################