From 42be369d9614d5c63add2efe376c21a36f82a990 Mon Sep 17 00:00:00 2001 From: Nick Bebout Date: Sat, 12 Mar 2011 02:43:48 +0000 Subject: [PATCH] 1.43 --- ChangeLog | 10 ++++++++-- README | 6 ++++-- TODO | 10 +++++++--- VERSION | 2 +- imapsync | 43 +++++++++++++++++++++++++++++++++++-------- 5 files changed, 55 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index b79d642..b58b1b4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,15 +1,21 @@ RCS file: RCS/imapsync,v Working file: imapsync -head: 1.42 +head: 1.43 branch: locks: strict access list: symbolic names: keyword substitution: kv -total revisions: 42; selected revisions: 42 +total revisions: 43; selected revisions: 43 description: ---------------------------- +revision 1.43 +date: 2003/11/11 02:18:45; author: gilles; state: Exp; lines: +35 -8 +Added --sep1 and --sep2 options in case NAMESPACE can not be +used +Wrote get_separator() function. +---------------------------- revision 1.42 date: 2003/10/20 22:56:57; author: gilles; state: Exp; lines: +27 -16 Added --syncinternaldates option diff --git a/README b/README index dcf5978..820cadc 100644 --- a/README +++ b/README @@ -1,7 +1,7 @@ NAME imapsync - synchronize mailboxes between two imap servers. - $Revision: 1.42 $ + $Revision: 1.43 $ INSTALL Get imapsync at http://www.linux-france.org/prj/imapsync/dist/ @@ -21,6 +21,8 @@ SYNOPSIS [--user2 ] [--passfile2 ] [--folder --folder ...] [--prefix2 ] + [--sep1 ] + [--sep2 ] [--syncinternaldate] [--delete] [--expunge] [--dry] @@ -134,5 +136,5 @@ SIMILAR SOFTWARES Feedback (good or bad) will be always welcome. - $Id: imapsync,v 1.42 2003/10/20 22:56:57 gilles Exp $ + $Id: imapsync,v 1.43 2003/11/11 02:18:45 gilles Exp $ diff --git a/TODO b/TODO index 7493225..2f69ef3 100644 --- a/TODO +++ b/TODO @@ -9,11 +9,15 @@ Update the list of tested IMAP servers (successes and failures). Add a CREDITS file. -Pb with namespace INBOX. +Pb if "to separator" is in "from folder" name. +Have to choose a caracter != to separator and +not in from folders. + +DONE. Pb with namespace INBOX. http://www.inter7.com/courierimap/FAQ.html#namespace http://www.rfc-editor.org/rfc/rfc2342.txt -Pb with date +DONE. Pb with date -Pb with \Recent flag +DONE. Pb with \Recent flag diff --git a/VERSION b/VERSION index 1a6bf91..d9d7ef5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.42 +1.43 diff --git a/imapsync b/imapsync index 15c8472..bcf2105 100755 --- a/imapsync +++ b/imapsync @@ -4,7 +4,7 @@ imapsync - synchronize mailboxes between two imap servers. -$Revision: 1.42 $ +$Revision: 1.43 $ =head1 INSTALL @@ -26,6 +26,8 @@ $Revision: 1.42 $ [--user2 ] [--passfile2 ] [--folder --folder ...] [--prefix2 ] + [--sep1 ] + [--sep2 ] [--syncinternaldate] [--delete] [--expunge] [--dry] @@ -155,7 +157,7 @@ Rate imapsync : http://freshmeat.net/projects/imapsync/ Feedback (good or bad) will be always welcome. -$Id: imapsync,v 1.42 2003/10/20 22:56:57 gilles Exp $ +$Id: imapsync,v 1.43 2003/11/11 02:18:45 gilles Exp $ =cut @@ -170,7 +172,8 @@ my( $rcs, $debug, $debugimap, $error, $host1, $host2, $port1, $port2, $user1, $user2, $password1, $password2, $passfile1, $passfile2, - @folder, $prefix2, + @folder, $prefix2, + $sep1, $sep2, $syncinternaldates, $delete, $expunge, $dry, $version, $VERSION, $help, @@ -179,12 +182,12 @@ my( use vars qw ($opt_G); # missing code for this will be option. -$rcs = ' $Id: imapsync,v 1.42 2003/10/20 22:56:57 gilles Exp $ '; +$rcs = ' $Id: imapsync,v 1.43 2003/11/11 02:18:45 gilles Exp $ '; $rcs =~ m/,v (\d+\.\d+)/; $VERSION = ($1) ? $1 : "UNKNOWN"; $error=0; -my $banner = '$RCSfile: imapsync,v $ ' . '$Revision: 1.42 $ ' . '$Date: 2003/10/20 22:56:57 $ ' . "\n"; +my $banner = '$RCSfile: imapsync,v $ ' . '$Revision: 1.43 $ ' . '$Date: 2003/11/11 02:18:45 $ ' . "\n"; get_options(); @@ -247,9 +250,29 @@ print "To capability : ", join(" ", $to->capability()), "\n"; my (@f_folders, @t_folders); @f_folders = (scalar(@folder)) ? @folder : @{$from->folders()}; +my($f_sep,$t_sep); # what are the private folders separators for each server ? -my $f_sep = $from->namespace()->[0][0][1]; -my $t_sep = $to->namespace()->[0][0][1]; + +$f_sep = get_separator($from, $sep1, "--sep1"); +$t_sep = get_separator($from, $sep2, "--sep2"); + +sub get_separator { + my($imap, $sep_in, $sep_opt) = @_; + my($sep_out); + if ($imap->has_capability("namespace")) { + $sep_out = $imap->namespace()->[0][0][1]; + }elsif ($sep_in) { + $sep_out = $sep_in; + }else{ + print + "No NAMESPACE capability in imap server ", + $from->Server(),"\n", + "Give the separator caracter with the $sep_opt option\n"; + exit(1); + } + return($sep_out); +} + print "From separator : [$f_sep]\n"; print "To separator : [$t_sep]\n"; @@ -440,6 +463,8 @@ sub get_options "password2=s" => \$password2, "passfile1=s" => \$passfile1, "passfile2=s" => \$passfile2, + "sep1=s" => \$sep1, + "sep2=s" => \$sep2, "folder=s" => \@folder, "prefix2=s" => \$prefix2, "delete!" => \$delete, @@ -517,8 +542,10 @@ Several options are mandatory. --folder : sync only this folder and its children. --folder : and this one (and its children). --folder : and this one, etc. ---prefix2 : Add prefix to all destination folders +--prefix2 : add prefix to all destination folders (usually INBOX. for cyrus imap servers) +--sep1 : separator in case namespace is not supported. +--sep2 : idem. --delete : delete messages in "from" imap server after a successful transfert. useful in case you want to migrate from one server to another one.