mirror of
https://github.com/imapsync/imapsync.git
synced 2024-11-17 00:02:29 +01:00
1.260
This commit is contained in:
parent
1f4db27b3d
commit
f854c1ea0a
85
CREDITS
85
CREDITS
@ -1,4 +1,5 @@
|
||||
#!/bin/cat
|
||||
# $Id: CREDITS,v 1.114 2008/08/13 23:34:05 gilles Exp gilles $
|
||||
|
||||
I thank very much all of these people.
|
||||
|
||||
@ -10,10 +11,42 @@ a) you can use the imapsync wishlist :
|
||||
|
||||
b) If you can read french, please use the following wishlist :
|
||||
http://amazon.fr/gp/registry/wishlist/37RZF7PPCD7YL
|
||||
(free postal cost)
|
||||
(books will be send with free postal cost)
|
||||
|
||||
c) its paypal account gilles.lamiral@laposte.net
|
||||
|
||||
Here are the people I thanks, and why :
|
||||
|
||||
Ploc
|
||||
Made me write the option --idatefromheader
|
||||
|
||||
Pierre-Emmanuel André
|
||||
Success from dovecot 1.0.0 to Archiveopteryx 2.10
|
||||
|
||||
Kevin Harriss
|
||||
Pushed me to find (documentation and source) and solve
|
||||
the authuser method with uw-imap. FAQ entry.
|
||||
|
||||
Scott Pedigo
|
||||
Contributed by giving the book
|
||||
"Smart and Gets Things Done"
|
||||
|
||||
|
||||
Don Jackson
|
||||
Contributed by giving the book
|
||||
"The Back of the Napkin"
|
||||
|
||||
Joschua Penix
|
||||
Contributed by giving the book
|
||||
"Programming Collective Intelligence"
|
||||
|
||||
Bertram N Shure
|
||||
Contributed by giving the book
|
||||
"Hackers and Painters".
|
||||
|
||||
Simon Heimlicher
|
||||
Gave a patch to avoid non-selectable folders.
|
||||
|
||||
Stéphane Besnard
|
||||
Success from Serveur Domino IMAP4 Edition France 4.61 Code
|
||||
to Cyrus IMAP4 v2.3.7 server ready
|
||||
@ -564,3 +597,53 @@ Suggested --subscribed option.
|
||||
Eric Yung
|
||||
(Suggested --sep1 option) and tested it, and found a bug about it.
|
||||
|
||||
Total amount of book prices :
|
||||
c \
|
||||
16.47+\
|
||||
26.39+\
|
||||
29.95+\
|
||||
33.95+\
|
||||
15.61+\
|
||||
11.55+\
|
||||
16.49+\
|
||||
16.49+\
|
||||
22.00+\
|
||||
26.39+\
|
||||
26.39+\
|
||||
19.77+\
|
||||
23.60+\
|
||||
19.77+\
|
||||
51.70+\
|
||||
19.79+\
|
||||
58.38+\
|
||||
13.57+\
|
||||
32.70+\
|
||||
29.00+\
|
||||
19.00+\
|
||||
26.37+\
|
||||
38.60+\
|
||||
16.49+\
|
||||
39.10+\
|
||||
28.00+\
|
||||
40.00+\
|
||||
18.21+\
|
||||
24.95+\
|
||||
31.49+\
|
||||
64.50+\
|
||||
32.70+\
|
||||
50.40+\
|
||||
22.49+\
|
||||
18.21+\
|
||||
29.70+\
|
||||
15.96+\
|
||||
13.57+\
|
||||
15.61+\
|
||||
11.86+\
|
||||
14.95+\
|
||||
12.21+\
|
||||
27.50+\
|
||||
59.99+\
|
||||
31.20+\
|
||||
40.00
|
||||
|
||||
=1253.02
|
||||
|
37
ChangeLog
37
ChangeLog
@ -1,17 +1,46 @@
|
||||
|
||||
RCS file: RCS/imapsync,v
|
||||
Working file: imapsync
|
||||
head: 1.255
|
||||
head: 1.260
|
||||
branch:
|
||||
locks: strict
|
||||
gilles: 1.255
|
||||
gilles: 1.260
|
||||
access list:
|
||||
symbolic names:
|
||||
keyword substitution: kv
|
||||
total revisions: 255; selected revisions: 255
|
||||
total revisions: 260; selected revisions: 260
|
||||
description:
|
||||
----------------------------
|
||||
revision 1.255 locked by: gilles;
|
||||
revision 1.260 locked by: gilles;
|
||||
date: 2008/08/13 03:14:14; author: gilles; state: Exp; lines: +54 -13
|
||||
- Added option --idatefromheader :
|
||||
sets the internal dates on host2 same as the "Date:" headers.
|
||||
----------------------------
|
||||
revision 1.259
|
||||
date: 2008/08/13 01:22:10; author: gilles; state: Exp; lines: +49 -21
|
||||
- Made a function for regexmess() --regexmess to be able to
|
||||
check it easily
|
||||
- Added function tests_regexmess() to check regexmess(), 3
|
||||
tests.
|
||||
- Removed imapsync copyleft GPL licence output (boring).
|
||||
Replaced by wishlist link.
|
||||
- Added thank_author() to avoid duplicate code about thanks.
|
||||
- Better bug report documentation.
|
||||
----------------------------
|
||||
revision 1.258
|
||||
date: 2008/07/28 21:38:36; author: gilles; state: Exp; lines: +18 -18
|
||||
Change report bug information order.
|
||||
----------------------------
|
||||
revision 1.257
|
||||
date: 2008/07/28 21:17:56; author: gilles; state: Exp; lines: +10 -19
|
||||
removed comment and ugly output
|
||||
----------------------------
|
||||
revision 1.256
|
||||
date: 2008/06/29 01:28:51; author: gilles; state: Exp; lines: +14 -5
|
||||
Applied patch from Simon Heimlicher to avoid non-selectable
|
||||
folders.
|
||||
----------------------------
|
||||
revision 1.255
|
||||
date: 2008/06/24 16:38:49; author: gilles; state: Exp; lines: +7 -6
|
||||
Domino (Notes) 4.61
|
||||
----------------------------
|
||||
|
53
FAQ
53
FAQ
@ -26,6 +26,9 @@ R.
|
||||
RFC 3501 - INTERNET MESSAGE ACCESS PROTOCOL - VERSION 4rev1
|
||||
http://www.faqs.org/rfcs/rfc3501.html
|
||||
|
||||
RFC 2595 - Using TLS with IMAP, POP3 and ACAP
|
||||
http://www.faqs.org/rfcs/rfc2595.html
|
||||
|
||||
RFC 2822 - Internet Message Format
|
||||
http://www.faqs.org/rfcs/rfc2822.html
|
||||
|
||||
@ -294,6 +297,14 @@ R. Use
|
||||
|
||||
--folderrec 'MyFolder'
|
||||
|
||||
|
||||
======================================================================
|
||||
Q. How to migrate from uw-imap with an admin/authuser account ?
|
||||
|
||||
R. Use
|
||||
--user1="user*admin_user" --password1 "admin_user_password"
|
||||
|
||||
|
||||
======================================================================
|
||||
Q. How to migrate from cyrus with an admin account ?
|
||||
|
||||
@ -469,8 +480,25 @@ before using imapsync. Don't think to add a colon to this
|
||||
line since you will end with two "From:" lines (just look at
|
||||
the other lines)
|
||||
|
||||
b) Run imapsync with the following option :
|
||||
--regexmess 's/\AFrom \w .*\n//'
|
||||
b) Run imapsync with the following options :
|
||||
--regexmess 's/\AFrom \w .*\n//' --skipsize
|
||||
|
||||
=======================================================================
|
||||
Q. The contact folder isn't well copied.
|
||||
How to copy the contact folder ?
|
||||
|
||||
R. Forget the destination server (chose the same)
|
||||
Change the script around line 1426
|
||||
# ITSD
|
||||
$new_id = $from->copy($t_fold,$f_msg);
|
||||
#$new_id = $to->append_string($t_fold,$string, $flags_f, $d);
|
||||
and tried a copy of the mail instead an append_string.
|
||||
Because we are using the same server, we can use $from->copy
|
||||
Therefore we seem to not download and upload the message and therefore
|
||||
we do not have any format issues.
|
||||
And now it works fine.
|
||||
(Thanks to Hansjoerg.Maurer)
|
||||
|
||||
|
||||
=======================================================================
|
||||
Q. Synchronysing from XXX to Gmail
|
||||
@ -647,6 +675,8 @@ To convert the wholes messages from 8bit to 7bit, use option :
|
||||
|
||||
--regexmess 's/[\x80-\xff]/X/g'
|
||||
|
||||
(This is bad since only headers need this).
|
||||
|
||||
======================================================================
|
||||
Q: From MailEnable 1.75
|
||||
R: --sep1 "/" --prefix1 ""
|
||||
@ -666,6 +696,25 @@ Use:
|
||||
--useheader Message-Id --skipsize
|
||||
|
||||
|
||||
======================================================================
|
||||
Q. From any to Exchange2007
|
||||
|
||||
Several problems:
|
||||
- Big messages: increse the "send- and receive-connector"
|
||||
in exchange2007 to 40 MB.
|
||||
|
||||
R. 2 solutions
|
||||
|
||||
R1. With imapsync (only partial success)
|
||||
--skipsize --skipheader 'Received' \
|
||||
--regexmess 's{\A(.*?(?!^$))^Date:(.*?)$}{$1Date:$2\nReceived: From; $2}gxms'
|
||||
Any user having time to spend to debug Exchange2007 with imapsync
|
||||
is welcome.
|
||||
|
||||
R2. Other solution
|
||||
Two users succeded by using "MS Transporter Suite" (which is closed
|
||||
expensive nonfree software).
|
||||
|
||||
|
||||
======================================================================
|
||||
Q: How can I write an .rpm with imapsync
|
||||
|
43
README
43
README
@ -3,7 +3,7 @@ NAME
|
||||
Synchronise mailboxes between two imap servers. Good at IMAP migration.
|
||||
More than 32 different IMAP server softwares supported with success.
|
||||
|
||||
$Revision: 1.255 $
|
||||
$Revision: 1.260 $
|
||||
|
||||
INSTALL
|
||||
imapsync works fine under any Unix OS with perl.
|
||||
@ -53,6 +53,7 @@ SYNOPSIS
|
||||
[--sep2 <char>]
|
||||
[--justfolders] [--justfoldersizes] [--justconnect]
|
||||
[--syncinternaldates]
|
||||
[--idatefromheader]
|
||||
[--buffersize <int>]
|
||||
[--syncacls]
|
||||
[--regexmess <regex>] [--regexmess <regex>]
|
||||
@ -201,37 +202,38 @@ MAILING-LIST
|
||||
|
||||
Thank you for your participation.
|
||||
|
||||
BUGS
|
||||
No known serious bug. Report any bug or feature request to the author or
|
||||
the mailing-list. Before reporting bugs, read the FAQ, this README and
|
||||
the TODO files.
|
||||
BUGS and BUG REPORT
|
||||
No known serious bug.
|
||||
|
||||
Report any bug or feature request to the author or the mailing-list.
|
||||
|
||||
Before reporting bugs, read the FAQ, this README and the TODO files.
|
||||
|
||||
Don't write imapsync in uppercase in the email title, I'll know you run
|
||||
windows.
|
||||
windows and you haven't read the README yet.
|
||||
|
||||
Make a good title, not just "imapsync" or "problem", a good title is
|
||||
made of keywords summary, not too long (one visible line).
|
||||
|
||||
In your report, please include:
|
||||
Before reporting bugs, read the FAQ, this README and the TODO files.
|
||||
http://www.linux-france.org/prj/imapsync/
|
||||
|
||||
Help me to help you: in your report, please include:
|
||||
|
||||
- imapsync version.
|
||||
- IMAPClient.pm version.
|
||||
- perl version.
|
||||
- output given with --debug --debugimap near the failure point.
|
||||
- operating system running imapsync.
|
||||
- imap servers softwares on both side and their version.
|
||||
- imap servers softwares on both side and their version number.
|
||||
- imapsync with all the options you use, the full command line
|
||||
you use (except the passwords of course).
|
||||
- IMAPClient.pm version.
|
||||
|
||||
Those values can be found with the command line
|
||||
|
||||
imapsync --host1 imap.host1.net --host2 imap.host2.org --justconnect
|
||||
Those values can be found as a copy/paste at the begining of the output.
|
||||
|
||||
And also, if it can help :
|
||||
|
||||
- operating systems on both sides and the third side in case
|
||||
you run imapsync on a foreign host from the both.
|
||||
- imapsync with all the options you use, the full command line
|
||||
you use (except the passwords of course). This can be found
|
||||
at the beginning of the output.
|
||||
- output given with --debug --debugimap near the failure point.
|
||||
|
||||
IMAP SERVERS
|
||||
Failure stories reported with the following 4 imap servers :
|
||||
@ -245,7 +247,8 @@ IMAP SERVERS
|
||||
Success stories reported with the following 35 imap servers (softwares
|
||||
names are in alphabetic order) :
|
||||
|
||||
- Archiveopteryx 2.03, 2.04, 2.09 (OSL 3.0) http://www.archiveopteryx.org/
|
||||
- Archiveopteryx 2.03, 2.04, 2.09, 2.10 [dest]
|
||||
(OSL 3.0) http://www.archiveopteryx.org/
|
||||
- BincImap 1.2.3 (GPL) (http://www.bincimap.org/)
|
||||
- CommuniGatePro server (Redhat 8.0)
|
||||
- Courier IMAP 1.5.1, 2.2.0, 2.1.1, 2.2.1, 3.0.8, 3.0.3, 4.1.1 (GPL)
|
||||
@ -295,7 +298,7 @@ IMAP SERVERS
|
||||
- Zimbra-IMAP 3.0.1 GA 160, 3.1.0 Build 279, 4.0.5, 4.5.2, 4.5.6, 5.5.
|
||||
|
||||
Please report to the author any success or bad story with imapsync and
|
||||
don't forget to mention the IMAP server software names and version on
|
||||
do not forget to mention the IMAP server software names and version on
|
||||
both sides. This will help future users. To help the author maintaining
|
||||
this section report the two lines at the begining of the output if they
|
||||
are useful to know the softwares. Example:
|
||||
@ -361,5 +364,5 @@ SIMILAR SOFTWARES
|
||||
|
||||
Feedback (good or bad) will be always welcome.
|
||||
|
||||
$Id: imapsync,v 1.255 2008/06/24 16:38:49 gilles Exp gilles $
|
||||
$Id: imapsync,v 1.260 2008/08/13 03:14:14 gilles Exp gilles $
|
||||
|
||||
|
14
TODO
14
TODO
@ -1,6 +1,20 @@
|
||||
TODO file for imapsync
|
||||
----------------------
|
||||
|
||||
Write to zimbra coders about the date presentation:
|
||||
Sorting by default by internal date is bad with migrations
|
||||
and delays arrivals. An option would be good.
|
||||
|
||||
Fix --ssl --justconnect bug
|
||||
|
||||
Fix --ssl need --authmech login with gmail. Why?
|
||||
|
||||
Add an option to implement the faq entry about copying a contact folder.
|
||||
|
||||
imapsync doesn't report well. It should says "I had
|
||||
to sync 123 messages but I could transfer only 99 messages"
|
||||
|
||||
|
||||
Fix bug "not possible to use space in the imap password"
|
||||
|
||||
Add kerberos authentification
|
||||
|
@ -15,7 +15,12 @@ RELEASE_FOCUS="Major bugfixes"
|
||||
#TEXT_BODY="Bug fix: be case insensitive with header keywords."
|
||||
#TEXT_BODY="Bug fix: rewrote the way to store messages to avoid freeze problems with some imap servers"
|
||||
#TEXT_BODY="Bug fix: Allow long usernames with md5 authentification."
|
||||
#TEXT_BODY="Bug fix: Bug really fixed: 'parse_headers want an ARRAY ref' crash (second time)."
|
||||
|
||||
TEXT_BODY="Bug fixes:
|
||||
- Bug really fixed: "parse_headers want an ARRAY ref" crash (second time).
|
||||
- Adaptation fix: Some imap servers return message size not equal to real message
|
||||
size. Now imapsync accept this silly behavior and leave the message as is.
|
||||
|
||||
- Many thanks to the freshmeat folk that correct my bad and poorly English !
|
||||
"
|
||||
|
||||
|
@ -1,9 +1,14 @@
|
||||
Project: imapsync
|
||||
Version: 1.252
|
||||
Version: 1.255
|
||||
Release-Focus: Major bugfixes
|
||||
Hide: N
|
||||
Home-Page-URL: http://www.linux-france.org/prj/imapsync/
|
||||
Gzipped-Tar-URL: http://www.linux-france.org/prj/imapsync/dist/
|
||||
|
||||
Bug fixes:
|
||||
- Adaptation fix: Some imap servers return message size not equal to real message
|
||||
size. Now imapsync accept this silly behavior and leave the message as is.
|
||||
|
||||
- Many thanks to the freshmeat folk that correct my bad and poorly English !
|
||||
|
||||
|
||||
|
171
imapsync
171
imapsync
@ -9,7 +9,7 @@ tool. Synchronise mailboxes between two imap servers. Good
|
||||
at IMAP migration. More than 32 different IMAP server softwares
|
||||
supported with success.
|
||||
|
||||
$Revision: 1.255 $
|
||||
$Revision: 1.260 $
|
||||
|
||||
=head1 INSTALL
|
||||
|
||||
@ -61,6 +61,7 @@ The option list :
|
||||
[--sep2 <char>]
|
||||
[--justfolders] [--justfoldersizes] [--justconnect]
|
||||
[--syncinternaldates]
|
||||
[--idatefromheader]
|
||||
[--buffersize <int>]
|
||||
[--syncacls]
|
||||
[--regexmess <regex>] [--regexmess <regex>]
|
||||
@ -234,39 +235,41 @@ post to this list if you want to stay private.
|
||||
|
||||
Thank you for your participation.
|
||||
|
||||
=head1 BUGS
|
||||
=head1 BUGS and BUG REPORT
|
||||
|
||||
No known serious bug. Report any bug or feature request to the author
|
||||
No known serious bug.
|
||||
|
||||
Report any bug or feature request to the author
|
||||
or the mailing-list.
|
||||
|
||||
Before reporting bugs, read the FAQ, this README and the
|
||||
TODO files.
|
||||
|
||||
Don't write imapsync in uppercase in the email title, I'll
|
||||
know you run windows.
|
||||
know you run windows and you haven't read the README yet.
|
||||
|
||||
Make a good title, not just "imapsync" or "problem",
|
||||
a good title is made of keywords summary, not too long (one visible line).
|
||||
|
||||
In your report, please include:
|
||||
Before reporting bugs, read the FAQ, this README and the
|
||||
TODO files. http://www.linux-france.org/prj/imapsync/
|
||||
|
||||
Help me to help you: in your report, please include:
|
||||
|
||||
- imapsync version.
|
||||
- IMAPClient.pm version.
|
||||
- perl version.
|
||||
- output given with --debug --debugimap near the failure point.
|
||||
- operating system running imapsync.
|
||||
- imap servers softwares on both side and their version.
|
||||
- imap servers softwares on both side and their version number.
|
||||
- imapsync with all the options you use, the full command line
|
||||
you use (except the passwords of course).
|
||||
- IMAPClient.pm version.
|
||||
|
||||
Those values can be found with the command line
|
||||
|
||||
imapsync --host1 imap.host1.net --host2 imap.host2.org --justconnect
|
||||
Those values can be found as a copy/paste at the begining of the output.
|
||||
|
||||
And also, if it can help :
|
||||
|
||||
- operating systems on both sides and the third side in case
|
||||
you run imapsync on a foreign host from the both.
|
||||
- imapsync with all the options you use, the full command line
|
||||
you use (except the passwords of course). This can be found
|
||||
at the beginning of the output.
|
||||
- output given with --debug --debugimap near the failure point.
|
||||
|
||||
=head1 IMAP SERVERS
|
||||
|
||||
@ -281,7 +284,8 @@ Failure stories reported with the following 4 imap servers :
|
||||
Success stories reported with the following 35 imap servers
|
||||
(softwares names are in alphabetic order) :
|
||||
|
||||
- Archiveopteryx 2.03, 2.04, 2.09 (OSL 3.0) http://www.archiveopteryx.org/
|
||||
- Archiveopteryx 2.03, 2.04, 2.09, 2.10 [dest]
|
||||
(OSL 3.0) http://www.archiveopteryx.org/
|
||||
- BincImap 1.2.3 (GPL) (http://www.bincimap.org/)
|
||||
- CommuniGatePro server (Redhat 8.0)
|
||||
- Courier IMAP 1.5.1, 2.2.0, 2.1.1, 2.2.1, 3.0.8, 3.0.3, 4.1.1 (GPL)
|
||||
@ -331,7 +335,7 @@ Success stories reported with the following 35 imap servers
|
||||
- Zimbra-IMAP 3.0.1 GA 160, 3.1.0 Build 279, 4.0.5, 4.5.2, 4.5.6, 5.5.
|
||||
|
||||
Please report to the author any success or bad story with
|
||||
imapsync and don't forget to mention the IMAP server
|
||||
imapsync and do not forget to mention the IMAP server
|
||||
software names and version on both sides. This will help
|
||||
future users. To help the author maintaining this section
|
||||
report the two lines at the begining of the output if they
|
||||
@ -418,7 +422,7 @@ Entries for imapsync:
|
||||
|
||||
Feedback (good or bad) will be always welcome.
|
||||
|
||||
$Id: imapsync,v 1.255 2008/06/24 16:38:49 gilles Exp gilles $
|
||||
$Id: imapsync,v 1.260 2008/08/13 03:14:14 gilles Exp gilles $
|
||||
|
||||
|
||||
|
||||
@ -453,7 +457,9 @@ my(
|
||||
$prefix1, $prefix2,
|
||||
@regextrans2, @regexmess, @regexflag,
|
||||
$sep1, $sep2,
|
||||
$syncinternaldates, $syncacls,
|
||||
$syncinternaldates,
|
||||
$idatefromheader,
|
||||
$syncacls,
|
||||
$fastio1, $fastio2,
|
||||
$maxsize, $maxage, $minage,
|
||||
$skipheader, @useheader,
|
||||
@ -483,7 +489,7 @@ my(
|
||||
use vars qw ($opt_G); # missing code for this will be option.
|
||||
|
||||
|
||||
$rcs = ' $Id: imapsync,v 1.255 2008/06/24 16:38:49 gilles Exp gilles $ ';
|
||||
$rcs = '$Id: imapsync,v 1.260 2008/08/13 03:14:14 gilles Exp gilles $ ';
|
||||
$rcs =~ m/,v (\d+\.\d+)/;
|
||||
$VERSION = ($1) ? $1 : "UNKNOWN";
|
||||
|
||||
@ -517,8 +523,8 @@ $error=0;
|
||||
|
||||
my $banner = join("",
|
||||
'$RCSfile: imapsync,v $ ',
|
||||
'$Revision: 1.255 $ ',
|
||||
'$Date: 2008/06/24 16:38:49 $ ',
|
||||
'$Revision: 1.260 $ ',
|
||||
'$Date: 2008/08/13 03:14:14 $ ',
|
||||
"\n",localhost_info(),
|
||||
" and the module Mail::IMAPClient version used here is ",
|
||||
$VERSION_IMAPClient,"\n",
|
||||
@ -592,13 +598,21 @@ $user1 || missing_option("--user1");
|
||||
$user2 || missing_option("--user2");
|
||||
|
||||
$syncinternaldates = defined($syncinternaldates) ? defined($syncinternaldates) : 1;
|
||||
|
||||
if($idatefromheader) {
|
||||
print "Turned ON idatefromheader, ",
|
||||
"will set the internal dates on host2 from the 'Date:' header line.\n";
|
||||
$syncinternaldates = 0;
|
||||
|
||||
}
|
||||
if ($syncinternaldates) {
|
||||
print "Turned ON syncinternaldates, will set the internal dates on host2 same as host1.\n";
|
||||
print "Turned ON syncinternaldates, ",
|
||||
"will set the internal dates on host2 same as host1.\n";
|
||||
}else{
|
||||
print "Turned OFF syncinternaldates\n";
|
||||
}
|
||||
|
||||
if ($syncinternaldates) {
|
||||
if ($syncinternaldates || $idatefromheader) {
|
||||
no warnings 'redefine';
|
||||
local *Carp::confess = sub { return undef; };
|
||||
require Date::Manip;
|
||||
@ -908,6 +922,15 @@ if (scalar(@exclude)) {
|
||||
}
|
||||
}
|
||||
|
||||
# Remove no selectable folders
|
||||
|
||||
foreach my $folder (keys(%requested_folder)) {
|
||||
if ( not $from->selectable($folder)) {
|
||||
print "Warning : ignoring folder $folder because it is not selectable\n";
|
||||
remove_from_requested_folders($folder);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
my @requested_folder = sort(keys(%requested_folder));
|
||||
|
||||
@ -1386,12 +1409,33 @@ FOLDER: foreach my $f_fold (@f_folders) {
|
||||
#print "AAA1[$string]ZZZ\n";
|
||||
#unlink($message_file);
|
||||
if (@regexmess) {
|
||||
$string = regexmess($string);
|
||||
|
||||
#string_to_file($string, $message_file);
|
||||
}
|
||||
|
||||
sub tests_regexmess {
|
||||
|
||||
ok("blabla" eq regexmess("blabla"), "regexmess, nothing to do");
|
||||
@regexmess = ('s/p/Z/g');
|
||||
ok("ZoZoZo" eq regexmess("popopo"), "regexmess, s/p/Z/g");
|
||||
@regexmess = 's{c}{C}gxms';
|
||||
#print "RRR¤\n", regexmess("H1: abc\nH2: cde\n\nBody abc"), "\n";
|
||||
ok("H1: abC\nH2: Cde\n\nBody abC"
|
||||
eq regexmess("H1: abc\nH2: cde\n\nBody abc"),
|
||||
"regexmess, c->C");
|
||||
|
||||
}
|
||||
|
||||
sub regexmess {
|
||||
my ($string) = @_;
|
||||
foreach my $regexmess (@regexmess) {
|
||||
$debug and print "eval \$string =~ $regexmess\n";
|
||||
eval("\$string =~ $regexmess");
|
||||
}
|
||||
#string_to_file($string, $message_file);
|
||||
return($string);
|
||||
}
|
||||
|
||||
$debug and print
|
||||
"=" x80, "\n",
|
||||
"F message content begin next line\n",
|
||||
@ -1401,9 +1445,23 @@ FOLDER: foreach my $f_fold (@f_folders) {
|
||||
if ($syncinternaldates) {
|
||||
$d = $f_idate;
|
||||
$debug and print "internal date from 1: [$d]\n";
|
||||
$d = good_date($d);
|
||||
$debug and print "internal date from 1: [$d] (fixed)\n";
|
||||
}
|
||||
|
||||
if ($idatefromheader) {
|
||||
|
||||
$d = $from->get_header($f_msg,"Date");
|
||||
$debug and print "header date from 1: [$d]\n";
|
||||
$d = good_date($d);
|
||||
$debug and print "header date from 1: [$d] (fixed)\n";
|
||||
}
|
||||
|
||||
sub good_date {
|
||||
my ($d) = @_;
|
||||
$d = UnixDate(ParseDate($d), "%d-%b-%Y %H:%M:%S %z");
|
||||
$d = "\"$d\"";
|
||||
$debug and print "internal date from 1: [$d] (fixed)\n";
|
||||
return($d);
|
||||
}
|
||||
|
||||
my $flags_f = $f_hash{$m_id}{'F'} || "";
|
||||
@ -1597,16 +1655,18 @@ sub stats {
|
||||
print "Total bytes transferred: $mess_size_total_trans\n";
|
||||
print "Total bytes skipped : $mess_size_total_skipped\n";
|
||||
print "Total bytes error : $mess_size_total_error\n";
|
||||
print "Detected $error errors\n";
|
||||
print "Please, rate imapsync at http://freshmeat.net/projects/imapsync/\n";
|
||||
print "?Happy with this free, open source and gratis GPL software?\n",
|
||||
"Feel free to thank the author by giving him a book:\n",
|
||||
"http://www.amazon.com/gp/registry/wishlist/1C9UNDIH3P7R7/\n",
|
||||
"(or its paypal account gilles.lamiral\@laposte.net)\n";
|
||||
|
||||
|
||||
print "Detected $error errors\n\n";
|
||||
print thank_author();
|
||||
}
|
||||
|
||||
sub thank_author {
|
||||
|
||||
return(join("", "Happy with this free, open and gratis GPL software?\n",
|
||||
"Please, thank the author (Gilles LAMIRAL) by giving him a book:\n",
|
||||
"http://www.amazon.com/gp/registry/wishlist/1C9UNDIH3P7R7/\n",
|
||||
"and rate imapsync at http://freshmeat.net/projects/imapsync/\n"));
|
||||
|
||||
}
|
||||
|
||||
sub get_options
|
||||
{
|
||||
@ -1639,6 +1699,7 @@ sub get_options
|
||||
"delete!" => \$delete,
|
||||
"delete2!" => \$delete2,
|
||||
"syncinternaldates!" => \$syncinternaldates,
|
||||
"idatefromheader!" => \$idatefromheader,
|
||||
"syncacls!" => \$syncacls,
|
||||
"maxsize=i" => \$maxsize,
|
||||
"maxage=i" => \$maxage,
|
||||
@ -1797,6 +1858,7 @@ sub string_to_file {
|
||||
|
||||
sub usage {
|
||||
my $localhost_info = localhost_info();
|
||||
my $thank = thank_author();
|
||||
print <<EOF;
|
||||
|
||||
usage: $0 [options]
|
||||
@ -1874,6 +1936,8 @@ Several options are mandatory.
|
||||
--expunge2 : expunge messages on target account.
|
||||
--syncinternaldates : sets the internal dates on host2 same as host1.
|
||||
Turned on by default.
|
||||
--idatefromheader : sets the internal dates on host2 same as the
|
||||
"Date:" headers.
|
||||
--buffersize <int> : sets the size of a block of I/O.
|
||||
--maxsize <int> : skip messages larger than <int> bytes
|
||||
--maxage <int> : skip messages older than <int> days.
|
||||
@ -1929,19 +1993,20 @@ $0 \\
|
||||
$localhost_info
|
||||
Mail::IMAPClient version is $Mail::IMAPClient::VERSION
|
||||
$rcs
|
||||
imapsync copyleft is the GNU General Public License.
|
||||
See http://www.gnu.org/copyleft/gpl.html
|
||||
http://www.amazon.com/gp/registry/wishlist/1C9UNDIH3P7R7/
|
||||
|
||||
$thank
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
|
||||
sub tests {
|
||||
|
||||
SKIP: {
|
||||
skip "No test in normal run" if (not $tests);
|
||||
tests_folder_routines();
|
||||
tests_compare_lists();
|
||||
tests_regexmess();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2217,6 +2282,19 @@ use constant NonFolderArg => 1; # Value to pass to Massage to
|
||||
};
|
||||
|
||||
|
||||
*Mail::IMAPClient::get_header = sub {
|
||||
my($self , $msg, $header ) = @_;
|
||||
my $val;
|
||||
|
||||
#eval { $val = $self->parse_headers([$msg],$header)->{$header}[0] };
|
||||
my $h = $self->parse_headers([$msg],$header);
|
||||
#require Data::Dumper;
|
||||
#print Data::Dumper->Dump([$h]);
|
||||
#$val = $self->parse_headers([$msg],$header)->{$header}[0];
|
||||
|
||||
$val = $h->{$msg}{$header}[0];
|
||||
return defined($val)? $val : undef;
|
||||
};
|
||||
|
||||
|
||||
*Mail::IMAPClient::parse_headers = sub {
|
||||
@ -2466,27 +2544,18 @@ use constant NonFolderArg => 1; # Value to pass to Massage to
|
||||
$string .= $result->[DATA]
|
||||
if defined($result) and $self->_is_literal($result) ;
|
||||
}
|
||||
|
||||
# BUG? should probably return undef if length != expected
|
||||
# No bug, somme servers are buggy.
|
||||
|
||||
if ( length($string) != $expected_size ) {
|
||||
carp "${self}::message_string: " .
|
||||
carp "message_string: " .
|
||||
"expected $expected_size bytes but received " .
|
||||
length($string);
|
||||
$self->LastError("${self}::message_string: expected ".
|
||||
$self->LastError("message_string: expected ".
|
||||
"$expected_size bytes but received " .
|
||||
length($string)."\n");
|
||||
}
|
||||
# REMOVE NEXT COMMENTED LINES
|
||||
# if ( length($string) > $expected_size ){
|
||||
# $string = substr($string,0,$expected_size)
|
||||
# }
|
||||
# if ( length($string) < $expected_size ) {
|
||||
# $self->LastError("${self}::message_string: expected ".
|
||||
# "$expected_size bytes but received " .
|
||||
# length($string)."\n");
|
||||
# return $string;
|
||||
# #return undef;
|
||||
# }
|
||||
|
||||
return $string;
|
||||
};
|
||||
|
||||
|
27
tests.sh
27
tests.sh
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
# $Id: tests.sh,v 1.73 2008/05/08 02:10:31 gilles Exp gilles $
|
||||
# $Id: tests.sh,v 1.77 2008/08/13 23:33:18 gilles Exp gilles $
|
||||
|
||||
#### Shell pragmas
|
||||
|
||||
@ -244,6 +244,22 @@ ll_internaldate() {
|
||||
}
|
||||
|
||||
|
||||
ll_idatefromheader() {
|
||||
if test X`hostname` = X"plume"; then
|
||||
echo3 Here is plume
|
||||
sendtestmessage
|
||||
$CMD_PERL ./imapsync \
|
||||
--host1 localhost --user1 tata@est.belle \
|
||||
--passfile1 /var/tmp/secret.tata \
|
||||
--host2 localhost --user2 titi@est.belle \
|
||||
--passfile2 /var/tmp/secret.titi \
|
||||
--folder INBOX.oneemail \
|
||||
--idatefromheader --debug --dry
|
||||
else
|
||||
:
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
ll_folder_rev() {
|
||||
@ -557,6 +573,7 @@ ll_regexmess()
|
||||
{
|
||||
if test X`hostname` = X"plume"; then
|
||||
echo3 Here is plume
|
||||
rm -f /home/vmail/titi/.yop.yap/cur/*
|
||||
$CMD_PERL ./imapsync \
|
||||
--host1 localhost --user1 tata@est.belle \
|
||||
--passfile1 /var/tmp/secret.tata \
|
||||
@ -565,8 +582,10 @@ ll_regexmess()
|
||||
--folder INBOX.yop.yap \
|
||||
--regexmess 's/\157/O/g' \
|
||||
--regexmess 's/p/Z/g' \
|
||||
--dry --debug
|
||||
echo 'rm /home/vmail/titi/.yop.yap/cur/*'
|
||||
--debug
|
||||
file=`ls -t /home/vmail/titi/.yop.yap/cur/* | tail -1`
|
||||
diff /var/tmp/imapsync/tests/ll_regexmess/dest_01 $file
|
||||
#echo 'rm -f /home/vmail/titi/.yop.yap/cur/*'
|
||||
else
|
||||
:
|
||||
fi
|
||||
@ -744,6 +763,7 @@ msw() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
##########################
|
||||
# specific tests
|
||||
##########################
|
||||
@ -980,6 +1000,7 @@ test $# -eq 0 && run_tests \
|
||||
ll_justfolders \
|
||||
ll_prefix12 \
|
||||
ll_internaldate \
|
||||
ll_idatefromheader \
|
||||
ll_folder_rev \
|
||||
ll_subscribed \
|
||||
ll_subscribe \
|
||||
|
Loading…
Reference in New Issue
Block a user