mirror of
https://github.com/imapsync/imapsync.git
synced 2024-11-17 00:02:29 +01:00
1.145
This commit is contained in:
parent
f2bb3aabe8
commit
02b830ba86
5
CREDITS
5
CREDITS
@ -1,5 +1,10 @@
|
||||
#!/bin/cat
|
||||
|
||||
Nicolai Rasmussen
|
||||
Suggested the --minage option and asked
|
||||
a friend of him to code it.
|
||||
I made it compatible with --maxage too.
|
||||
|
||||
Marcos Sungaila
|
||||
Reported the "do not consider namespace" bug
|
||||
once again. And I fixed it. I think.
|
||||
|
11
ChangeLog
11
ChangeLog
@ -1,17 +1,20 @@
|
||||
|
||||
RCS file: RCS/imapsync,v
|
||||
Working file: imapsync
|
||||
head: 1.144
|
||||
head: 1.145
|
||||
branch:
|
||||
locks: strict
|
||||
gilles: 1.144
|
||||
access list:
|
||||
symbolic names:
|
||||
keyword substitution: kv
|
||||
total revisions: 144; selected revisions: 144
|
||||
total revisions: 145; selected revisions: 145
|
||||
description:
|
||||
----------------------------
|
||||
revision 1.144 locked by: gilles;
|
||||
revision 1.145
|
||||
date: 2005/12/04 01:58:54; author: gilles; state: Exp; lines: +54 -12
|
||||
Added --minage option
|
||||
----------------------------
|
||||
revision 1.144
|
||||
date: 2005/11/28 00:32:05; author: gilles; state: Exp; lines: +60 -17
|
||||
Added RFC compliance about NAMESPACE prefixes.
|
||||
Added --prefix1 option.
|
||||
|
7
README
7
README
@ -2,7 +2,7 @@ NAME
|
||||
imapsync - IMAP synchronization, copy or migration tool. Synchronize
|
||||
mailboxes between two imap servers. Good at IMAP migration.
|
||||
|
||||
$Revision: 1.144 $
|
||||
$Revision: 1.145 $
|
||||
|
||||
INSTALL
|
||||
imapsync works fine under any Unix OS.
|
||||
@ -46,6 +46,7 @@ SYNOPSIS
|
||||
[--regexmess <regex>] [--regexmess <regex>]
|
||||
[--maxsize <int>]
|
||||
[--maxage <int>]
|
||||
[--minage <int>]
|
||||
[--skipheader <regex>]
|
||||
[--useheader <string>] [--useheader <string>]
|
||||
[--skipsize]
|
||||
@ -215,7 +216,7 @@ IMAP SERVERS
|
||||
|
||||
HUGE MIGRATION
|
||||
Have a special attention on options --subscribed --subscribe --delete
|
||||
--expunge --expunge1 --expunge2 --maxage --maxsize --useheader
|
||||
--expunge --expunge1 --expunge2 --maxage --minage --maxsize --useheader
|
||||
|
||||
If you have many mailboxes to migrate think about a little shell
|
||||
program. Write a file called file.csv (for example) containing users and
|
||||
@ -262,5 +263,5 @@ AUTHOR
|
||||
teaching free open and gratis softwares. Don't hesitate to pay him for
|
||||
that services.
|
||||
|
||||
$Id: imapsync,v 1.144 2005/11/28 00:32:05 gilles Exp gilles $
|
||||
$Id: imapsync,v 1.145 2005/12/04 01:58:54 gilles Exp $
|
||||
|
||||
|
66
imapsync
66
imapsync
@ -6,7 +6,7 @@ imapsync - IMAP synchronization, copy or migration
|
||||
tool. Synchronize mailboxes between two imap servers. Good
|
||||
at IMAP migration.
|
||||
|
||||
$Revision: 1.144 $
|
||||
$Revision: 1.145 $
|
||||
|
||||
=head1 INSTALL
|
||||
|
||||
@ -52,6 +52,7 @@ $Revision: 1.144 $
|
||||
[--regexmess <regex>] [--regexmess <regex>]
|
||||
[--maxsize <int>]
|
||||
[--maxage <int>]
|
||||
[--minage <int>]
|
||||
[--skipheader <regex>]
|
||||
[--useheader <string>] [--useheader <string>]
|
||||
[--skipsize]
|
||||
@ -250,6 +251,7 @@ Have a special attention on options
|
||||
--expunge1
|
||||
--expunge2
|
||||
--maxage
|
||||
--minage
|
||||
--maxsize
|
||||
--useheader
|
||||
|
||||
@ -306,7 +308,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.144 2005/11/28 00:32:05 gilles Exp gilles $
|
||||
$Id: imapsync,v 1.145 2005/12/04 01:58:54 gilles Exp $
|
||||
|
||||
=cut
|
||||
|
||||
@ -332,7 +334,7 @@ my(
|
||||
$sep1, $sep2,
|
||||
$syncinternaldates, $syncacls,
|
||||
$fastio1, $fastio2,
|
||||
$maxsize, $maxage,
|
||||
$maxsize, $maxage, $minage,
|
||||
$skipheader, @useheader,
|
||||
$skipsize, $foldersizes, $buffersize,
|
||||
$delete, $expunge, $expunge1, $expunge2, $dry,
|
||||
@ -353,7 +355,7 @@ my(
|
||||
use vars qw ($opt_G); # missing code for this will be option.
|
||||
|
||||
|
||||
$rcs = ' $Id: imapsync,v 1.144 2005/11/28 00:32:05 gilles Exp gilles $ ';
|
||||
$rcs = ' $Id: imapsync,v 1.145 2005/12/04 01:58:54 gilles Exp $ ';
|
||||
$rcs =~ m/,v (\d+\.\d+)/;
|
||||
$VERSION = ($1) ? $1 : "UNKNOWN";
|
||||
|
||||
@ -390,8 +392,8 @@ $error=0;
|
||||
|
||||
my $banner = join("",
|
||||
'$RCSfile: imapsync,v $ ',
|
||||
'$Revision: 1.144 $ ',
|
||||
'$Date: 2005/11/28 00:32:05 $ ',
|
||||
'$Revision: 1.145 $ ',
|
||||
'$Date: 2005/12/04 01:58:54 $ ',
|
||||
"\n",
|
||||
"Mail::IMAPClient version used here is ",
|
||||
$VERSION_IMAPClient,"\n"
|
||||
@ -657,12 +659,10 @@ sub foldersizes {
|
||||
$error++;
|
||||
next;
|
||||
}
|
||||
if ($maxage) {
|
||||
if (defined($maxage) or defined($minage)) {
|
||||
# The pb is fetch_hash() can only be applied on ALL messages
|
||||
|
||||
my @msgs = $imap->since(time - 86400 * $maxage);
|
||||
my @msgs = select_msgs($imap);
|
||||
$smess = scalar(@msgs);
|
||||
#print "maxage smess $smess " ;
|
||||
foreach my $m (@msgs) {
|
||||
my $s = $imap->size($m)
|
||||
or warn "Could not find size of message $m: $@\n";
|
||||
@ -817,11 +817,16 @@ FOLDER: foreach my $f_fold (@f_folders) {
|
||||
|
||||
next FOLDER if ($justfolders);
|
||||
|
||||
my @f_msgs = $maxage ? $from->since(time - 86400 * $maxage) : $from->search("ALL");
|
||||
|
||||
my @f_msgs = select_msgs($from);
|
||||
|
||||
|
||||
|
||||
$debug and print "LIST FROM : @f_msgs\n";
|
||||
# internal dates on "TO" are after the ones on "FROM"
|
||||
# normally...
|
||||
my @t_msgs = $maxage ? $to->since(time - 86400 * $maxage) : $to->search("ALL");
|
||||
my @t_msgs = select_msgs($to);
|
||||
|
||||
$debug and print "LIST TO : @t_msgs\n";
|
||||
|
||||
my %f_hash = ();
|
||||
@ -1017,6 +1022,35 @@ stats();
|
||||
|
||||
exit(1) if($error);
|
||||
|
||||
sub select_msgs {
|
||||
my ($imap) = @_;
|
||||
my (@msgs,@max,@min,@union,@inter);
|
||||
|
||||
unless (defined($maxage) or defined($minage)) {
|
||||
@msgs = $imap->search("ALL");
|
||||
return(@msgs);
|
||||
}
|
||||
if (defined($maxage)) {
|
||||
@max = $imap->since(time - 86400 * $maxage);
|
||||
}
|
||||
if (defined($minage)) {
|
||||
@min = $imap->before(time - 86400 * $minage);
|
||||
}
|
||||
SWITCH: {
|
||||
unless(defined($minage)) {@msgs = @max; last SWITCH};
|
||||
unless(defined($maxage)) {@msgs = @min; last SWITCH};
|
||||
my (%union, %inter);
|
||||
foreach my $m (@min, @max) {$union{$m}++ && $inter{$m}++}
|
||||
# normal case
|
||||
if ($minage <= $maxage) {@msgs = @inter; last SWITCH};
|
||||
# just exclude messages between
|
||||
if ($minage > $maxage) {@msgs = @union; last SWITCH};
|
||||
|
||||
}
|
||||
return(@msgs);
|
||||
}
|
||||
|
||||
|
||||
sub stats {
|
||||
print "++++ Statistics ++++\n";
|
||||
print "Time : $timediff sec\n";
|
||||
@ -1063,6 +1097,7 @@ sub get_options
|
||||
"syncacls!" => \$syncacls,
|
||||
"maxsize=i" => \$maxsize,
|
||||
"maxage=i" => \$maxage,
|
||||
"minage=i" => \$minage,
|
||||
"buffersize=i" => \$buffersize,
|
||||
"foldersizes!" => \$foldersizes,
|
||||
"dry!" => \$dry,
|
||||
@ -1221,6 +1256,13 @@ Several options are mandatory.
|
||||
--maxsize <int> : skip messages larger than <int> bytes
|
||||
--maxage <int> : skip messages older than <int> days.
|
||||
final stats (skipped) don't count older messages
|
||||
--minage <int> : skip messages newer than <int> days.
|
||||
final stats (skipped) don't count newer messages
|
||||
You can do (+ are the messages selected):
|
||||
------maxage+++++++++++++++++++|now
|
||||
+++++++++++++++++++minage------|now
|
||||
------maxage+++++++minage------|now intersection
|
||||
++++++minage-------maxage++++++|now union
|
||||
--skipheader <regex> : Don't take into account header keyword
|
||||
matching <string> ex: --skipheader 'X.*'
|
||||
--useheader <string> : Use this header to compare messages on both sides.
|
||||
|
Loading…
Reference in New Issue
Block a user