diff --git a/ChangeLog b/ChangeLog index 9fed158..f57a1fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,15 +1,38 @@ RCS file: RCS/imapsync,v Working file: imapsync -head: 1.15 +head: 1.20 branch: locks: strict access list: symbolic names: keyword substitution: kv -total revisions: 15; selected revisions: 15 +total revisions: 20; selected revisions: 20 description: ---------------------------- +revision 1.20 +date: 2003/08/21 16:31:53; author: gilles; state: Exp; lines: +6 -5 +Fixed banner output. Must be after getoptions because of --version +---------------------------- +revision 1.19 +date: 2003/08/21 16:18:32; author: gilles; state: Exp; lines: +11 -8 +Added code and comment to understand why message uid was not printed + Solution : some imap server don't have UIDPLIS Capability +---------------------------- +revision 1.18 +date: 2003/08/21 14:37:45; author: gilles; state: Exp; lines: +5 -5 +Removed unuseful param in $from->folders call +---------------------------- +revision 1.17 +date: 2003/08/21 13:49:05; author: gilles; state: Exp; lines: +5 -4 +Fixed banner +---------------------------- +revision 1.16 +date: 2003/08/21 13:47:14; author: gilles; state: Exp; lines: +12 -11 +Added imapxfer url, thanks to Daniele Frijia. +Added [] to see blank caracter in folder names. +Added a banner with imapsync version. +---------------------------- revision 1.15 date: 2003/07/17 12:22:23; author: gilles; state: Exp; lines: +4 -4 Added imap debug mode to server2 diff --git a/README b/README index bf7ea85..1e7b1ed 100644 --- a/README +++ b/README @@ -1,7 +1,7 @@ NAME imapsync - synchronize mailboxes between two imap servers. - $Revision: 1.15 $ + $Revision: 1.20 $ INSTALL Get imapsync at http://www.linux-france.org/prj/imapsync/dist/ @@ -110,9 +110,10 @@ IMAP SERVERS SIMILAR SOFTWARES offlineimap : http://gopher.quux.org:70/devel/offlineimap/ mailsync : http://mailsync.sourceforge.net/ - imapxfer : ? + imapxfer : http://www.washington.edu/imap/ + part of the imap-utils from UW. - Feedback will be welcome. + Feedback (good or bad) will be always welcome. - $Id: imapsync,v 1.15 2003/07/17 12:22:23 gilles Exp $ + $Id: imapsync,v 1.20 2003/08/21 16:31:53 gilles Exp $ diff --git a/VERSION b/VERSION index d40acaa..5fb5a6b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.15 +1.20 diff --git a/imapsync b/imapsync index bf03814..41acc6b 100755 --- a/imapsync +++ b/imapsync @@ -4,7 +4,7 @@ imapsync - synchronize mailboxes between two imap servers. -$Revision: 1.15 $ +$Revision: 1.20 $ =head1 INSTALL @@ -132,11 +132,12 @@ both sides. This will help future users. offlineimap : http://gopher.quux.org:70/devel/offlineimap/ mailsync : http://mailsync.sourceforge.net/ - imapxfer : ? + imapxfer : http://www.washington.edu/imap/ + part of the imap-utils from UW. -Feedback will be welcome. +Feedback (good or bad) will be always welcome. -$Id: imapsync,v 1.15 2003/07/17 12:22:23 gilles Exp $ +$Id: imapsync,v 1.20 2003/08/21 16:31:53 gilles Exp $ =cut @@ -147,7 +148,6 @@ use Getopt::Long; use Mail::IMAPClient; use Digest::MD5 qw(md5_base64); - my( $rcs, $debug, $debugimap, $error, $host1, $host2, $port1, $port2, @@ -155,18 +155,21 @@ my( @folder, $delete, $expunge, $dry, $version, $VERSION, $help, - ); use vars qw ($opt_G); # missing code for this will be option. -$rcs = ' $Id: imapsync,v 1.15 2003/07/17 12:22:23 gilles Exp $ '; +$rcs = ' $Id: imapsync,v 1.20 2003/08/21 16:31:53 gilles Exp $ '; $rcs =~ m/,v (\d+\.\d+)/; $VERSION = ($1) ? $1 : "UNKNOWN"; $error=0; +my $banner = '$RCSfile: imapsync,v $ ' . '$Revision: 1.20 $ ' . '$Date: 2003/08/21 16:31:53 $ ' . "\n"; + + get_options(); +print $banner; sub missing_option { my ($option) = @_; @@ -224,7 +227,7 @@ my $t_sep = $to->namespace()->[0][0][1]; if (scalar(@folder)) { # folders are given as argument. foreach my $f_fold (@folder) { - push (@f_folders, @{$from->folders("$f_fold", ".")}); + push (@f_folders, @{$from->folders($f_fold)}); } }else{ # no folder given so select all @@ -237,14 +240,14 @@ print "From folders : @f_folders\n"; FOLDER: foreach my $f_fold (@f_folders) { my $t_fold; - print "From Folder $f_fold\n"; + print "From Folder [$f_fold]\n"; # unless ($f_fold =~ m/^INBOX/) { # $t_fold = "INBOX." . $f_fold; # }else { $t_fold = $f_fold; # } $t_fold =~ s@\$f_sep@\$t_sep@g; - print "To Folder $t_fold\n"; + print "To Folder [$t_fold]\n"; unless ($from->select($f_fold)) { warn "From Folder $f_fold : Could not select ", @@ -254,10 +257,10 @@ FOLDER: foreach my $f_fold (@f_folders) { } unless ($to->exists($t_fold)) { print "To Folder $t_fold does not exist\n"; - print "Creating folder $t_fold\n"; + print "Creating folder [$t_fold]\n"; unless ($dry){ unless ($to->create($t_fold)){ - warn "Couldn't create $t_fold ", + warn "Couldn't create [$t_fold]", $to->LastError,"\n"; $error++; next FOLDER; @@ -344,7 +347,7 @@ sub header_parse { my $f_msg = $f_hash{$m_id}{'m'}; $debug and print "key $m_id #$f_msg\n"; unless (exists($t_hash{$m_id})) { - print "Message NO msg #$f_msg $m_id in $t_fold\n"; + print "Message NO msg #$f_msg [$m_id] in $t_fold\n"; # copy print "Copying msg #$f_msg:$f_size to folder $t_fold\n"; unless ($dry) { @@ -357,8 +360,11 @@ sub header_parse { $error++; next MESS; }else{ - # good - print "Copied msg #$f_msg to folder $t_fold msg #$new_id\n"; + # good + # $new_id is an id if the IMAP server has the + # UIDPLUS capability else just a ref + + print "Copied msg id [$f_msg] to folder $t_fold msg id [$new_id]\n"; $to->store($new_id, "+FLAGS (" . join(" ", @{$from->flags($f_msg)} @@ -367,7 +373,7 @@ sub header_parse { } next MESS; }else{ - $debug and print "Message $m_id found in t:$t_fold\n"; + $debug and print "Message id [$m_id] found in t:$t_fold\n"; } #$debug and print "MESSAGE $m_id\n"; my $t_size = $t_hash{$m_id}{'s'}; diff --git a/tests.sh b/tests.sh index 8bd89bc..88d9324 100644 --- a/tests.sh +++ b/tests.sh @@ -1,8 +1,11 @@ #!/bin/sh -# $Id: tests.sh,v 1.3 2003/05/05 22:32:01 gilles Exp $ +# $Id: tests.sh,v 1.4 2003/08/21 15:40:32 gilles Exp $ # $Log: tests.sh,v $ +# 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 # @@ -87,6 +90,12 @@ first_sync() { loulplume() { if test X`hostname` = X"plume"; then echo3 Here is plume + rand=`pwgen 16 1` + mess='test:'$rand + cmd="echo $mess""| mail -s ""$mess"" tata" + echo $cmd + ssh gilles@loul $cmd + sleep 10 ./imapsync \ --host1 loul --user1 tata --passfile1 /var/tmp/secret.tata \ --host2 plume --user2 tata@est.belle --passfile2 /var/tmp/secret.tata @@ -111,7 +120,7 @@ lp_folder() { echo3 Here is plume ./imapsync \ --host2 plume --user2 tata@est.belle --passfile2 /var/tmp/secret.tata \ - --folder INBOX.yop \ + --folder INBOX.yop --folder INBOX.Trash \ --host1 loul --user1 tata --passfile1 /var/tmp/secret.tata else :