From 2ca1ed54cb8dc6cb47ab796f23c1d390f562eb76 Mon Sep 17 00:00:00 2001 From: Nick Bebout Date: Fri, 20 Jul 2012 21:18:22 -0500 Subject: [PATCH] 1.498 --- COPYING | 20 +- CREDITS | 10 +- ChangeLog | 48 +- FAQ | 168 +- INSTALL | 25 +- Makefile | 12 +- README | 18 +- TODO | 12 +- VERSION | 2 +- VERSION_EXE | 2 +- W/paypal_reply/memo | 63 +- W/paypal_reply/paypal_bilan | 52 +- .../{paypal_bilan_1.47 => paypal_bilan_1.55} | 55 +- W/paypal_reply/paypal_build_invoices | 65 +- W/paypal_reply/paypal_build_reply | 12 +- W/paypal_reply/paypal_functions | 13 +- imapsync | 183 +- index.shtml | 127 +- patches/imapsync.dave | 5543 +++++++++++++++++ paypal.shtml | 4 +- tests.sh | 99 +- 21 files changed, 6228 insertions(+), 305 deletions(-) rename W/paypal_reply/{paypal_bilan_1.47 => paypal_bilan_1.55} (95%) create mode 100644 patches/imapsync.dave diff --git a/COPYING b/COPYING index 2978491..4ca95cd 100644 --- a/COPYING +++ b/COPYING @@ -1,14 +1,14 @@ - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - Version 2, December 2004 + NO LIMIT PUBLIC LICENSE + Version 0, June 2012 - Copyright (C) 2004 Sam Hocevar - 14 rue de Plaisance, 75014 Paris, France - Everyone is permitted to copy and distribute verbatim or modified - copies of this license document, and changing it is allowed as long - as the name is changed. +Gilles LAMIRAL +La Billais +35580 Baulon +France - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + NO LIMIT PUBLIC LICENSE +Terms and conditions for copying, distribution, modification +or anything else. - 0. You just DO WHAT THE FUCK YOU WANT TO. + 0. No limit to do anything with this work and this license. diff --git a/CREDITS b/CREDITS index 41a8e13..68f1895 100644 --- a/CREDITS +++ b/CREDITS @@ -1,5 +1,5 @@ #!/bin/cat -# $Id: CREDITS,v 1.168 2012/02/19 22:26:00 gilles Exp gilles $ +# $Id: CREDITS,v 1.169 2012/07/19 09:43:09 gilles Exp gilles $ If you want to make a donation to the author, Gilles LAMIRAL, use any of the following ways: @@ -30,13 +30,18 @@ I thank very much all of these people. I thank also very much all people who bought imapsync from the homepage but I don't cite them here. +Peter Fuchs +Contributed by giving the book +30.86 "Designed for Use: Create Usable Interfaces for Applications and the Web" + + Pierre GUILLAUME // e-Lixir Fixed 2 bugs about [Gmail] folder names. one is about $cache_dir and bsd_globs() that needs escaped characters. Second is eval and --delete2foldersonly --delete2foldersbutnot that need also good escaping. Thanks. -? (Found no card in the packet; may be lost since book is damaged, amazon and paper box for an international transported book ...) +Unknown (Found no card in the packet; may be lost since book is damaged, amazon and paper box for an international transported book ...) Contributed by giving the book 87.18 "Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp" @@ -1053,6 +1058,7 @@ Eric Yung Total amount of book prices : c \ +30.86+\ 87.18+\ 19.90+\ 13.59+\ diff --git a/ChangeLog b/ChangeLog index 137a9f6..85e6a58 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,17 +1,57 @@ RCS file: RCS/imapsync,v Working file: imapsync -head: 1.488 +head: 1.498 branch: locks: strict - gilles: 1.488 + gilles: 1.498 access list: symbolic names: keyword substitution: kv -total revisions: 488; selected revisions: 488 +total revisions: 498; selected revisions: 498 description: ---------------------------- -revision 1.488 locked by: gilles; +revision 1.498 locked by: gilles; +date: 2012/07/20 14:28:45; author: gilles; state: Exp; lines: +22 -6 +Added several connection ckecks like old good imapsync-1.181 to imapsync-1.398 +---------------------------- +revision 1.497 +date: 2012/07/14 19:48:04; author: gilles; state: Exp; lines: +43 -28 +Added --authmech PREAUTH capabiliy. (Patch from David Abrahams). +---------------------------- +revision 1.496 +date: 2012/07/12 20:53:49; author: gilles; state: Exp; lines: +12 -11 +Bugfix. Unsubsribe folder before deleting it (can bug sometimes). +---------------------------- +revision 1.495 +date: 2012/07/11 04:56:33; author: gilles; state: Exp; lines: +7 -8 +Bugfix about last patch $h2_total_bytes_duplicate +---------------------------- +revision 1.494 +date: 2012/07/11 03:50:43; author: gilles; state: Exp; lines: +40 -12 +Usability. Use KiB MiB GiB etc in result summary. Patch from Mark Atwood. +---------------------------- +revision 1.493 +date: 2012/06/30 00:28:51; author: gilles; state: Exp; lines: +9 -9 +Bug fix. Port 143 when --ssl and --tls together. +---------------------------- +revision 1.492 +date: 2012/06/29 23:32:04; author: gilles; state: Exp; lines: +7 -7 +Bug fix. Don't filter flag when --nofilterflags is used during the message copy. +---------------------------- +revision 1.491 +date: 2012/06/20 09:53:27; author: gilles; state: Exp; lines: +8 -8 +Added value of internal date in --debug mode. +---------------------------- +revision 1.490 +date: 2012/05/22 21:03:40; author: gilles; state: Exp; lines: +10 -14 +Updated Cyrus info. +---------------------------- +revision 1.489 +date: 2012/05/22 20:54:13; author: gilles; state: Exp; lines: +20 -14 +Print dry mode when expunging. +---------------------------- +revision 1.488 date: 2012/04/15 17:38:21; author: gilles; state: Exp; lines: +8 -8 Reverse patch applied in 1.485 It was "2) eval and --delete2foldersonly --delete2foldersbutnot that need also good escaping." diff --git a/FAQ b/FAQ index 27dab58..d0cfe74 100644 --- a/FAQ +++ b/FAQ @@ -1,5 +1,5 @@ #!/bin/cat -# $Id: FAQ,v 1.106 2012/04/15 19:18:29 gilles Exp gilles $ +# $Id: FAQ,v 1.114 2012/07/19 09:42:13 gilles Exp gilles $ +------------------+ | FAQ for imapsync | @@ -109,7 +109,7 @@ Q. I need to migrate hundred accounts, how can I do? R. If you have many mailboxes to migrate think about a little shell program. Write a file called file.txt (for example) containing users and passwords. -The separator used in this example is ';' +The separator used in this example is ";" The file.txt file contains: @@ -179,6 +179,61 @@ R. Add also --nofoldersizes since the default behavior is to compute folder sizes. Folder sizes are useless for the transfer, just useful to see what has to be done on each folder. +Notes about --useuid + +Case where building the cache first is necessary (to avoid multiples transfers) + +If you run again imapsync with --useuid on a transfert already done without --useuid +then, to avoid messages be copied again, first run imapsync with --usecache +but without --useuid, example scenario: + +A] Running with the default options, I began without --useuid + +1) First run with default options + + imapsync ... + +Too slow, I want to speed up! + +2) Build the cache + + imapsync ... --usecache + +3) Speed up now + + imapsync ... --useuid + +B] I began with --useuid from the first time + +1) First run and next runs with --useuid + + imapsync ... --useuid + + +Inodes number issue + + +The cache is simple, it uses the filsystem natively, +it's just an empty file per message transfered. +When mailboxes are huge the cache can exhaust the number of inodes +allowed in the filesystem, that's a limitation like size but less +often encountered. +On Unix, to predict whether your tmpdir filesystem used by imapsync +will support the whole cache, just run the command "df -i /var/tmp", +if /var/tmp is the --tmpdir argument. +On windows, search and drop me a note about how to count the number +of files allowed in the filesystem. +It seems FAT32 supports 268 435 445 clusters. + +Choosing the number of inodes allowed by a filesystem can be done +at the creation of it with "mkfs -N number-of-inodes ..." + +imapsync can predict how many messages have to be synced with the +option --justfoldersizes (no transfer will be done) + + imapsync ... --justfoldersizes + + ======================================================================= Q. I see warning messages like "Host1 Sent/15 size 1428 ignored (no header so we ignore this message)" @@ -207,16 +262,15 @@ R. - Download latest Mail::IMAPClient 3.xx at - run imapsync with perl and -I option tailing to use the perl module Mail-IMAPClient-3.xx. Example: - perl -I./Mail-IMAPClient-3.30/lib ./imapsync ... + perl -I./Mail-IMAPClient-3.31/lib ./imapsync ... or if imapsync is in directory /path/ - perl -I./Mail-IMAPClient-3.30/lib /path/imapsync ... + perl -I./Mail-IMAPClient-3.31/lib /path/imapsync ... - Look at the script named i3 in the tarball, it can be used to - run imapsync with included Mail-IMAPClient-3.30/ wherever you + run imapsync with included Mail-IMAPClient-3.31/ wherever you unpacked the imapsync tarball - ======================================================================= Q. How can I use imapsync with Mail::IMAPClient 2.2.9 perl module? @@ -442,7 +496,7 @@ Q. How to convert flags with $ to \ character? R. $ and \ are special characters we have to "escape" them. For example to convert flag $label1 to \label1 - imapsync ... --regexflag 's/\$label1/\\label1/g' --debugflags + imapsync ... --regexflag "s/\$label1/\\label1/g" --debugflags ======================================================================= Q. I need to keep only a defind list of flags, how can I do? @@ -622,25 +676,25 @@ want to forward me the output. The way to avoid this problem is by using options --skipheader and --skipsize, like this (avoid headers beginning whith the string "X-"): - imapsync ... --skipheader '^X-' --skipsize + imapsync ... --skipheader "^X-" --skipsize To skip several headers you can use --skipheader one time - imapsync ... --skipheader '^X-|^Status|^Bcc' + imapsync ... --skipheader "^X-|^Status|^Bcc" If you think you have too many header to avoid just use - imapsync ... --useheader 'Message-ID' --skipsize + imapsync ... --useheader "Message-ID" --skipsize Remark. (Trick found by Tomasz Kaczmarski) -Option --useheader 'Message-ID' asks the server to send only header -lines begining with 'Message-ID'. Some (buggy) servers send the whole -header (all lines) instead of the 'Message-ID' line. In that case, a +Option --useheader "Message-ID" asks the server to send only header +lines begining with "Message-ID". Some (buggy) servers send the whole +header (all lines) instead of the "Message-ID" line. In that case, a trick to keep the --useheader filtering behavior is to use --skipheader with a negative lookahead pattern : - imapsync ... --skipheader '^(?!Message-ID)' --skipsize + imapsync ... --skipheader "^(?!Message-ID)" --skipsize Read it as "skip every header except Message-ID". @@ -679,7 +733,7 @@ Q. I want to exclude a folder hierarchy like "public" R. Use: ---exclude '^public\.' +--exclude "^public\." or maybe --exclude '^"public\.' @@ -694,26 +748,39 @@ Q. I want to exclude only INBOX R. Use: - imapsync ... --exclude '^INBOX$' + imapsync ... --exclude "^INBOX$" A good way to see what will be done is to first use: - imapsync ... --exclude '^INBOX$' --justfolders --nofoldersizes --dry + imapsync ... --exclude "^INBOX$" --justfolders --nofoldersizes --dry ====================================================================== -Q. I want the --folder 'MyFolder' option be recursive. +Q. I want the --folder "MyFolder" option be recursive. Two solutions: R1. Use ---folderrec 'MyFolder' +--folderrec "MyFolder" -R2. Use --include '^MyFolder' +R2. Use --include "^MyFolder" Then the folder "MyFolder" and all its subfolders will be handled and only them. +====================================================================== +Q. Migrating to Exchange 201O, messages get date of the transfer, + this is bad for sorting and listing. + +R1. Be sure to have at least Exchange 2010 SP2 Rollup 5 +http://www.tribalchicken.com.au/15-technical/29-imapsync-exchange2010 + +R2. See also the Outlook side (thanks to Martin Hochreiter for this solution) +http://www.howto-outlook.com/faq/archivenotworking.htm +by changing Archive to sent/receive date + +It's often shorter to change one server than thousands clients +so R1 might be easier to do. ====================================================================== Q. How to migrate from or to Exchange 2003 with an admin/authuser @@ -760,9 +827,9 @@ This doesn't work: imapsync ... --user2 user2 --authuser2 admin2 --password2 adminpassword2 ... This might works: - imapsync ... --user2 'domain\admin2\user2' --password2 adminpassword2 ... + imapsync ... --user2 "domain\admin2\user2" --password2 adminpassword2 ... or - imapsync ... --user2 'admin2@domain\user2' --password2 adminpassword2 ... + imapsync ... --user2 "admin2@domain\user2" --password2 adminpassword2 ... where "domain" is set be the user's UPN in Active Directory or the NETBIOS or DNS name of the domain. @@ -770,6 +837,34 @@ or the NETBIOS or DNS name of the domain. The exact format might vary depending on local configuration and you should experiment with the different formats. +A little note from Michael Scherer. +The previous workaround in the FAQ seems to be obsolete. +I can confirm that + + imapsync ... --host2 exchange_server --authmech2 PLAIN \ + --authuser2 admin@domain --user2 user_alias + +is working without any glitches, running Exchange 2010 SP2 here. +Explanation, Exchange knows a) about a username +and b) about a mailNickname which can be different to the username. +As it seems you need to use the mailNickname (e.g. alias) defined +for user2, not the username itself. +http://blogs.technet.com/b/exchange/archive/2004/03/31/105275.aspx + +====================================================================== +Q. How to migrate from or to Office 365 with an admin/authuser account? + +Note from Yago Torres Fernandez: +(a working command using admin/authuser on host2 Office 365) + + imapsync ... --authuser2 user_admin@domain.com --user2 user_to_be_migrated@domain.com ^ + --password2 XXXX --ssl2 --exclude "Shared Folders" ^ + --regextrans2 "s#Trash$#Papelera#" --regextrans2 "s#^Deleted Items$#Papelera#" + +but previous in Office365 you must do something like that, using powershell: + + Add-MailboxPermission -identity user_to_be_migrated@domain.com -user user_admin@domain.com -accessrights fullaccess -inheritancetype all + ====================================================================== Q. How to migrate from uw-imap with an admin/authuser account? @@ -804,7 +899,7 @@ Here is an example: --host2 server2 \ --user2 joe \ --password2 joespassonserver2 \ - --exclude '^user\.' + --exclude "^user\." ====================================================================== Q: How to migrate from Sun Java Enterprise System / Sun One / iPlanet / @@ -856,7 +951,7 @@ to folder INBOX only on host2: imapsync \ ... - --regextrans2 's/(.*)/INBOX/' \ + --regextrans2 "s/(.*)/INBOX/" \ --dry --justfolders 2) See if the output says everything you want imapsync to do, @@ -879,7 +974,7 @@ R. imapsync \ ... - --regextrans2 's/INBOX(.*)/INBOX.Braunschweig$1/' \ + --regextrans2 "s/INBOX(.*)/INBOX.Braunschweig$1/" \ --dry --justfolders 2) See if the output says everything you want imapsync to do, @@ -1081,12 +1176,12 @@ Maybe --subscribe_all will help you to see all migrated folders. ======================================================================= -Q. Synchronising from SmarterMail to XXX +Q. Synchronizing from SmarterMail to XXX imapsync --host1 imap.d1.org --user1 joe --password1 secret1 --sep1 "/" \ --host2 imap.d2.org --user2 joe --password2 secret2 \ --noauthmd5 \ - --prefix1 "Inbox/" \ + --prefix1 "" \ --regextrans2 's#^Inbox$#INBOX#' \ --regextrans2 's#Sent Items$#Sent#' \ --dry --justfolders @@ -1095,7 +1190,7 @@ Maybe add other --regextrans2 to change folder names and see the result. When satisfied, run without --dry --justfolders ======================================================================= -Q. Synchronising from XXX to Gmail +Q. Synchronizing from XXX to Gmail R. There are some details to get the special [Gmail] sub-folders right. Here's an example of migrating an old "Sent" folder to @@ -1107,13 +1202,13 @@ imapsync --host1 mail.oldhost.com \ --host2 imap.gmail.com --ssl2 \ --user2 my_email@gmail.com \ --password2 password \ - --folder 'INBOX.Sent' \ - --regextrans2 's/Sent/Sent Mail/' + --folder "INBOX.Sent" \ + --regextrans2 "s/Sent/Sent Mail/" The same goes for the "All Mail" archive pseudo-folder. ======================================================================= -Q. Synchronising from Gmail to XXX +Q. Synchronizing from Gmail to XXX R. Gmail needs SSL @@ -1146,7 +1241,7 @@ http://biasecurities.com/blog/2009/migrate-email-from-gmail-to-google-apps/ http://www.thamtech.com/blog/2008/03/29/gmail-to-google-apps-email-migration/ ======================================================================= -Q. Synchronising from Yahoo to XXX +Q. Synchronizing from Yahoo to XXX R. Use --host1 imap.mail.yahoo.com --sep1 '/' @@ -1271,6 +1366,15 @@ I encounter many errors like this: R. GroupWise 7 seems buggy. Apply GroupWise 7 support pack 1 +======================================================================= +Q. Migrating from David Tobit V10 + +R. Use the following options : +imapsync ... --prefix1 "" --sep1 / --idatefromheader ^ + --nofoldersizes --useuid + + +======================================================================= ======================================================================= Q. Migrating from David Tobit V8 diff --git a/INSTALL b/INSTALL index 4a976a4..8ea33cd 100644 --- a/INSTALL +++ b/INSTALL @@ -1,4 +1,4 @@ -# $Id: INSTALL,v 1.24 2012/04/13 09:14:22 gilles Exp gilles $ +# $Id: INSTALL,v 1.25 2012/07/19 05:57:14 gilles Exp gilles $ # # INSTALL file for imapsync # imapsync : IMAP sync or copy tool. @@ -71,7 +71,7 @@ Here is some individual module help: http://search.cpan.org/dist/Mail-IMAPClient/ In fact I use both Mail-IMAPClient-2.2.9 and latest Mail-IMAPClient-3.xx - (xx >= 25) To know the version you have on your system try : + (xx >= 31 now) To know the version you have on your system try : perl -mMail::IMAPClient -e 'print $Mail::IMAPClient::VERSION, "\n"' @@ -80,16 +80,21 @@ Here is some individual module help: at least with Mail-IMAPClient-3.25 (previous may bug). Don't hesitate to use latest Mail-IMAPClient-3.xx + Look at the script named i3 in the tarball, it can be used to + run imapsync with included Mail-IMAPClient-3.31/ wherever you + unpacked the imapsync tarball. + + - Perl Digest::MD5 module. try: perl -mDigest::MD5 http://search.cpan.org/ - http://search.cpan.org/~gaas/Digest-MD5-2.36/ + http://search.cpan.org/~gaas/Digest-MD5-2.52/ To know the version you have on your system try : perl -mDigest::MD5 -e 'print $Digest::MD5::VERSION, "\n"' - I use 2.36 (debian etch package) + I use 2.39 (Ubuntu package) - Term::ReadKey perl -mTerm::ReadKey -e '' @@ -146,7 +151,7 @@ To see what will be done, just run: make -n install -To install imapsync, just run (as root): +To install imapsync in /usr/bin/ and man page in /usr/share/man/man1/, just run (as root): make install @@ -155,15 +160,19 @@ or copy the file imapsync where you want it to be. TESTING on Unix --------------- -The test will break as they are home specific. +Tests will break as they are home specific. You need a running imap server on localhost with several accounts toto with a password located in the file $HOME/var/pass/secret.toto titi with a password located in the file $HOME/var/pass/secret.titi tata with a password located in the file $HOME/var/pass/secret.tata -Of course, you can change the file tests.sh and run the tests with : +Of course, you can change the file tests.sh and run tests with: -sh -x tests.sh + sh -x tests.sh + +Specific tests can be run by using them as argument to tests.sh: + + sh -x tests.sh ll_ssl_justconnect ll_bad_host ... The tests.sh script break on first failure ("set -e" directive). diff --git a/Makefile b/Makefile index 1a9696c..aac21ce 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -# $Id: Makefile,v 1.94 2012/04/15 19:19:14 gilles Exp gilles $ +# $Id: Makefile,v 1.95 2012/07/19 05:58:22 gilles Exp gilles $ .PHONY: help usage all @@ -282,11 +282,11 @@ upload_lfo: /home/gilles/public_html/www.linux-france.org/html/prj/imapsync/.htaccess sh ~/memo/lfo-rsync -upload_index: index.shtml FAQ - validate --verbose index.shtml - rcsdiff index.shtml - rsync -avH index.shtml FAQ root@ks.lamiral.info:/var/www/imapsync/ - rsync -avH index.shtml FAQ \ +upload_index: index.shtml FAQ paypal.shtml + validate --verbose index.shtml paypal.shtml + rcsdiff index.shtml paypal.shtml FAQ + rsync -avH index.shtml FAQ paypal.shtml root@ks.lamiral.info:/var/www/imapsync/ + rsync -avH index.shtml FAQ paypal.shtml \ ../../public_html/www.linux-france.org/html/prj/imapsync/ sh $(HOME)/memo/lfo-rsync diff --git a/README b/README index cd11de3..8144986 100644 --- a/README +++ b/README @@ -3,7 +3,7 @@ NAME Synchronise mailboxes between two imap servers. Good at IMAP migration. More than 44 different IMAP server softwares supported with success. - $Revision: 1.488 $ + $Revision: 1.498 $ SYNOPSIS To synchronise imap account "foo" on "imap.truc.org" to imap account @@ -314,14 +314,10 @@ IMAP SERVERS - Courier IMAP 1.5.1, 2.2.0, 2.1.1, 2.2.1, 3.0.8, 3.0.3, 4.1.1 (GPL) (http://www.courier-mta.org/) - Critical Path (7.0.020) - - Cyrus IMAP 1.5, 1.6, 2.1, 2.1.15, 2.1.16, 2.1.18 - 2.2.1, 2.2.2-BETA, 2.2.10, 2.2.12, - v2.2.3-Invoca-RPM-2.2.3-8, - 2.3-alpha (OSI Approved), - v2.2.12-Invoca-RPM-2.2.12-3.RHEL4.1, - 2.2.13, - v2.3.1-Invoca-RPM-2.3.1-2.7.fc5, - v2.3.7, + - Cyrus IMAP 1.5, 1.6, + 2.1, 2.1.15, 2.1.16, 2.1.18 + 2.2.1, 2.2.2-BETA, 2.2.3, 2.2.6, 2.2.10, 2.2.12, 2.2.13, + 2.3-alpha (OSI Approved), 2.3.1, 2.3.7, 2.3.16 (http://asg.web.cmu.edu/cyrus/) - David Tobit V8 (proprietary Message system). - DBMail 1.2.1, 2.0.4, 2.0.9, 2.2rc1 (GPL) (http://www.dbmail.org/). @@ -342,7 +338,7 @@ IMAP SERVERS - Kerio 7.2.0 Patch 1 [host1] [host2] - MailEnable 4.23 [host1] [host2], 4.26 [host1][host2], 5 [host1] - MDaemon 7.0.1, 8.0.2, 8.1, 9.5.4 (Windows server 2003 R2 platform), 12 [host2], - 12.0.3 [host1] + 12.0.3 [host1], 12.5.5 [host1], - Mercury 4.1 (Windows server 2000 platform) - Microsoft Exchange Server 5.5, 6.0.6249.0[host1], 6.0.6487.0[host1], 6.5.7638.1 [host2], 6.5 [host1], Exchange 2007 SP1 (with Update Rollup 2), @@ -444,5 +440,5 @@ SIMILAR SOFTWARES Feedback (good or bad) will often be welcome. - $Id: imapsync,v 1.488 2012/04/15 17:38:21 gilles Exp gilles $ + $Id: imapsync,v 1.498 2012/07/20 14:28:45 gilles Exp gilles $ diff --git a/TODO b/TODO index 5f6f773..9f08ee0 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,5 @@ #!/bin/cat -# $Id: TODO,v 1.111 2012/04/15 19:18:54 gilles Exp gilles $ +# $Id: TODO,v 1.112 2012/07/19 09:41:54 gilles Exp gilles $ TODO file for imapsync ---------------------- @@ -19,6 +19,10 @@ Evaluate http://www.rackspace.com/apps/email_hosting/migrations http://www.yippiemove.com/ http://www.migrationwiz.com/ +http://www.microsoft.com/download/en/details.aspx?id=1329 "Microsoft Transporter Suite" + +Fix bug found by Pavel Stano on 01/06/2012 (june) imapsync never stop login +when login fails with a "* BYE Temp error" from server. Consider /var/tmp/ instead of /tmp (/tmp is destoyed on some Unix at reboot) @@ -161,6 +165,12 @@ http://asg.web.cmu.edu/cyrus/download/imapd/altnamespace.html =========================================================================== +DONE. Add a note about +"One other thing: You might want to warn idiots like me, that if your +cache resides on a filesystem with a limited number of inodes such as +ext4, your inodes will be exhausted really fast (check with df -i). I +now use a dedicated partition with reiserfs." + DONE. Add an option --exitwhenover 2500000000 to avoid to be banned or locked http://support.google.com/a/bin/answer.py?hl=en&answer=1071518 diff --git a/VERSION b/VERSION index 17e1788..a93ebe0 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.488 +1.498 diff --git a/VERSION_EXE b/VERSION_EXE index 17e1788..a93ebe0 100644 --- a/VERSION_EXE +++ b/VERSION_EXE @@ -1 +1 @@ -1.488 +1.498 diff --git a/W/paypal_reply/memo b/W/paypal_reply/memo index 9a97a6f..f20b525 100644 --- a/W/paypal_reply/memo +++ b/W/paypal_reply/memo @@ -1,16 +1,67 @@ #!/bin/sh -# $Id: memo,v 1.6 2012/02/24 12:23:38 gilles Exp gilles $ +# $Id: memo,v 1.9 2012/07/05 20:37:53 gilles Exp gilles $ -echo paypal_bilan_tests_invoice -paypal_bilan_tests_invoice() { -# DID output no diff between paypal_bilan_1.47 and 1.48 +echo paypal_bilan_todo +paypal_bilan_todo() { +cat < prestation hors France pour +- Article 259 B-1 Cessions de droits de licences +- Article 259 B-4 Prestations des conseillers, ingénieurs dans tous les domaines +- Article 259 B-5 Traitement de données et fournitures d information + +Hors Europe : Article 262 => Exoneration +- Article 262-1 les livraisons de biens expédiés par le vendeur [...] ainsi que les prestations de services directement liées à l exportation ; +- Article 262-2 les livraisons de biens expédiés ou transportés par l acheteur [...] ainsi que les prestations de services directement liées à l exportation. + +Europe a un autre assujetti : Article 262 ter => Exoneration +- Article 262 ter-1 sur livraisons de biens expédiés. Question : oeuvre immaterielle, service ? + + + +EOF +} + +echo paypal_bilan_tests_tva +paypal_bilan_tests_tva() { +# DID output no diff between paypal_bilan_1.55 and 1.5? ( #set -x -/g/public_html/imapsync/W/paypal_reply/paypal_bilan_1.47 --bnc --debug --debug_invoice --first_in 147 --avoid_numbers '292 293 643 644 731 732 1093 1330 1331 1332 1333 1334' /g/paypal/paypal_201?_??_complet.csv \ +/g/public_html/imapsync/W/paypal_reply/paypal_bilan_1.55 --bnc --debug --debug_invoice --first_in 147 \ + --avoid_numbers '292 293 643 644 731 732 1093 1330 1331 1332 1333 1334 1652 1653' \ + /g/paypal/paypal_201?_??_complet.csv \ > /g/var/paypal_bilan/tests/paypal_invoice.out1 2>&1 -/g/public_html/imapsync/W/paypal_reply/paypal_bilan --bnc --debug --debug_invoice --first_in 147 --avoid_numbers '292 293 643 644 731 732 1093 1330 1331 1332 1333 1334' /g/paypal/paypal_201?_??_complet.csv \ + +/g/public_html/imapsync/W/paypal_reply/paypal_bilan --bnc --debug --debug_invoice --first_in 147 \ + --avoid_numbers '292 293 643 644 731 732 1093 1330 1331 1332 1333 1334 1652 1653' \ + /g/paypal/paypal_201?_??_complet.csv \ + > /g/var/paypal_bilan/tests/paypal_invoice.out2 2>&1 + +echo diff /g/var/paypal_bilan/tests/paypal_invoice.out1 /g/var/paypal_bilan/tests/paypal_invoice.out2 + diff /g/var/paypal_bilan/tests/paypal_invoice.out1 /g/var/paypal_bilan/tests/paypal_invoice.out2 +) +} + + +#echo paypal_bilan_tests_invoice +paypal_bilan_tests_invoice() { +# DID output no diff between paypal_bilan_1.53 and 1.53 +( +#set -x +/g/public_html/imapsync/W/paypal_reply/paypal_bilan_1.52 --bnc --debug --debug_invoice --first_in 147 \ + --avoid_numbers '292 293 643 644 731 732 1093 1330 1331 1332 1333 1334 1652 1653' \ + /g/paypal/paypal_201?_??_complet.csv \ + > /g/var/paypal_bilan/tests/paypal_invoice.out1 2>&1 + +/g/public_html/imapsync/W/paypal_reply/paypal_bilan --bnc --debug --debug_invoice --first_in 147 \ + --avoid_numbers '292 293 643 644 731 732 1093 1330 1331 1332 1333 1334 1652 1653' \ + /g/paypal/paypal_201?_??_complet.csv \ > /g/var/paypal_bilan/tests/paypal_invoice.out2 2>&1 echo diff /g/var/paypal_bilan/tests/paypal_invoice.out1 /g/var/paypal_bilan/tests/paypal_invoice.out2 diff --git a/W/paypal_reply/paypal_bilan b/W/paypal_reply/paypal_bilan index 92cc7e6..446da29 100755 --- a/W/paypal_reply/paypal_bilan +++ b/W/paypal_reply/paypal_bilan @@ -1,6 +1,6 @@ #!/usr/bin/perl -# $Id: paypal_bilan,v 1.48 2012/04/15 09:24:49 gilles Exp gilles $ +# $Id: paypal_bilan,v 1.56 2012/07/16 21:57:51 gilles Exp gilles $ use strict; use warnings; @@ -13,6 +13,11 @@ use Test::More 'no_plan' ; die unless (utf8_supported_charset('ISO-8859-1')); +my $rcs = '$Id: paypal_bilan,v 1.56 2012/07/16 21:57:51 gilles Exp gilles $ ' ; +$rcs =~ m/,v (\d+\.\d+)/ ; +my $VERSION = ($1) ? $1: "UNKNOWN" ; + + my $total_usd_received = 0 ; my $total_usd_invoice = 0 ; my $total_HT_EUR_exo = 0 ; @@ -140,7 +145,7 @@ foreach my $invoice ( @invoices_wanted ) { if ( $invoice_sent ) { $invoice_sent{ $invoice }++ ; #build_invoice( $invoice ) ; - }else{ + }elsif( not ( $invoice_canceled{ $invoice } or $invoice_refund{ $invoice } ) ) { $invoice_not_sent{ $invoice }++ ; build_invoice( $invoice ) ; } @@ -154,6 +159,9 @@ my @invoice_canceled = sort { $a <=> $b } keys( %invoice_canceled ) ; my @invoice_suspended = sort { $a <=> $b } keys( %invoice_suspended ) ; my @invoice_refund = sort { $a <=> $b } keys( %invoice_refund ) ; +print( "\n", "=" x 60, "\n" ) if $bnc ; + + print "USD banque $total_usd_received\n" ; print "USD invoice $total_usd_invoice\n" ; my $total_eur_from_usd ; @@ -180,9 +188,9 @@ print "EUR total TVA $total_TVA_EUR\n" ; print "EUR total HT sup $total_HT_EUR_sup\n" ; print "EUR total TVA sup $total_TVA_EUR_sup\n" ; print "Nb invoice $nb_invoice ( from $first_invoice_paypal to $last_invoice )\n" ; -print "Nb invoice canceled $nb_invoice_canceled @invoice_canceled\n" ; -print "Nb invoice suspended $nb_invoice_suspended @invoice_suspended\n" ; -print "Nb invoice refund $nb_invoice_refund @invoice_refund\n" ; +print "Nb invoice canceled ($nb_invoice_canceled) @invoice_canceled\n" ; +print "Nb invoice suspended ($nb_invoice_suspended) @invoice_suspended\n" ; +print "Nb invoice refund ($nb_invoice_refund) @invoice_refund\n" ; print "Nb invoice sent $nb_invoice_sent\n" ; print "Have to send invoices @invoice_not_sent\n" if ( @invoice_not_sent ) ; @@ -479,9 +487,10 @@ sub compute_line { $IND_flag = ' IND' if ('imapsync usage' eq $Nom_Option_1 and 'individual' eq $Valeur_Option_1 ) ; my $SUPPORT_flag = '' ; $SUPPORT_flag = ' support' if ( 'imapsync support' eq $Titre_de_l_objet ) ; - print "FE $invoice$FR_flag$IND_flag\n" ; + #print "FE $invoice$FR_flag$IND_flag\n" ; + #printf( "%.2f [EUR %.2f]\n", $Montant, $MontantEUR ) ; print "FE $invoice$FR_flag$IND_flag imapsync$SUPPORT_flag $Nom\n" ; - printf( "%.2f [EUR %.2f]\n", $Montant, $MontantEUR ) ; + print "[$Date]$FR_flag$IND_flag $MontantEUR $Devise \n" ; } } @@ -589,7 +598,8 @@ sub build_invoice { $priceTTC, $messageTVAFR, $messageTVAEN, - $priceTTCusd + $priceTTCusd, + $HTorTTC ) = tva_stuff( $clientTypeEN, $Pays, $Hors_taxe, $Devise, $Titre_de_l_objet ) ; @@ -600,7 +610,7 @@ sub build_invoice { my ( $Nom1 ) = cut( $Nom, 42 ) ; my $tex_variables = qq{ -%% Begin input from paypal_bilan +%% Begin input from paypal_bilan $VERSION \\providecommand{\\invoiceNumber}{$invoice} \\providecommand{\\clientName}{$Nom1} \\providecommand{\\clientEmail}{$De_l_adresse_email} @@ -610,6 +620,7 @@ sub build_invoice { \\providecommand{\\clientAdrD}{$clientAdrD} \\providecommand{\\clientAdrE}{$clientAdrE} \\providecommand{\\clientAdrF}{$clientAdrF} +\\providecommand{\\clientVAT}{} \\providecommand{\\invoiceDate}{$Date} \\providecommand{\\invoiceHour}{$Heure} @@ -623,6 +634,7 @@ sub build_invoice { \\providecommand{\\tvaFR}{$tvaFR} \\providecommand{\\tvaEN}{$tvaEN} \\providecommand{\\priceTVA}{$priceTVA} +\\providecommand{\\HTorTTC}{$HTorTTC} \\providecommand{\\priceTTC}{$priceTTC} \\providecommand{\\priceTTCusd}{$priceTTCusd} \\providecommand{\\messageTVAFR}{$messageTVAFR} @@ -995,6 +1007,7 @@ sub tva_stuff { $priceTTC, $messageTVAFR, $messageTVAEN, + $HTorTTC ) ; if ( ( 'individual' eq $clientTypeEN) @@ -1008,16 +1021,18 @@ sub tva_stuff { $tvaEN = ''; $priceTVA = sprintf('%2.2f', $Hors_taxe/1.196*0.196) ; $priceTTC = sprintf('%2.2f', $Hors_taxe) ; - $messageTVAFR = ''; - $messageTVAEN = ''; + $HTorTTC = 'TTC' ; + $messageTVAFR = '' ; + $messageTVAEN = '' ; }else{ $priceHT = sprintf('%2.2f', $Hors_taxe) ; - $tvaFR = 'néant'; - $tvaEN = '(none)'; - $priceTVA = 0 ; - $priceTTC = $priceHT; - $messageTVAFR = 'Exonération de TVA, article 259 B-1 du Code Général des Impôts'; - $messageTVAEN = '(VAT tax-exempt, article 259 B-1 French General Tax Code)'; + $tvaFR = '' ; + $tvaEN = '' ; + $priceTVA = 'néant (none)' ; + $priceTTC = $priceHT ; + $HTorTTC = 'HT' ; + $messageTVAFR = 'Exonération de TVA, articles 262 1-2 du Code Général des Impôts'; + $messageTVAEN = '(VAT tax-exempt, articles 262 1-2 French General Tax Code)'; } foreach my $price ( $priceHT, $priceTVA, $priceTTC, $priceTTCusd ) { #print "[$price]\n" ; @@ -1031,7 +1046,8 @@ sub tva_stuff { $priceTTC, $messageTVAFR, $messageTVAEN, - $priceTTCusd + $priceTTCusd, + $HTorTTC ) ; } diff --git a/W/paypal_reply/paypal_bilan_1.47 b/W/paypal_reply/paypal_bilan_1.55 similarity index 95% rename from W/paypal_reply/paypal_bilan_1.47 rename to W/paypal_reply/paypal_bilan_1.55 index db7df17..3e60044 100755 --- a/W/paypal_reply/paypal_bilan_1.47 +++ b/W/paypal_reply/paypal_bilan_1.55 @@ -1,6 +1,6 @@ #!/usr/bin/perl -# $Id: paypal_bilan,v 1.47 2012/02/24 12:22:05 gilles Exp gilles $ +# $Id: paypal_bilan,v 1.55 2012/07/16 19:33:46 gilles Exp gilles $ use strict; use warnings; @@ -13,6 +13,11 @@ use Test::More 'no_plan' ; die unless (utf8_supported_charset('ISO-8859-1')); +my $rcs = '$Id: paypal_bilan,v 1.55 2012/07/16 19:33:46 gilles Exp gilles $ ' ; +$rcs =~ m/,v (\d+\.\d+)/ ; +my $VERSION = ($1) ? $1: "UNKNOWN" ; + + my $total_usd_received = 0 ; my $total_usd_invoice = 0 ; my $total_HT_EUR_exo = 0 ; @@ -140,7 +145,7 @@ foreach my $invoice ( @invoices_wanted ) { if ( $invoice_sent ) { $invoice_sent{ $invoice }++ ; #build_invoice( $invoice ) ; - }else{ + }elsif( not ( $invoice_canceled{ $invoice } or $invoice_refund{ $invoice } ) ) { $invoice_not_sent{ $invoice }++ ; build_invoice( $invoice ) ; } @@ -154,6 +159,9 @@ my @invoice_canceled = sort { $a <=> $b } keys( %invoice_canceled ) ; my @invoice_suspended = sort { $a <=> $b } keys( %invoice_suspended ) ; my @invoice_refund = sort { $a <=> $b } keys( %invoice_refund ) ; +print( "\n", "=" x 60, "\n" ) if $bnc ; + + print "USD banque $total_usd_received\n" ; print "USD invoice $total_usd_invoice\n" ; my $total_eur_from_usd ; @@ -180,9 +188,9 @@ print "EUR total TVA $total_TVA_EUR\n" ; print "EUR total HT sup $total_HT_EUR_sup\n" ; print "EUR total TVA sup $total_TVA_EUR_sup\n" ; print "Nb invoice $nb_invoice ( from $first_invoice_paypal to $last_invoice )\n" ; -print "Nb invoice canceled $nb_invoice_canceled @invoice_canceled\n" ; -print "Nb invoice suspended $nb_invoice_suspended @invoice_suspended\n" ; -print "Nb invoice refund $nb_invoice_refund @invoice_refund\n" ; +print "Nb invoice canceled ($nb_invoice_canceled) @invoice_canceled\n" ; +print "Nb invoice suspended ($nb_invoice_suspended) @invoice_suspended\n" ; +print "Nb invoice refund ($nb_invoice_refund) @invoice_refund\n" ; print "Nb invoice sent $nb_invoice_sent\n" ; print "Have to send invoices @invoice_not_sent\n" if ( @invoice_not_sent ) ; @@ -477,9 +485,12 @@ sub compute_line { $FR_flag = ' FR' if $Pays eq 'France' ; my $IND_flag = '' ; $IND_flag = ' IND' if ('imapsync usage' eq $Nom_Option_1 and 'individual' eq $Valeur_Option_1 ) ; - print "FE $invoice$FR_flag$IND_flag\n" ; - print "FE $invoice$FR_flag$IND_flag imapsync $Nom\n" ; - printf( "%.2f [EUR %.2f]\n", $Montant, $MontantEUR ) ; + my $SUPPORT_flag = '' ; + $SUPPORT_flag = ' support' if ( 'imapsync support' eq $Titre_de_l_objet ) ; + #print "FE $invoice$FR_flag$IND_flag\n" ; + #printf( "%.2f [EUR %.2f]\n", $Montant, $MontantEUR ) ; + print "FE $invoice$FR_flag$IND_flag imapsync$SUPPORT_flag $Nom\n" ; + print "[$Date]$FR_flag$IND_flag $MontantEUR $Devise \n" ; } } @@ -587,7 +598,8 @@ sub build_invoice { $priceTTC, $messageTVAFR, $messageTVAEN, - $priceTTCusd + $priceTTCusd, + $HTorTTC ) = tva_stuff( $clientTypeEN, $Pays, $Hors_taxe, $Devise, $Titre_de_l_objet ) ; @@ -598,7 +610,7 @@ sub build_invoice { my ( $Nom1 ) = cut( $Nom, 42 ) ; my $tex_variables = qq{ -%% Begin input from paypal_bilan +%% Begin input from paypal_bilan $VERSION \\providecommand{\\invoiceNumber}{$invoice} \\providecommand{\\clientName}{$Nom1} \\providecommand{\\clientEmail}{$De_l_adresse_email} @@ -621,6 +633,7 @@ sub build_invoice { \\providecommand{\\tvaFR}{$tvaFR} \\providecommand{\\tvaEN}{$tvaEN} \\providecommand{\\priceTVA}{$priceTVA} +\\providecommand{\\HTorTTC}{$HTorTTC} \\providecommand{\\priceTTC}{$priceTTC} \\providecommand{\\priceTTCusd}{$priceTTCusd} \\providecommand{\\messageTVAFR}{$messageTVAFR} @@ -993,6 +1006,7 @@ sub tva_stuff { $priceTTC, $messageTVAFR, $messageTVAEN, + $HTorTTC ) ; if ( ( 'individual' eq $clientTypeEN) @@ -1006,16 +1020,18 @@ sub tva_stuff { $tvaEN = ''; $priceTVA = sprintf('%2.2f', $Hors_taxe/1.196*0.196) ; $priceTTC = sprintf('%2.2f', $Hors_taxe) ; - $messageTVAFR = ''; - $messageTVAEN = ''; + $HTorTTC = 'TTC' ; + $messageTVAFR = '' ; + $messageTVAEN = '' ; }else{ $priceHT = sprintf('%2.2f', $Hors_taxe) ; - $tvaFR = 'néant'; - $tvaEN = '(none)'; - $priceTVA = 0 ; - $priceTTC = $priceHT; - $messageTVAFR = 'Exonération de TVA, article 259 B-1 du Code Général des Impôts'; - $messageTVAEN = '(VAT tax-exempt, article 259 B-1 French General Tax Code)'; + $tvaFR = '' ; + $tvaEN = '' ; + $priceTVA = 'néant (none)' ; + $priceTTC = $priceHT ; + $HTorTTC = 'HT' ; + $messageTVAFR = 'Exonération de TVA, articles 262 1-2 du Code Général des Impôts'; + $messageTVAEN = '(VAT tax-exempt, articles 262 1-2 French General Tax Code)'; } foreach my $price ( $priceHT, $priceTVA, $priceTTC, $priceTTCusd ) { #print "[$price]\n" ; @@ -1029,7 +1045,8 @@ sub tva_stuff { $priceTTC, $messageTVAFR, $messageTVAEN, - $priceTTCusd + $priceTTCusd, + $HTorTTC ) ; } diff --git a/W/paypal_reply/paypal_build_invoices b/W/paypal_reply/paypal_build_invoices index 49425dc..410b055 100755 --- a/W/paypal_reply/paypal_build_invoices +++ b/W/paypal_reply/paypal_build_invoices @@ -1,6 +1,6 @@ #!/bin/sh -# $Id: paypal_build_invoices,v 1.29 2012/04/13 10:42:44 gilles Exp gilles $ +# $Id: paypal_build_invoices,v 1.34 2012/07/16 14:00:28 gilles Exp gilles $ # usage: sh paypal_build_invoices /g/var/paypal_invoices/???? @@ -25,7 +25,10 @@ set -x #/g/public_html/imapsync/W/paypal_reply/paypal_bilan --write_invoices --first_in 1335 /g/paypal/paypal_2012_01_complet.csv #/g/public_html/imapsync/W/paypal_reply/paypal_bilan --write_invoices --first_in 1417 /g/paypal/paypal_2012_02_complet.csv #/g/public_html/imapsync/W/paypal_reply/paypal_bilan --write_invoices --first_in 1508 /g/paypal/paypal_2012_03_complet.csv -/g/public_html/imapsync/W/paypal_reply/paypal_bilan --write_invoices --first_in 1575 /g/paypal/paypal_2012_04_complet.csv +#/g/public_html/imapsync/W/paypal_reply/paypal_bilan --write_invoices --first_in 1575 /g/paypal/paypal_2012_04_complet.csv +#/g/public_html/imapsync/W/paypal_reply/paypal_bilan --write_invoices --first_in 1654 /g/paypal/paypal_2012_05_complet.csv +/g/public_html/imapsync/W/paypal_reply/paypal_bilan --write_invoices --first_in 1743 /g/paypal/paypal_2012_06_complet.csv +/g/public_html/imapsync/W/paypal_reply/paypal_bilan --write_invoices --first_in 1824 /g/paypal/paypal_2012_07_complet.csv : /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 147 /g/paypal/paypal_2010_11_complet.csv : /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 214 /g/paypal/paypal_2010_12_complet.csv @@ -37,29 +40,32 @@ set -x : /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 733 --usdeur 1.4395 /g/paypal/paypal_2011_06_complet.csv : /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 824 --usdeur 1.4496 /g/paypal/paypal_2011_07_complet.csv : /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 917 --usdeur 1.4397 /g/paypal/paypal_2011_08_complet.csv -: /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 1094 --usdeur 1.4380 /g/paypal/paypal_2011_10_complet.csv -: /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 1185 --usdeur 1.3387 /g/paypal/paypal_2011_11_complet.csv -: /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 1263 --usdeur 1.3856 /g/paypal/paypal_2011_12_complet.csv -: /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 1335 /g/paypal/paypal_2012_01_complet.csv +: /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 999 --usdeur 1.4380 /g/paypal/paypal_2011_09_complet.csv +: /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 1094 --usdeur 1.3387 /g/paypal/paypal_2011_10_complet.csv +: /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 1185 --usdeur 1.3856 /g/paypal/paypal_2011_11_complet.csv +: /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 1263 --usdeur 1.3438 /g/paypal/paypal_2011_12_complet.csv +: /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 1335 --usdeur 1.2952 /g/paypal/paypal_2012_01_complet.csv : /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 1417 /g/paypal/paypal_2012_02_complet.csv : /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 1508 /g/paypal/paypal_2012_03_complet.csv : /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 1575 /g/paypal/paypal_2012_04_complet.csv +: /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 1654 /g/paypal/paypal_2012_05_complet.csv +: /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 1743 /g/paypal/paypal_2012_06_complet.csv +: /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 1824 /g/paypal/paypal_2012_07_complet.csv + set +x # La totale : || /g/public_html/imapsync/W/paypal_reply/paypal_bilan --bnc --debug \ - --first_in 147 --avoid_numbers '292 293 643 644 731 732 1093 1330 1331 1332 1333 1334' \ + --first_in 147 --avoid_numbers '292 293 643 644 731 732 1093 1330 1331 1332 1333 1334 1652 1653' \ /g/paypal/paypal_201?_??_complet.csv : || /g/public_html/imapsync/W/paypal_reply/paypal_bilan \ - --first_in 147 --avoid_numbers '292 293 643 644 731 732 1093 1330 1331 1332 1333 1334' \ + --first_in 147 --avoid_numbers '292 293 643 644 731 732 1093 1330 1331 1332 1333 1334 1652 1653' \ /g/paypal/paypal_201?_??_complet.csv echo 'sh paypal_build_invoices /g/var/paypal_invoices/1???' - - # USD de 147 à 340 # EUR de 341 à ... @@ -67,43 +73,6 @@ echo 'sh paypal_build_invoices /g/var/paypal_invoices/1???' # 20110412 Found problems with 189 199 242 249 258 263 359 382 537 # cen cen JAP cen cen cen cen TCH JAP # cen -# 155 TVA 1,89 -# 171 TVA 4,42 -# 220 TVA 3,16 -# 225 TVA 3,16 -# 236 TVA 4,42 -# 298 TVA 3,16 -# 307 TVA 4,42 -# 312 TVA 4,42 -# 324 TVA 4,42 -# 351 TVA 4,92 -# 395 TVA 4,92 -# 408 TVA 4,92 -# 419 TVA 4,92 -# 432 TVA 4,92 -# 435 TVA 4,92 -# 452 TVA 4,92 -# 460 TVA 4,92 -# 461 TVA 4,92 -# 463 TVA 4,92 -# 464 TVA 4,92 -# 475 TVA 4,92 -# 487 TVA 4,92 -# 489 TVA 4,92 -# 502 TVA 4,92 -# 504 TVA 4,92 -# 511 TVA 4,92 -# 522 TVA 4,92 -# 523 TVA 4,92 -# 533 TVA 4,92 -# 537 TVA 4,92 -# 540 TVA 4,92 -# 543 TVA 4,92 -# 549 TVA 4,92 -# 551 TVA 4,92 -# 552 TVA 4,92 -# 556 TVA 4,92 -# 563 TVA 4,92 for d in "$@"; do echo "==== $d ====" @@ -118,7 +87,7 @@ for d in "$@"; do rm -f facture_imapsync-$bd.tex cp -f ../facture_imapsync-000.tex facture_imapsync-$bd.tex - if ! pdflatex facture_imapsync-$bd.tex < /dev/null > /dev/null; then + if { ! pdflatex facture_imapsync-$bd.tex < /dev/null > /dev/null || test -f facture_imapsync-${bd}_good.tex ; } then echo "PB $bd" if test -f facture_imapsync-${bd}_good.tex \ && pdflatex facture_imapsync-${bd}_good.tex < /dev/null > /dev/null diff --git a/W/paypal_reply/paypal_build_reply b/W/paypal_reply/paypal_build_reply index 9edf6e1..8ecd969 100755 --- a/W/paypal_reply/paypal_build_reply +++ b/W/paypal_reply/paypal_build_reply @@ -1,6 +1,6 @@ #!/usr/bin/perl -# $Id: paypal_build_reply,v 1.17 2011/12/07 23:47:03 gilles Exp gilles $ +# $Id: paypal_build_reply,v 1.19 2012/04/30 22:57:04 gilles Exp gilles $ use warnings; use strict; @@ -11,7 +11,7 @@ my ($amount, $name, $email); my ( $paypal_line, $paypal_info, $buyer, $description, $object, - $url_source, $url_exe, $url, $release, $release_exe, + $url, $release, $release_exe, ); my $help ; @@ -52,8 +52,6 @@ while(<>) { $release = firstline( '/g/public_html/imapsync/VERSION' ) ; $release_exe = firstline( '/g/public_html/imapsync/VERSION_EXE' ) ; my $path_last = firstline( '/g/public_html/imapsync/dist/path_last.txt' ) ; -$url_source = firstline( '/g/var/paypal_reply/url_source' ) ; -$url_exe = firstline( '/g/var/paypal_reply/url_exe' ) ; $url = "http://ks.lamiral.info/imapsync/dist/$path_last/" ; @@ -99,7 +97,7 @@ while(<>) { my $address = 'gilles.lamiral@laposte.net'; my $address2 = 'gilles@lamiral.info'; -my $rcstag = '$Id: paypal_build_reply,v 1.17 2011/12/07 23:47:03 gilles Exp gilles $'; +my $rcstag = '$Id: paypal_build_reply,v 1.19 2012/04/30 22:57:04 gilles Exp gilles $'; my $download_info = "You will find the latest imapsync.exe binary (release $release_exe) and the latest imapsync source code (release $release) at the following link: @@ -147,7 +145,7 @@ my $subject_support = "[imapsync support] imapsync release $release [$email]" ; my $subject ; my $text ; -if ( 'imapsync support' eq $object ) { +if ( $object =~ m{imapsync support} ) { $text = $text_support ; $subject = $subject_support ; }else{ @@ -194,7 +192,7 @@ EOM print $message; -#print "[$amount] [$name] [$email] [$paypal_line] [$object]\n"; +$debug and print "[$amount] [$name] [$email] [$paypal_line] [$object]\n"; sub firstline { diff --git a/W/paypal_reply/paypal_functions b/W/paypal_reply/paypal_functions index cf0c3b1..acf049c 100755 --- a/W/paypal_reply/paypal_functions +++ b/W/paypal_reply/paypal_functions @@ -1,6 +1,6 @@ #!/bin/sh -# $Id: paypal_functions,v 1.18 2011/12/02 01:56:55 gilles Exp gilles $ +# $Id: paypal_functions,v 1.19 2012/04/17 12:05:32 gilles Exp gilles $ paypal_prerequisites() { perl -mMIME::Lite -e '' || echo 'sudo aptitude install libmime-lite-perl' @@ -105,9 +105,9 @@ convert_utf8() { troncate_last_2_chars() { - length=`expr length "$1"` - length_2=`expr $length - 2` - expr substr "$1" 1 $length_2 + length=`expr length "$1"` + length_2=`expr $length - 2` + expr substr "$1" 1 $length_2 } @@ -115,16 +115,17 @@ build_reply() { mkdir -p $tmpdir/msg_reply/ test -z "`ls $tmpdir/msg_out/`" && echo no mail && return for f in $tmpdir/msg_out_utf8/*/*.txt; do - echo "$f" + #echo "$f" d=`dirname "$f"` bd=`basename "$d"` file_id=`troncate_last_2_chars $bd` d_reply="$tmpdir/msg_reply/$file_id" - test -f "$d_reply/$file_id.txt" && continue + test -s "$d_reply/$file_id.txt" && continue mkdir -p "$d_reply" echo building "$d_reply/$file_id.txt" echo paypal_build_reply "$f" "$tmpdir/msg_id/$file_id" paypal_build_reply "$f" "$tmpdir/msg_id/$file_id" > "$d_reply/$file_id.txt" + test -s "$d_reply/$file_id.txt" || rm "$d_reply/$file_id.txt" done } diff --git a/imapsync b/imapsync index f2c5131..43af7c7 100755 --- a/imapsync +++ b/imapsync @@ -20,7 +20,7 @@ Synchronise mailboxes between two imap servers. Good at IMAP migration. More than 44 different IMAP server softwares supported with success. -$Revision: 1.488 $ +$Revision: 1.498 $ =head1 SYNOPSIS @@ -363,14 +363,10 @@ Success stories reported with the following 44 imap servers - Courier IMAP 1.5.1, 2.2.0, 2.1.1, 2.2.1, 3.0.8, 3.0.3, 4.1.1 (GPL) (http://www.courier-mta.org/) - Critical Path (7.0.020) - - Cyrus IMAP 1.5, 1.6, 2.1, 2.1.15, 2.1.16, 2.1.18 - 2.2.1, 2.2.2-BETA, 2.2.10, 2.2.12, - v2.2.3-Invoca-RPM-2.2.3-8, - 2.3-alpha (OSI Approved), - v2.2.12-Invoca-RPM-2.2.12-3.RHEL4.1, - 2.2.13, - v2.3.1-Invoca-RPM-2.3.1-2.7.fc5, - v2.3.7, + - Cyrus IMAP 1.5, 1.6, + 2.1, 2.1.15, 2.1.16, 2.1.18 + 2.2.1, 2.2.2-BETA, 2.2.3, 2.2.6, 2.2.10, 2.2.12, 2.2.13, + 2.3-alpha (OSI Approved), 2.3.1, 2.3.7, 2.3.16 (http://asg.web.cmu.edu/cyrus/) - David Tobit V8 (proprietary Message system). - DBMail 1.2.1, 2.0.4, 2.0.9, 2.2rc1 (GPL) (http://www.dbmail.org/). @@ -391,7 +387,7 @@ Success stories reported with the following 44 imap servers - Kerio 7.2.0 Patch 1 [host1] [host2] - MailEnable 4.23 [host1] [host2], 4.26 [host1][host2], 5 [host1] - MDaemon 7.0.1, 8.0.2, 8.1, 9.5.4 (Windows server 2003 R2 platform), 12 [host2], - 12.0.3 [host1] + 12.0.3 [host1], 12.5.5 [host1], - Mercury 4.1 (Windows server 2000 platform) - Microsoft Exchange Server 5.5, 6.0.6249.0[host1], 6.0.6487.0[host1], 6.5.7638.1 [host2], 6.5 [host1], Exchange 2007 SP1 (with Update Rollup 2), @@ -519,7 +515,7 @@ Entries for imapsync: Feedback (good or bad) will often be welcome. -$Id: imapsync,v 1.488 2012/04/15 17:38:21 gilles Exp gilles $ +$Id: imapsync,v 1.498 2012/07/20 14:28:45 gilles Exp gilles $ =cut @@ -636,7 +632,7 @@ my( # global variables initialisation -$rcs = '$Id: imapsync,v 1.488 2012/04/15 17:38:21 gilles Exp gilles $ '; +$rcs = '$Id: imapsync,v 1.498 2012/07/20 14:28:45 gilles Exp gilles $ '; $total_bytes_transferred = 0; $total_bytes_skipped = 0; @@ -735,10 +731,10 @@ $split1 ||= 100; $split2 ||= 100; $host1 || missing_option("--host1") ; -$port1 ||= (defined $ssl1 and !defined $tls1) ? 993 : 143; +$port1 ||= ( $ssl1 ) ? 993 : 143; $host2 || missing_option("--host2") ; -$port2 ||= (defined $ssl2 && !defined $tls2) ? 993 : 143; +$port2 ||= ( $ssl2 ) ? 993 : 143; $debugimap1 = $debugimap2 = 1 if ( $debugimap ) ; $debug = 1 if ( $debugimap1 or $debugimap2 ) ; @@ -870,17 +866,21 @@ my %useheader ; print "Host1: imap server [$host1] port [$port1] user [$user1]\n"; print "Host2: imap server [$host2] port [$port2] user [$user2]\n"; -$password1 || $passfile1 || do { - $password1 = ask_for_password($authuser1 || $user1, $host1); -}; +$password1 || $passfile1 || 'PREAUTH' eq $authmech1 || do { + $password1 = ask_for_password( $authuser1 || $user1, $host1 ) ; +} ; -$password1 = (defined($passfile1)) ? firstline ($passfile1) : $password1; +$password1 = ( defined( $passfile1 ) ) ? firstline ( $passfile1 ) : $password1 ; -$password2 || $passfile2 || do { - $password2 = ask_for_password($authuser2 || $user2, $host2); -}; +$password2 || $passfile2 || 'PREAUTH' eq $authmech2 || do { + $password2 = ask_for_password( $authuser2 || $user2, $host2 ) ; +} ; -$password2 = (defined($passfile2)) ? firstline ($passfile2) : $password2; +$password2 = ( defined( $passfile2 ) ) ? firstline ( $passfile2 ) : $password2 ; + + +my $dry_message = '' ; +$dry_message = "\t(not really since --dry mode)" if $dry ; if ( ! ( 1 or ( $maxsize @@ -918,9 +918,9 @@ $debug and print "Host2 Buffer I/O: ", $imap2->Buffer(), "\n"; -die_clean() unless $imap1->IsAuthenticated(); +die_clean( 'Not authenticated on host1' ) unless $imap1->IsAuthenticated( ) ; print "Host1: state Authenticated\n"; -die_clean() unless $imap2->IsAuthenticated(); +die_clean( 'Not authenticated on host2' ) unless $imap2->IsAuthenticated( ) ; print "Host2: state Authenticated\n"; print "Host1 capability: ", join(" ", $imap1->capability_update()), "\n"; @@ -1080,6 +1080,9 @@ print "++++ Looping on each folder\n"; FOLDER: foreach my $h1_fold (@h1_folders_wanted) { + last FOLDER if $imap1->IsUnconnected(); + last FOLDER if $imap2->IsUnconnected(); + my $h2_fold = imap2_folder_name( $h1_fold ) ; #relogin1( ) if ( $relogin1 ) ; printf( "%-35s -> %-35s\n", "[$h1_fold]", "[$h2_fold]" ) ; @@ -1107,7 +1110,7 @@ FOLDER: foreach my $h1_fold (@h1_folders_wanted) { my $permanentflags2 = permanentflags( @select_results ) ; $debug and print "permanentflags: $permanentflags2\n" ; if ( $expunge or $expunge1 ){ - print "Expunging host1 $h1_fold\n" ; + print "Expunging host1 $h1_fold $dry_message\n" ; unless($dry) { $imap1->expunge() } ; #print "Expunging host2 $h2_fold\n" ; #unless($dry) { $imap2->expunge() } ; @@ -1121,6 +1124,9 @@ FOLDER: foreach my $h1_fold (@h1_folders_wanted) { next FOLDER if ($justfolders); + last FOLDER if $imap1->IsUnconnected(); + last FOLDER if $imap2->IsUnconnected(); + my $h1_msgs_all_hash_ref = { } ; my @h1_msgs = select_msgs( $imap1, $h1_msgs_all_hash_ref ); @@ -1141,6 +1147,9 @@ FOLDER: foreach my $h1_fold (@h1_folders_wanted) { my $cache_dir = cache_folder( $cache_base, $h1_fold, $h2_fold ); my ( $cache_1_2_ref, $cache_2_1_ref ) = ( {}, {} ); + last FOLDER if $imap1->IsUnconnected(); + last FOLDER if $imap2->IsUnconnected(); + if ( $usecache ) { print "cache directory: $cache_dir\n" ; mkpath( "$cache_dir" ) ; @@ -1324,7 +1333,7 @@ FOLDER: foreach my $h1_fold (@h1_folders_wanted) { $imap2->uidexpunge( \@h2_expunge ) if ! $dry ; } if ($expunge2){ - print "Expunging host2 folder $h2_fold\n" ; + print "Expunging host2 folder $h2_fold $dry_message\n" ; $imap2->expunge( ) if ! $dry ; } } @@ -1333,12 +1342,15 @@ FOLDER: foreach my $h1_fold (@h1_folders_wanted) { $debug and print "Host2 uidnext: $h2_uidnext\n" ; $h2_uidguess = $h2_uidnext ; MESS: foreach my $m_id (@h1_hash_keys_sorted_by_uid) { + my $h1_size = $h1_hash{$m_id}{'s'}; my $h1_msg = $h1_hash{$m_id}{'m'}; my $h1_idate = $h1_hash{$m_id}{'D'}; unless (exists($h2_hash{$m_id})) { # copy + last FOLDER if $imap1->IsUnconnected(); + last FOLDER if $imap2->IsUnconnected(); copy_message( $h1_msg, $h1_fold, $h2_fold, $h1_fir_ref, $permanentflags2, $cache_dir ) ; last FOLDER if total_bytes_max_reached( ) ; next MESS; @@ -1363,16 +1375,20 @@ FOLDER: foreach my $h1_fold (@h1_folders_wanted) { $debug and print "Host1 size msg $h1_fold/$h1_msg = $h1_size <> $h2_size = Host2 $h2_fold/$h2_msg\n"; if( $delete ) { - print "Host1 msg $h1_fold/$h1_msg deleted\n"; + my $expunge_message = '' ; + $expunge_message = "and expunged" if ( $expunge or $expunge1 ) ; + print "Host1 msg $h1_fold/$h1_msg marked deleted $expunge_message $dry_message\n" ; unless( $dry ) { - $imap1->delete_message( $h1_msg ); - $h1_nb_msg_deleted += 1; - $imap1->expunge() if ( $expunge or $expunge1 ); + $imap1->delete_message( $h1_msg ) ; + $h1_nb_msg_deleted += 1 ; + $imap1->expunge() if ( $expunge or $expunge1 ) ; } } } # END MESS: loop + last FOLDER if $imap1->IsUnconnected(); + last FOLDER if $imap2->IsUnconnected(); MESS_IN_CACHE: foreach my $h1_msg ( @h1_msgs_in_cache ) { my $h2_msg = $cache_1_2_ref->{ $h1_msg } ; $debugcache and print "cache messages update flags $h1_msg->$h2_msg\n"; @@ -1386,16 +1402,18 @@ FOLDER: foreach my $h1_fold (@h1_folders_wanted) { MESS_BY_UID: foreach my $h1_msg ( sort { $a <=> $b } keys %h1_msgs_copy_by_uid ) { # $debug and print "Copy by uid $h1_fold/$h1_msg\n" ; + last FOLDER if $imap1->IsUnconnected(); + last FOLDER if $imap2->IsUnconnected(); copy_message( $h1_msg, $h1_fold, $h2_fold, $h1_fir_ref, $permanentflags2, $cache_dir ) ; last FOLDER if total_bytes_max_reached( ) ; } if ($expunge or $expunge1){ - print "Expunging host1 folder $h1_fold\n"; + print "Expunging host1 folder $h1_fold $dry_message\n"; unless($dry) { $imap1->expunge() }; } if ($expunge2){ - print "Expunging host2 folder $h2_fold\n"; + print "Expunging host2 folder $h2_fold $dry_message\n"; unless($dry) { $imap2->expunge() }; } @@ -1635,7 +1653,10 @@ sub myconnect { $self->Banner($banner); $self->RawSocket2($sock); $self->State(Connected); - + if ($banner =~ /\* PREAUTH/) + { + $self->State(Authenticated); + } if ($self->Tls) { starttls($self); $self->Starttls( 1 ) ; @@ -1663,7 +1684,7 @@ sub starttls { unless ($self->has_capability("STARTTLS")) { die_clean( "No STARTTLS capability" ); } - print $socket, "\n"; + print $socket "z00 STARTTLS\015\012"; CORE::select( undef, undef, undef, 0.025 ); my $txt = $socket->getline(); @@ -1790,6 +1811,15 @@ sub login_imap { print "Banner: ", server_banner($imap); + if ( $authmech eq 'PREAUTH' ) { + if ( $imap->IsAuthenticated( ) ) { + $imap->Socket ; + printf("Info: Assuming PREAUTH for host %s\n", $imap->Server ) ; + }else{ + die_clean( "Failure: error login on [$host] with user [$user] auth [PREAUTH]" ) ; + } + } + if ($imap->has_capability("AUTH=$authmech") or $imap->has_capability($authmech) ) { @@ -1808,7 +1838,7 @@ sub login_imap { if ($proxyauth) { $imap->Authmechanism(""); } else { - $imap->Authmechanism($authmech) unless ($authmech eq 'LOGIN'); + $imap->Authmechanism( $authmech ) unless ( $authmech eq 'LOGIN' or $authmech eq 'PREAUTH' ) ; } $imap->Authcallback(\&plainauth) if $authmech eq "PLAIN"; @@ -1826,17 +1856,20 @@ sub login_imap { $imap->Password($password); } - unless ($imap->login()) { - my $info = "Failure: error login [$host] with user [$user] auth"; - my $einfo = $imap->LastError || @{$imap->History}[-1]; - chomp($einfo); - my $error = "$info [$authmech]: $einfo\n"; - print $error; # note: duplicating error on stdout/stderr - die_clean($error) if ($authmech eq 'LOGIN' or $imap->IsUnconnected() or $authuser); - print "Info: trying LOGIN Auth mechanism on [$host] with user [$user]\n"; - $imap->Authmechanism(""); + unless ( $authmech eq 'PREAUTH' or $imap->login( ) ) { + my $info = "Failure: error login on [$host] with user [$user] auth" ; + my $einfo = $imap->LastError || @{$imap->History}[-1] ; + chomp( $einfo ) ; + my $error = "$info [$authmech]: $einfo\n" ; + if ( $authmech eq 'LOGIN' or $imap->IsUnconnected( ) or $authuser ) { + die_clean( $error ) ; + }else{ + print $error ; + } + print "Info: trying LOGIN Auth mechanism on [$host] with user [$user]\n" ; + $imap->Authmechanism("") ; $imap->login() or - die_clean("$info [LOGIN]: ", $imap->LastError, "\n"); + die_clean("$info [LOGIN]: ", $imap->LastError, "\n") ; } $proxyauth && $imap->proxyauth($user); $split and $imap->Split( $split ) ; @@ -1868,8 +1901,8 @@ sub banner_imapsync { my @argv_copy = @_; my $banner_imapsync = join("", '$RCSfile: imapsync,v $ ', - '$Revision: 1.488 $ ', - '$Date: 2012/04/15 17:38:21 $ ', + '$Revision: 1.498 $ ', + '$Date: 2012/07/20 14:28:45 $ ', "\n",localhost_info(), "\n", "Command line used:\n", "$0 ", command_line_nopassword(@argv_copy), "\n", @@ -2746,7 +2779,7 @@ sub copy_message { $h1_flags =~ s@\\Recent\s?@@gi; $h1_flags = flags_regex($h1_flags) if @regexflag; $h1_flags = flagsCase( $h1_flags ) if $flagsCase ; - $h1_flags = flags_filter($h1_flags, $permanentflags2) if ($permanentflags2); + $h1_flags = flags_filter( $h1_flags, $permanentflags2) if ( $permanentflags2 and $filterflags ) ; my $new_id; $debug and print "msg $h1_fold/$h1_msg date [$h1_date] flags [$h1_flags] size [$h1_size]\n"; @@ -3309,6 +3342,23 @@ sub regexmess { return($string); } +sub bytes_display_string { + my ($bytes) = @_; + + if ($bytes < (1024 * 1024)) { + return sprintf("%.1f KiB", $bytes / 1024); + } elsif ($bytes < (1024 * 1024 * 1024)) { + return sprintf("%.1f MiB", $bytes / (1024 * 1024)); + } elsif ($bytes < (1024 * 1024 * 1024 * 1024)) { + return sprintf("%.1f GiB", $bytes / (1024 * 1024 * 1024)); + } elsif ($bytes < (1024 * 1024 * 1024 * 1024 * 1024)) { + return sprintf("%.1f TiB", $bytes / (1024 * 1024 * 1024 * 1024)); + } else { + return sprintf("%.1f PiB", $bytes / (1024 * 1024 * 1024 * 1024 * 1024)); + } + # if you have exabytes (EiB) of email to transfer, you have too much email +} + sub stats { $timeend = time(); $timediff = $timeend - $timestart; @@ -3337,17 +3387,27 @@ sub stats { print "Messages void (noheader) on host2 : $h2_nb_msg_noheader\n"; print "Messages deleted on host1 : $h1_nb_msg_deleted\n"; print "Messages deleted on host2 : $h2_nb_msg_deleted\n"; - print "Total bytes transferred : $total_bytes_transferred\n"; - print "Total bytes duplicate host1 : $h1_total_bytes_duplicate\n"; - print "Total bytes duplicate host2 : $h2_total_bytes_duplicate\n"; - print "Total bytes skipped : $total_bytes_skipped\n"; - print "Total bytes error : $total_bytes_error\n"; + printf( "Total bytes transferred : %d (%s)\n", + $total_bytes_transferred, + bytes_display_string($total_bytes_transferred)); + printf( "Total bytes duplicate host1 : %d (%s)\n", + $h1_total_bytes_duplicate, + bytes_display_string($h1_total_bytes_duplicate)); + printf( "Total bytes duplicate host2 : %d (%s)\n", + $h2_total_bytes_duplicate, + bytes_display_string($h2_total_bytes_duplicate)); + printf( "Total bytes skipped : %d (%s)\n", + $total_bytes_skipped, + bytes_display_string($total_bytes_skipped)); + printf( "Total bytes error : %d (%s)\n", + $total_bytes_error, + bytes_display_string($total_bytes_error)); $timediff ||= 1; # No division per 0 printf ("Message rate : %.1f messages/s\n", $nb_msg_transferred / $timediff); printf ("Average bandwidth rate : %.1f KiB/s\n", $total_bytes_transferred / 1024 / $timediff); print "Reconnections to host1 : $host1_reconnect_count\n"; print "Reconnections to host2 : $host2_reconnect_count\n"; - printf ("Memory consumption : %.1f MB\n", $memory_consumption / 1024 / 1024); + printf ("Memory consumption : %.1f MiB\n", $memory_consumption / 1024 / 1024); print "Biggest message : $max_msg_size_in_bytes bytes\n"; # print "Memory/biggest message ratio : $memory_ratio\n"; print "Detected $nb_errors errors\n\n"; @@ -3593,7 +3653,7 @@ sub parse_header_msg { my $idate = $s_fir->{$m_uid}->{"INTERNALDATE"}; $size = length($headstr) unless ($size); my $m_md5 = md5_base64($headstr); - $debug and print "$s uid $m_uid sig $m_md5 size $size\n"; + $debug and print "$s uid $m_uid sig $m_md5 size $size idate $idate\n"; my $key; if ($skipsize) { $key = "$m_md5"; @@ -3674,7 +3734,7 @@ sub check_last_release { } sub imapsync_version { - my $rcs = '$Id: imapsync,v 1.488 2012/04/15 17:38:21 gilles Exp gilles $ '; + my $rcs = '$Id: imapsync,v 1.498 2012/07/20 14:28:45 gilles Exp gilles $ '; $rcs =~ m/,v (\d+\.\d+)/; my $VERSION = ($1) ? $1: "UNKNOWN"; return($VERSION); @@ -4270,12 +4330,13 @@ sub delete_folders_in_2_not_in_1 { print "Not deleting $folder because of --delete2foldersbutnot $delete2foldersbutnot\n"; next; } - my $res = $dry; # always success in dry mode! - $res = $imap2->delete($folder) if ( ! $dry ) ; - if ($res) { - print "Delete $folder", "$dry_message", "\n"; + my $res = $dry ; # always success in dry mode! + $imap2->unsubscribe( $folder ) if ( ! $dry ) ; + $res = $imap2->delete( $folder ) if ( ! $dry ) ; + if ( $res ) { + print "Delete $folder", "$dry_message", "\n" ; }else{ - print "Delete $folder failure", "\n"; + print "Delete $folder failure", "\n" ; } } } diff --git a/index.shtml b/index.shtml index 1d795a2..63fe26b 100644 --- a/index.shtml +++ b/index.shtml @@ -5,7 +5,7 @@ Imapsync: an IMAP migration tool ( release <!--#exec cmd="cat VERSION"--> ) - + @@ -63,11 +63,12 @@ for 2 ways synchronizations.

Alternatives to imapsync are listed in the Similar softwares section.

-

Some numbers for 2011

+

Some numbers for 2011 and 2012