diff --git a/ChangeLog b/ChangeLog index 7b19f93..a870dc9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,17 +1,29 @@ RCS file: RCS/imapsync,v Working file: imapsync -head: 1.7 +head: 1.10 branch: locks: strict - gilles: 1.7 access list: symbolic names: keyword substitution: kv -total revisions: 7; selected revisions: 7 +total revisions: 10; selected revisions: 10 description: ---------------------------- -revision 1.7 locked by: gilles; +revision 1.10 +date: 2003/05/05 22:37:48; author: gilles; state: Exp; lines: +5 -5 +Updated --folder documentation. +---------------------------- +revision 1.9 +date: 2003/05/05 22:33:50; author: gilles; state: Exp; lines: +8 -7 +Commented INBOX prefix addition (cyrus "buggy" namespace) +---------------------------- +revision 1.8 +date: 2003/05/05 21:05:14; author: gilles; state: Exp; lines: +20 -4 +When folders are given with the --folder option then nested are +also taken into account. +---------------------------- +revision 1.7 date: 2003/03/15 03:40:54; author: gilles; state: Exp; lines: +19 -9 Added documentation. ---------------------------- diff --git a/INSTALL b/INSTALL index 8706dad..0de8ee6 100644 --- a/INSTALL +++ b/INSTALL @@ -1,4 +1,4 @@ -# $Id: INSTALL,v 1.2 2003/03/15 03:41:31 gilles Exp gilles $ +# $Id: INSTALL,v 1.4 2003/05/05 22:42:51 gilles Exp $ # # INSTALL file for ftpsync @@ -19,6 +19,18 @@ You need : try : perl -mMail::IMAPClient -e '' +INSTALLING +---------- +To see what will be done, just run: + +make -n install + +To install imapsync, just run: + +make install + +or copy the file imapsync where you want it to be. + TESTING ------- @@ -32,14 +44,7 @@ sh tests.sh The tests.sh script break on first failure ("set -e" directive). -INSTALLING ----------- -To see what will be done, just run: +Since I added more tests you also need a remote imap server see the +file tests.sh and help yourself. No time to make a universal test +file. -make -n install - -To install imapsync, just run: - -make install - -or copy the file imapsync where you want it to be. diff --git a/Makefile b/Makefile index 87737a4..06a1956 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -# $Id: Makefile,v 1.2 2003/03/14 02:25:27 gilles Exp gilles $ +# $Id: Makefile,v 1.3 2003/05/05 22:55:25 gilles Exp $ TARGET=imapsync @@ -90,3 +90,4 @@ lfo: dist /home/gilles/public_html/www.linux-france.org/html/prj/$(TARGET)/ sh ~/memo/lfo-rsync + diff --git a/README b/README index e7ad791..d1d8453 100644 --- a/README +++ b/README @@ -1,7 +1,7 @@ NAME imapsync - synchronize mailboxes between two imap servers. - $Revision: 1.7 $ + $Revision: 1.10 $ INSTALL Get imapsync at http://www.linux-france.org/prj/imapsync/dist/ @@ -98,5 +98,5 @@ BUGS SIMILAR SOFTWARES None known. Feedback will be welcome. - $Id: imapsync,v 1.7 2003/03/15 03:40:54 gilles Exp gilles $ + $Id: imapsync,v 1.10 2003/05/05 22:37:48 gilles Exp $ diff --git a/TODO b/TODO new file mode 100644 index 0000000..6717c48 --- /dev/null +++ b/TODO @@ -0,0 +1,9 @@ + +Add SASL support MD5 : DIGEST-MD5 and CRAM-MD5 +see authenticate in IMAPClient.pm + +Tested on +> The source imap server runs Cyrus imapd 1.6.22, +> the destination one Cyrus imapd 2.1.12. +by Per Steinar Iversen + diff --git a/VERSION b/VERSION index d3bdbdf..c044b1a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.7 +1.10 diff --git a/imapsync b/imapsync index 1604881..505b254 100755 --- a/imapsync +++ b/imapsync @@ -4,7 +4,7 @@ imapsync - synchronize mailboxes between two imap servers. -$Revision: 1.7 $ +$Revision: 1.10 $ =head1 INSTALL @@ -120,7 +120,7 @@ Report any bugs to the author: lamiral@linux-france.org None known. Feedback will be welcome. -$Id: imapsync,v 1.7 2003/03/15 03:40:54 gilles Exp gilles $ +$Id: imapsync,v 1.10 2003/05/05 22:37:48 gilles Exp $ =cut @@ -145,7 +145,7 @@ my( use vars qw ($opt_G); # missing code for this will be option. -$rcs = ' $Id: imapsync,v 1.7 2003/03/15 03:40:54 gilles Exp gilles $ '; +$rcs = ' $Id: imapsync,v 1.10 2003/05/05 22:37:48 gilles Exp $ '; $rcs =~ m/,v (\d+\.\d+)/; $VERSION = ($1) ? $1 : "UNKNOWN"; $error=0; @@ -193,18 +193,35 @@ $to = Mail::IMAPClient->new( Server => $host2, Debug => 0,) or die "can't open imap connection on [$host2] with user [$user2]\n"; -my @f_folders = (scalar(@folder)) ? @folder : @{$from->folders()}; +my @f_folders; +# @f_folders = (scalar(@folder)) ? @folder : @{$from->folders()}; + + +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()}; +} + + +print "From folders : @f_folders\n"; +#exit; FOLDER: foreach my $f_fold (@f_folders) { my $t_fold; print "From Folder $f_fold\n"; - unless ($f_fold =~ m/^INBOX/) { - $t_fold = "INBOX." . $f_fold; - }else { +# unless ($f_fold =~ m/^INBOX/) { +# $t_fold = "INBOX." . $f_fold; +# }else { $t_fold = $f_fold; - } +# } $t_fold =~ s@\\@\.@g; $t_fold =~ s@\/@\.@g; + print "To Folder $t_fold\n"; unless ($from->select($f_fold)) { warn "From Folder $f_fold : Could not select ", @@ -427,8 +444,8 @@ Several options are mandatory. --user2 : user to login. Mandatory. --password2 : password for the user2. Dangerous, use --passfile2 --passfile2 : password file for the user2. Contains the password. ---folder : sync only this folder ---folder : and this one. +--folder : sync only this folder and its children. +--folder : and this one (and its children). --folder : and this one, etc. --delete : delete messages in "from" imap server after a successful transfert. useful in case you diff --git a/memo b/memo deleted file mode 100644 index 7774ac1..0000000 --- a/memo +++ /dev/null @@ -1,3 +0,0 @@ - -perl -mMail::IMAPClient -e '' - diff --git a/tests.sh b/tests.sh index 1223de9..8bd89bc 100644 --- a/tests.sh +++ b/tests.sh @@ -1,8 +1,14 @@ #!/bin/sh -# $Id: tests.sh,v 1.1 2003/03/12 23:14:45 gilles Exp gilles $ +# $Id: tests.sh,v 1.3 2003/05/05 22:32:01 gilles Exp $ # $Log: tests.sh,v $ +# 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 # @@ -10,9 +16,9 @@ #### Shell pragmas -exec 3>&2 -#set -x # debug mode. See what is running -set -e # exit on first failure +exec 3>&2 # +#set -x # debug mode. See what is running +set -e # exit on first failure #### functions definitions @@ -100,6 +106,29 @@ plumeloul() { fi } +lp_folder() { + 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.yop \ + --host1 loul --user1 tata --passfile1 /var/tmp/secret.tata + else + : + fi +} + +pl_folder() { + if test X`hostname` = X"plume"; then + echo3 Here is plume + ./imapsync \ + --host1 plume --user1 tata@est.belle --passfile1 /var/tmp/secret.tata \ + --folder INBOX.yop \ + --host2 loul --user2 tata --passfile2 /var/tmp/secret.tata + else + : + fi +} # mandatory tests @@ -112,7 +141,9 @@ test $# -eq 0 && run_tests \ no_args \ first_sync \ loulplume \ - plumeloul + plumeloul \ + lp_folder \ + pl_folder # selective tests