mirror of
https://github.com/imapsync/imapsync.git
synced 2025-08-01 23:01:49 +02:00
1.22
This commit is contained in:
parent
ae427983f8
commit
22c64d279e
5 changed files with 535 additions and 27 deletions
44
imapsync
44
imapsync
|
@ -4,7 +4,7 @@
|
|||
|
||||
imapsync - synchronize mailboxes between two imap servers.
|
||||
|
||||
$Revision: 1.20 $
|
||||
$Revision: 1.22 $
|
||||
|
||||
=head1 INSTALL
|
||||
|
||||
|
@ -137,7 +137,7 @@ both sides. This will help future users.
|
|||
|
||||
Feedback (good or bad) will be always welcome.
|
||||
|
||||
$Id: imapsync,v 1.20 2003/08/21 16:31:53 gilles Exp $
|
||||
$Id: imapsync,v 1.22 2003/08/22 17:17:18 gilles Exp $
|
||||
|
||||
=cut
|
||||
|
||||
|
@ -160,12 +160,12 @@ my(
|
|||
use vars qw ($opt_G); # missing code for this will be option.
|
||||
|
||||
|
||||
$rcs = ' $Id: imapsync,v 1.20 2003/08/21 16:31:53 gilles Exp $ ';
|
||||
$rcs = ' $Id: imapsync,v 1.22 2003/08/22 17:17:18 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";
|
||||
my $banner = '$RCSfile: imapsync,v $ ' . '$Revision: 1.22 $ ' . '$Date: 2003/08/22 17:17:18 $ ' . "\n";
|
||||
|
||||
|
||||
get_options();
|
||||
|
@ -217,35 +217,34 @@ $to = Mail::IMAPClient->new( Server => $host2,
|
|||
)
|
||||
or die "can't open imap connection on [$host2] with user [$user2]\n";
|
||||
|
||||
my @f_folders;
|
||||
# @f_folders = (scalar(@folder)) ? @folder : @{$from->folders()};
|
||||
my (@f_folders, @t_folders);
|
||||
@f_folders = (scalar(@folder)) ? @folder : @{$from->folders()};
|
||||
|
||||
# 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];
|
||||
|
||||
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()};
|
||||
}
|
||||
#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";
|
||||
@t_folders = @{$to->folders()};
|
||||
print
|
||||
"From folders : ", map("[$_] ",@f_folders),"\n",
|
||||
"To folders : ", map("[$_] ",@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 {
|
||||
$t_fold = $f_fold;
|
||||
# }
|
||||
$t_fold = $f_fold;
|
||||
$t_fold =~ s@\$f_sep@\$t_sep@g;
|
||||
print "To Folder [$t_fold]\n";
|
||||
unless ($from->select($f_fold)) {
|
||||
|
@ -255,7 +254,8 @@ FOLDER: foreach my $f_fold (@f_folders) {
|
|||
$error++;
|
||||
next FOLDER;
|
||||
}
|
||||
unless ($to->exists($t_fold)) {
|
||||
|
||||
unless ($to->exists($t_fold) or $to->select($t_fold)) {
|
||||
print "To Folder $t_fold does not exist\n";
|
||||
print "Creating folder [$t_fold]\n";
|
||||
unless ($dry){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue