diff --git a/CREDITS b/CREDITS index db2c399..3fed3ae 100644 --- a/CREDITS +++ b/CREDITS @@ -1,5 +1,5 @@ #!/bin/cat -# $Id: CREDITS,v 1.142 2010/08/09 01:16:01 gilles Exp gilles $ +# $Id: CREDITS,v 1.143 2010/08/15 11:18:09 gilles Exp gilles $ If you want to make a donation to the author, Gilles LAMIRAL: @@ -20,6 +20,18 @@ to remove one. I thank very much all of these people. +Tony Pearse +Contributed by giving money 25 USD + +Jan Keymeulen +Contributed by giving money 10 USD for 50% speedup. + +Globule Bleu +Contributed by giving money 15 USD + +Martin Schlagnitweit +Contributed by giving money 20 USD + Martin Werthmoeller Gave a patch ./patches/imapsync-1.337_tobit_V6.patch diff --git a/ChangeLog b/ChangeLog index a26cc7d..6e7af10 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,17 +1,27 @@ RCS file: RCS/imapsync,v Working file: imapsync -head: 1.340 +head: 1.342 branch: locks: strict - gilles: 1.340 + gilles: 1.342 access list: symbolic names: keyword substitution: kv -total revisions: 340; selected revisions: 340 +total revisions: 342; selected revisions: 342 description: ---------------------------- -revision 1.340 locked by: gilles; +revision 1.342 locked by: gilles; +date: 2010/08/15 11:02:41; author: gilles; state: Exp; lines: +12 -13 +Clarity. Print capability after authenticated state. +---------------------------- +revision 1.341 +date: 2010/08/15 10:56:45; author: gilles; state: Exp; lines: +42 -14 +Added Mail::IMAPClient::capability_update() to reset the capability cache. +Bug fix. Some imap server change their capability after authentification, +imapsync used the capability cache from the first CAPABILITY call. +---------------------------- +revision 1.340 date: 2010/08/09 00:03:21; author: gilles; state: Exp; lines: +7 -7 Bug fix. Stupid undef breaking --syncinternaldates ---------------------------- diff --git a/Makefile b/Makefile index 195ed37..ad9a27d 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -# $Id: Makefile,v 1.34 2010/07/25 21:30:45 gilles Exp gilles $ +# $Id: Makefile,v 1.35 2010/08/15 11:18:38 gilles Exp gilles $ .PHONY: help usage all @@ -13,6 +13,7 @@ usage: @echo "make test3xx # run tests with (last) Mail-IMAPClient-3.xy" @echo "make test229 # run tests with Mail-IMAPClient-2.2.9" @echo "make all " + @echo "make upload_index" DIST_NAME=imapsync-$(VERSION) DIST_FILE=$(DIST_NAME).tgz diff --git a/README b/README index 34e7b63..1b6d166 100644 --- a/README +++ b/README @@ -3,7 +3,7 @@ NAME Synchronise mailboxes between two imap servers. Good at IMAP migration. More than 36 different IMAP server softwares supported with success. - $Revision: 1.340 $ + $Revision: 1.342 $ SYNOPSIS To synchronise imap account "foo" on "imap.truc.org" to imap account @@ -87,7 +87,7 @@ USAGE [--pidfile ] [--tmpdir ] [--version] [--help] - + DESCRIPTION The command imapsync is a tool allowing incremental and recursive imap transfer from one mailbox to another. @@ -400,5 +400,5 @@ SIMILAR SOFTWARES Feedback (good or bad) will often be welcome. - $Id: imapsync,v 1.340 2010/08/09 00:03:21 gilles Exp gilles $ + $Id: imapsync,v 1.342 2010/08/15 11:02:41 gilles Exp gilles $ diff --git a/TIME b/TIME index 9d95938..45033e6 100644 --- a/TIME +++ b/TIME @@ -1,21 +1,23 @@ -50 3 replies on list. -40 http://www.linux-france.org/prj/imapsync_list/threads.html#00582 + 75 Fix. capability issue after authenticate. +240 Various + 50 3 replies on list. + 40 http://www.linux-france.org/prj/imapsync_list/threads.html#00582 250 ietf imap5 discussion -30 refactoring -80 read RFC2683 - IMAP4 Implementation Recommendations + 30 Refactoring + 80 Read RFC2683 - IMAP4 Implementation Recommendations 140 imapsync under win32 strawberry, pp (par::packer), imapsync.exe 300 imapsync under win32. test msw, environnement, using activestate -70 Profiling tests. Interresting results! + 70 Profiling tests. Interresting results! 110 FAQ review, FAQ item "messages not all transferred", imapsync stats about "noheader" 250 Reviewed varaibles names, statistics, sub definitions from top to connect_imap() 120 W3C validation of web site -120 --pidfile option. die_clean() exit_clean() +120 --pidfile option. die_clean() exit_clean() 120 reconnect counter, --debugimap1 --debugimap2 -50 FAQ tested "From " removing solution. + 50 FAQ tested "From " removing solution. 600 split maxcommandlenght, email, reconnect better. -25 reconnect AUTOLOADING bug? -80 --subscribe_all. 1.318 -70 Risko email. 1.315 on debian. + 25 reconnect AUTOLOADING bug? + 80 --subscribe_all. 1.318 + 70 Risko email. 1.315 on debian. 130 180 190 Added reconnect to 2.2.9 diff --git a/TODO b/TODO index fdedec6..9e9e4d2 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,5 @@ #!/bin/cat -# $Id: TODO,v 1.80 2010/08/09 01:15:44 gilles Exp gilles $ +# $Id: TODO,v 1.81 2010/08/15 11:15:42 gilles Exp gilles $ TODO file for imapsync ---------------------- @@ -21,6 +21,11 @@ Evaluate http://www.rackspace.com/apps/email_hosting/migrations http://www.yippiemove.com/ + +Be more effiscient with large mailboxes +Write a Mail::IMAPClient::fetch_hash allowing selecting messages to fetch +4 hours estimated time coding. + Add a well described problem for each problem detected and counted in error counter statistics. @@ -30,9 +35,6 @@ http://www.bwebcentral.com/utils/imapsync-yahoo See patches/imapsync-yahoo -DONE. Bugfix. Duplicate messages on host2 are not deleted with --delete2 -Reason: "Skipping msg #120:508 in host2 folder INBOX.2005-INBOX (duplicate so we ignore this message)" - Add NTLM authentification support http://cpansearch.perl.org/src/BUZZ/NTLM-1.05/NTLM.pm http://curl.haxx.se/rfc/ntlm.html @@ -153,8 +155,13 @@ http://asg.web.cmu.edu/cyrus/download/imapd/altnamespace.html Explain expunge behavior. +=========================================================================== +DONE. Bugfix. Duplicate messages on host2 are not deleted with --delete2 +Reason: "Skipping msg #120:508 in host2 folder INBOX.2005-INBOX (duplicate so we ignore this message)" +DONE. Ask namespace capability after login (dovecot 2). +It was a bug from library caching CAPABILITY. DONE. Write a clean_exit() replacing each die() or exit() call. Wrote exit_clean() and die_clean() to remove pid file. diff --git a/VERSION b/VERSION index 890cbb7..7a2ec92 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.340 +1.342 diff --git a/imapsync b/imapsync index ced1456..8037764 100755 --- a/imapsync +++ b/imapsync @@ -19,7 +19,7 @@ tool. Synchronise mailboxes between two imap servers. Good at IMAP migration. More than 36 different IMAP server softwares supported with success. -$Revision: 1.340 $ +$Revision: 1.342 $ =head1 SYNOPSIS @@ -469,7 +469,7 @@ Entries for imapsync: Feedback (good or bad) will often be welcome. -$Id: imapsync,v 1.340 2010/08/09 00:03:21 gilles Exp gilles $ +$Id: imapsync,v 1.342 2010/08/15 11:02:41 gilles Exp gilles $ =cut @@ -557,7 +557,7 @@ my( # global variables initialisation -$rcs = '$Id: imapsync,v 1.340 2010/08/09 00:03:21 gilles Exp gilles $ '; +$rcs = '$Id: imapsync,v 1.342 2010/08/15 11:02:41 gilles Exp gilles $ '; $total_bytes_transferred = 0; $total_bytes_skipped = 0; @@ -728,8 +728,8 @@ $reconnectretry2 = (defined($reconnectretry2)) ? $reconnectretry2 : 3; @useheader = ("ALL") unless (@useheader); -print "Host1 imap server [$host1] port [$port1] user [$user1]\n"; -print "Host2 imap server [$host2] port [$port2] user [$user2]\n"; +print "Host1: imap server [$host1] port [$port1] user [$user1]\n"; +print "Host2: imap server [$host2] port [$port2] user [$user2]\n"; sub ask_for_password { @@ -860,15 +860,14 @@ sub server_banner { return $banner; } - - -$debug and print "Host1 capability: ", join(" ", $imap1->capability()), "\n"; -$debug and print "Host2 capability: ", join(" ", $imap2->capability()), "\n"; - die_clean() unless $imap1->IsAuthenticated(); -print "host1: state Authenticated\n"; +print "Host1: state Authenticated\n"; die_clean() unless $imap2->IsAuthenticated(); -print "host2: state Authenticated\n"; +print "Host2: state Authenticated\n"; + +print "Host1 capability: ", join(" ", $imap1->capability_update()), "\n"; +print "Host2 capability: ", join(" ", $imap2->capability_update()), "\n"; + exit_clean(0) if ($justlogin); @@ -1087,13 +1086,9 @@ sub tests_compare_lists { } - - - my($h1_sep,$h2_sep); # what are the private folders separators for each server ? - $debug and print "Getting separators\n"; $h1_sep = get_separator($imap1, $sep1, "--sep1"); $h2_sep = get_separator($imap2, $sep2, "--sep2"); @@ -2101,7 +2096,7 @@ exit_clean(0); # subroutines sub imapsync_version { - my $rcs = '$Id: imapsync,v 1.340 2010/08/09 00:03:21 gilles Exp gilles $ '; + my $rcs = '$Id: imapsync,v 1.342 2010/08/15 11:02:41 gilles Exp gilles $ '; $rcs =~ m/,v (\d+\.\d+)/; my $VERSION = ($1) ? $1: "UNKNOWN"; return($VERSION); @@ -2185,8 +2180,8 @@ sub banner_imapsync { my @argv_copy = @_; my $banner_imapsync = join("", '$RCSfile: imapsync,v $ ', - '$Revision: 1.340 $ ', - '$Date: 2010/08/09 00:03:21 $ ', + '$Revision: 1.342 $ ', + '$Date: 2010/08/15 11:02:41 $ ', "\n",localhost_info(), "\n", "Command line used:\n", "$0 ", command_line_nopassword(@argv_copy), "\n", @@ -3476,6 +3471,29 @@ no warnings 'once'; }; +# capability 2.2.9 is stupid: it caches and return first imap CAPABILITY call +# but call imap CAPABILITY each time. +# Copy/paste from 3.25 +*Mail::IMAPClient::capability = sub { + my $self = shift; + + if ( $self->{CAPABILITY} ) { + my @caps = keys %{ $self->{CAPABILITY} }; + return wantarray ? @caps : \@caps; + } + + $self->_imap_command('CAPABILITY') + or return undef; + + my @caps = map { split } grep s/^\*\s+CAPABILITY\s+//, $self->History; + foreach (@caps) { + $self->{CAPABILITY}{ uc $_ }++; + $self->{ uc $1 } = uc $2 if /(.*?)\=(.*)/; + } + + return wantarray ? @caps : \@caps; +}; + *Mail::IMAPClient::_read_line = sub { my $self = shift; my $sh = $self->Socket; @@ -3751,6 +3769,7 @@ no warnings 'once'; }; + } # End of sub override_imapclient (yes, very bad indentation) @@ -3891,3 +3910,11 @@ sub RawSocket2 { #$self->Fast_io( $self->Fast_io ); $sock; } + +sub capability_update { + my $self = shift; + + delete $self->{CAPABILITY}; + $self->capability; +} + diff --git a/index.shtml b/index.shtml index e53520a..d4af36c 100644 --- a/index.shtml +++ b/index.shtml @@ -5,7 +5,7 @@ imapsync <!--#exec cmd="cat VERSION" --> - + @@ -22,6 +22,11 @@

imapsync software is a command line tool allowing incremental and recursive imap transfers from one mailbox to another, both anywhere on the internet. + +imapsync is useful for imap account migration or imap account backup. + +imapsync is not adequat for maintening two active imap accounts in synchronization +(where user plays independently on both sides).

@@ -135,14 +140,14 @@ If you really want a feature you can donate money and I'll code it.

Some features and their time/money to be done evaluation

- - - - - - -
Feature Time guessedTime spentMoney receivedMoney still needed
Speedup 50% 10 hours 80 min 0 $ 300 $
Backup to files 8 hours 60 min 0 $ 240 $
--deletefolder2 3 hours 30 min 0 $ 90 $
NTLM auth 3 hours 60 min 0 $ 90 $
Win32 imapsync.exe 8 hours 520 min 0 $ 240 $
- +Feature Time guessedTime spentMoney receivedMoney needed +Speedup 50% 10 hours 80 min 10 $ 300 $ +Backup to files 8 hours 60 min 0 $ 240 $ +--deletefolder2 3 hours 30 min 0 $ 90 $ +NTLM auth 3 hours 60 min 0 $ 90 $ +Win32 imapsync.exe 8 hours 520 min 0 $ 240 $ +Fix capability changes 1 hour 80 min 0 $ 240 $ +

COPYING

@@ -159,7 +164,7 @@ If you really want a feature you can donate money and I'll code it.
This document last modified
-$Id: index.shtml,v 1.17 2010/07/26 23:40:00 gilles Exp gilles $ +$Id: index.shtml,v 1.18 2010/08/15 11:33:12 gilles Exp gilles $

diff --git a/test.bat b/test.bat index c40a6ed..c39cce2 100755 --- a/test.bat +++ b/test.bat @@ -1,18 +1,17 @@ -%REM $Id: test.bat,v 1.5 2010/07/16 23:27:13 gilles Exp gilles $ +REM $Id: test.bat,v 1.6 2010/08/15 11:10:49 gilles Exp gilles $ cd C:\msys\1.0\home\Admin\imapsync perl -mMail::IMAPClient -mDigest::MD5 -mTerm::ReadKey -mIO::Socket::SSL -mDate::Manip -mFile::Spec -mDigest::HMAC_MD5 -e '' set TZ="GMT" -perl ./imapsync --host1 l --user1 toto --passfile1 secret.toto --host2 l --user2 titi --passfile2 secret.titi --noauthmd5 --delete2 --expunge2 -perl ./imapsync --host1 l --user1 tata --passfile1 secret.tata --host2 l --user2 titi --passfile2 secret.titi --noauthmd5 --delete2 --expunge2 --folder INBOX +REM perl ./imapsync --host1 l --user1 toto --passfile1 secret.toto --host2 l --user2 titi --passfile2 secret.titi --noauthmd5 --delete2 --expunge2 +REM perl ./imapsync --host1 l --user1 tata --passfile1 secret.tata --host2 l --user2 titi --passfile2 secret.titi --noauthmd5 --delete2 --expunge2 --folder INBOX -% REM -M Date::Manip 6.xx buggy? +REM -M Date::Manip 6.xx buggy? pp -o imapsync.exe -M Term::ReadKey -M IO::Socket::SSL -M Digest::HMAC_MD5 imapsync +echo Checking imapsync.exe .\imapsync.exe --host1 l --user1 toto --passfile1 secret.toto --host2 l --user2 titi --passfile2 secret.titi --noauthmd5 --delete2 --expunge2 - -.\imapsync.exe --host1 l --user1 tata --passfile1 secret.tata --host2 l --user2 titi --passfile2 secret.titi --noauthmd5 --delete2 --expunge2 --folder INBOX - - +.\imapsync.exe --host1 l --user1 tata --passfile1 secret.tata --host2 l --user2 titi --passfile2 secret.titi --noauthmd5 --delete2 --expunge2 --folder INBOX +echo Done Checking imapsync.exe diff --git a/test2.bat b/test2.bat new file mode 100755 index 0000000..99adbae --- /dev/null +++ b/test2.bat @@ -0,0 +1,8 @@ + + +cd C:\msys\1.0\home\Admin\imapsync +perl -mMail::IMAPClient -mDigest::MD5 -mTerm::ReadKey -mIO::Socket::SSL -mFile::Spec -mDigest::HMAC_MD5 -e '' + +.\imapsync.exe --host1 l --user1 toto --passfile1 secret.toto --host2 l --user2 titi --passfile2 secret.titi --noauthmd5 --delete2 --expunge2 +.\imapsync.exe --host1 l --user1 tata --passfile1 secret.tata --host2 l --user2 titi --passfile2 secret.titi --noauthmd5 --delete2 --expunge2 --folder INBOX + diff --git a/tests.sh b/tests.sh index c06746f..d41aa6a 100644 --- a/tests.sh +++ b/tests.sh @@ -1,6 +1,6 @@ #!/bin/sh -# $Id: tests.sh,v 1.109 2010/07/16 23:28:12 gilles Exp gilles $ +# $Id: tests.sh,v 1.110 2010/08/15 11:10:04 gilles Exp gilles $ # Example: # CMD_PERL='perl -I./Mail-IMAPClient-3.25/lib' sh -x tests.sh @@ -950,7 +950,7 @@ msw() { if can_send; then sendtestmessage toto fi - scp imapsync test.bat \ + scp imapsync test.bat test2.bat\ ../../var/pass/secret.toto \ ../../var/pass/secret.titi \ ../../var/pass/secret.tata \ @@ -960,6 +960,20 @@ msw() { scp Admin@c:'C:/msys/1.0/home/Admin/imapsync/imapsync.exe' . } +msw2() { + if can_send; then + sendtestmessage toto + fi + scp imapsync test2.bat\ + ../../var/pass/secret.toto \ + ../../var/pass/secret.titi \ + ../../var/pass/secret.tata \ + Admin@c:'C:/msys/1.0/home/Admin/imapsync/' + + ssh Admin@c 'C:/msys/1.0/home/Admin/imapsync/test2.bat' +} + +