This commit is contained in:
Nick Bebout 2011-03-12 02:44:26 +00:00
parent e5636b5d0c
commit f79724c166
9 changed files with 124 additions and 23 deletions

View file

@ -6,7 +6,7 @@ imapsync - IMAP synchronization, copy or migration
tool. Synchronize mailboxes between two imap servers. Good
at IMAP migration.
$Revision: 1.172 $
$Revision: 1.175 $
=head1 INSTALL
@ -228,8 +228,10 @@ Success stories reported with the following imap servers
2.2.1, 2.2.2-BETA, 2.2.10, 2.2.12, 2.3-alpha (OSI Approved)
(http://asg.web.cmu.edu/cyrus/)
- DBMail 1.2.1 (GPL) (http://www.dbmail.org/). 2.0.7 seems buggy.
- Dovecot 0.99.10.4 0.99.14 (LGPL) (http://www.dovecot.org/)
- Dovecot 0.99.10.4 0.99.14 0.99.14-8.fc4 (LGPL)
(http://www.dovecot.org/)
- Domino (Notes) 6.5, 5.0.6, 5.0.7
- Eudora WorldMail v2
- Groupwise IMAP (Novell). Buggy so see the FAQ.
- iPlanet Messaging server 4.15, 5.1
- IMail 7.15 (Ipswitch/Win2003), 8.12
@ -240,11 +242,13 @@ Success stories reported with the following imap servers
- OpenWave
- Qualcomm Worldmail (NT)
- Samsung Contact IMAP server 8.5.0
- Scalix v10.1
- SunONE Messaging server 5.2, 6.0 (SUN JES - Java Enterprise System)
- UW-imap servers (imap-2000b) rijkkramer IMAP4rev1 2000.287
(RedHat uses UW like 2003.338rh) (OSI Approved)
(http://www.washington.edu/imap/)
- UW - QMail v2.1
- Imap part of TCP/IP suite of VMS 7.3.2
- Zimbra-IMAP 3.0.1 GA 160, 3.1.0 Build 279.
Please report to the author any success or bad story with
@ -334,7 +338,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.172 2006/05/09 23:06:29 gilles Exp $
$Id: imapsync,v 1.175 2006/06/08 00:52:00 gilles Exp $
=cut
@ -360,7 +364,7 @@ my(
$user1, $user2, $password1, $password2, $passfile1, $passfile2,
@folder, @include, @exclude,
$prefix1, $prefix2,
@regextrans2, @regexmess,
@regextrans2, @regexmess, @regexflag,
$sep1, $sep2,
$syncinternaldates, $syncacls,
$fastio1, $fastio2,
@ -391,7 +395,7 @@ my(
use vars qw ($opt_G); # missing code for this will be option.
$rcs = ' $Id: imapsync,v 1.172 2006/05/09 23:06:29 gilles Exp $ ';
$rcs = ' $Id: imapsync,v 1.175 2006/06/08 00:52:00 gilles Exp $ ';
$rcs =~ m/,v (\d+\.\d+)/;
$VERSION = ($1) ? $1 : "UNKNOWN";
@ -428,8 +432,8 @@ $error=0;
my $banner = join("",
'$RCSfile: imapsync,v $ ',
'$Revision: 1.172 $ ',
'$Date: 2006/05/09 23:06:29 $ ',
'$Revision: 1.175 $ ',
'$Date: 2006/06/08 00:52:00 $ ',
"\n",
"Mail::IMAPClient version used here is ",
$VERSION_IMAPClient,"\n"
@ -863,6 +867,15 @@ sub to_folder_name {
return($t_fold);
}
sub flags_regex {
my ($flags_f) = @_;
foreach my $regexflag (@regexflag) {
$debug and print "eval \$flags_f =~ $regexflag\n";
eval("\$flags_f =~ $regexflag");
}
return($flags_f);
}
sub acls_sync {
my($f_fold, $t_fold) = @_;
if ($syncacls) {
@ -1036,6 +1049,7 @@ FOLDER: foreach my $f_fold (@f_folders) {
my $flags_f = $f_hash{$m_id}{'F'} || "";
# RFC 2060 : This flag can not be altered by the client
$flags_f =~ s@\\Recent@@g;
$flags_f = flags_regex($flags_f) if @regexflag;
my $new_id;
print "flags from : [$flags_f][$d]\n";
@ -1075,16 +1089,21 @@ FOLDER: foreach my $f_fold (@f_folders) {
@flags_f = @{$flags_f_rv} if ref($flags_f_rv);
# No flag \Recent here, no ?
my $flags_f = join(" ", @flags_f);
$flags_f = flags_regex($flags_f) if @regexflag;
# This add or change flags but no flag are removed with this
$to->store($t_msg,
"+FLAGS (" . join(" ", @flags_f) . ")"
"+FLAGS (" . $flags_f . ")"
) unless ($dry) ;
my $flags_t_rv = $to->flags($t_msg);
@flags_t = @{$flags_t_rv} if ref($flags_t_rv);
my $flags_t = join(" ", @flags_t);
$debug and print
"flags from : @flags_f\n",
"flags to : @flags_t\n";
"flags from : $flags_f\n",
"flags to : $flags_t\n";
$debug and do {
@ -1217,6 +1236,7 @@ sub get_options
"prefix2=s" => \$prefix2,
"regextrans2=s" => \@regextrans2,
"regexmess=s" => \@regexmess,
"regexflag=s" => \@regexflag,
"delete!" => \$delete,
"delete2!" => \$delete2,
"syncinternaldates!" => \$syncinternaldates,
@ -1387,6 +1407,9 @@ Several options are mandatory.
Exemple : 's/\\000/ /g' # to replace null by space.
--regexmess <regex> : and this one.
--regexmess <regex> : and this one, etc.
--regexflag <regex> : Apply the whole regex to each flags list.
Exemple : 's/\"Junk"//g' # to remove "Junk" flag.
--regexflag <regex> : and this one, etc.
--sep1 <string> : separator in case namespace is not supported.
--sep2 <string> : idem.
--delete : delete messages on source imap server after