From 495d5a95263e9c0ab0426c39e8a675ed2445af0f Mon Sep 17 00:00:00 2001 From: Nick Bebout Date: Sun, 2 Sep 2012 19:04:29 -0500 Subject: [PATCH] 1.500 --- COPYING | 9 +- CREDITS | 6 +- ChangeLog | 18 ++- Makefile | 8 +- README | 4 +- VERSION | 2 +- VERSION_EXE | 2 +- W/paypal_reply/memo | 25 +++- W/paypal_reply/paypal_bilan | 27 ++-- .../{paypal_bilan_1.55 => paypal_bilan_1.56} | 5 +- W/paypal_reply/paypal_build_invoices | 6 +- imapsync | 132 +++++++++++------- index.shtml | 49 +++++-- test2.bat | 9 +- tests.sh | 4 +- 15 files changed, 207 insertions(+), 99 deletions(-) rename W/paypal_reply/{paypal_bilan_1.55 => paypal_bilan_1.56} (99%) diff --git a/COPYING b/COPYING index 4ca95cd..4dde4a0 100644 --- a/COPYING +++ b/COPYING @@ -1,14 +1,15 @@ - NO LIMIT PUBLIC LICENSE - Version 0, June 2012 + NO LIMIT PUBLIC LICENSE + Version 0, June 2012 Gilles LAMIRAL La Billais 35580 Baulon France - NO LIMIT PUBLIC LICENSE + NO LIMIT PUBLIC LICENSE Terms and conditions for copying, distribution, modification or anything else. - 0. No limit to do anything with this work and this license. + 0 No limit to do anything with this work and this license. + 1 GOTO 0 diff --git a/CREDITS b/CREDITS index 68f1895..7b4671a 100644 --- a/CREDITS +++ b/CREDITS @@ -1,5 +1,5 @@ #!/bin/cat -# $Id: CREDITS,v 1.169 2012/07/19 09:43:09 gilles Exp gilles $ +# $Id: CREDITS,v 1.170 2012/08/10 11:29:41 gilles Exp gilles $ If you want to make a donation to the author, Gilles LAMIRAL, use any of the following ways: @@ -30,6 +30,10 @@ 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. + +David Abrahams +Gave a patch for --authmech PREAUTH + Peter Fuchs Contributed by giving the book 30.86 "Designed for Use: Create Usable Interfaces for Applications and the Web" diff --git a/ChangeLog b/ChangeLog index 85e6a58..c166c5f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,17 +1,27 @@ RCS file: RCS/imapsync,v Working file: imapsync -head: 1.498 +head: 1.500 branch: locks: strict - gilles: 1.498 + gilles: 1.500 access list: symbolic names: keyword substitution: kv -total revisions: 498; selected revisions: 498 +total revisions: 500; selected revisions: 500 description: ---------------------------- -revision 1.498 locked by: gilles; +revision 1.500 locked by: gilles; +date: 2012/08/10 04:58:46; author: gilles; state: Exp; lines: +40 -28 +Bugfix. The cache system didn't work in Win32 (problem with \ transformation) +Added option --nocheckselectable to fix INBOX issue with Jana-server. +Documentation. Example for --delete2foldersbutnot +---------------------------- +revision 1.499 +date: 2012/07/30 10:56:26; author: gilles; state: Exp; lines: +45 -31 +Bugfix. Check the return of touch calls. +---------------------------- +revision 1.498 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 ---------------------------- diff --git a/Makefile b/Makefile index aac21ce..7a1d8ca 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -# $Id: Makefile,v 1.95 2012/07/19 05:58:22 gilles Exp gilles $ +# $Id: Makefile,v 1.96 2012/07/29 22:03:29 gilles Exp gilles $ .PHONY: help usage all @@ -284,9 +284,9 @@ upload_lfo: 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 \ + rcsdiff index.shtml paypal.shtml FAQ COPYING + rsync -avH index.shtml FAQ paypal.shtml COPYING root@ks.lamiral.info:/var/www/imapsync/ + rsync -avH index.shtml FAQ paypal.shtml COPYING \ ../../public_html/www.linux-france.org/html/prj/imapsync/ sh $(HOME)/memo/lfo-rsync diff --git a/README b/README index 8144986..27cca89 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.498 $ + $Revision: 1.500 $ SYNOPSIS To synchronise imap account "foo" on "imap.truc.org" to imap account @@ -440,5 +440,5 @@ SIMILAR SOFTWARES Feedback (good or bad) will often be welcome. - $Id: imapsync,v 1.498 2012/07/20 14:28:45 gilles Exp gilles $ + $Id: imapsync,v 1.500 2012/08/10 04:58:46 gilles Exp gilles $ diff --git a/VERSION b/VERSION index a93ebe0..327925c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.498 +1.500 diff --git a/VERSION_EXE b/VERSION_EXE index a93ebe0..327925c 100644 --- a/VERSION_EXE +++ b/VERSION_EXE @@ -1 +1 @@ -1.498 +1.500 diff --git a/W/paypal_reply/memo b/W/paypal_reply/memo index f20b525..490e8ac 100644 --- a/W/paypal_reply/memo +++ b/W/paypal_reply/memo @@ -1,6 +1,6 @@ #!/bin/sh -# $Id: memo,v 1.9 2012/07/05 20:37:53 gilles Exp gilles $ +# $Id: memo,v 1.10 2012/08/10 22:25:31 gilles Exp gilles $ echo paypal_bilan_todo @@ -28,7 +28,28 @@ Europe a un autre assujetti : Article 262 ter => Exoneration EOF } -echo paypal_bilan_tests_tva +echo paypal_bilan_tests_tva_2 +paypal_bilan_tests_tva_2() { +# DID output no diff between paypal_bilan_1.56 and 1.5? +( +#set -x +/g/public_html/imapsync/W/paypal_reply/paypal_bilan_1.56 --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 /g/var/paypal_bilan/tests/paypal_invoice.out1 /g/var/paypal_bilan/tests/paypal_invoice.out2 +) +} + + +#echo paypal_bilan_tests_tva paypal_bilan_tests_tva() { # DID output no diff between paypal_bilan_1.55 and 1.5? ( diff --git a/W/paypal_reply/paypal_bilan b/W/paypal_reply/paypal_bilan index 446da29..9cac50a 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.56 2012/07/16 21:57:51 gilles Exp gilles $ +# $Id: paypal_bilan,v 1.58 2012/08/11 00:01:46 gilles Exp gilles $ use strict; use warnings; @@ -13,7 +13,7 @@ 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 $ ' ; +my $rcs = '$Id: paypal_bilan,v 1.58 2012/08/11 00:01:46 gilles Exp gilles $ ' ; $rcs =~ m/,v (\d+\.\d+)/ ; my $VERSION = ($1) ? $1: "UNKNOWN" ; @@ -103,10 +103,10 @@ foreach my $file ( @files ) { #print $action->{ Nom }, "\n" ; my( $Date, $Heure, $Fuseau_horaire, $Nom, $Type, $Etat, $Devise, $Montant, $Numero_davis_de_reception, $Solde, - $Pays, $Nom_Option_1, $Valeur_Option_1, $Hors_taxe, $Titre_de_l_objet ) + $Pays, $Nom_Option_1, $Valeur_Option_1, $Hors_taxe, $Titre_de_l_objet, $Nom_Option_2, $Option_2_Valeur ) = @action{ ( 'Date', 'Heure', 'Fuseau horaire', 'Nom', 'Type', 'Etat', 'Devise', 'Montant', "Numéro d'avis de réception", 'Solde', - 'Pays', 'Nom Option 1', 'Valeur Option 1', 'Hors taxe', "Titre de l'objet") } ; + 'Pays', 'Nom Option 1', 'Valeur Option 1', 'Hors taxe', "Titre de l'objet", 'Nom Option 2', 'Option 2 Valeur') } ; #print "$Nom\n" ; ( $Etat ) = @action{ ( 'Etat', ) } || @action{ ( 'État' ) } ; my $invoice = 'NONE' ; @@ -509,12 +509,14 @@ sub build_invoice { $De_l_adresse_email, $A_l_adresse_email, $N_de_transaction, $Titre_de_l_objet, $TVA, $Nom_Option_1, $Valeur_Option_1, $N_de_transaction_de_reference, $Adresse_1, $Adresse_2_district_quartier, $Ville, - $Etat_Province, $Code_postal, $Pays, $line_number, $line_csv, $file_csv ) + $Etat_Province, $Code_postal, $Pays, $line_number, $line_csv, $file_csv, + $Nom_Option_2, $Option_2_Valeur ) = @action{ ( 'Date', 'Heure', 'Nom', 'Type', 'Etat', 'Devise', 'Hors taxe', 'Commission', 'Net', "De l'adresse email", "A l'adresse email", 'N° de transaction', "Titre de l'objet", 'TVA', 'Nom Option 1', 'Valeur Option 1', 'Nº de transaction de référence', 'Adresse 1', 'Adresse 2/district/quartier', 'Ville', - 'Etat/Province/Région/Comté/Territoire/Préfecture/République', 'Code postal', 'Pays', 'line_number', 'line_csv', 'file_csv' ) } ; + 'Etat/Province/Région/Comté/Territoire/Préfecture/République', 'Code postal', 'Pays', 'line_number', 'line_csv', 'file_csv', + 'Nom Option 2', 'Option 2 Valeur' ) } ; my( $Etat_Province1 ) = @action{ ( 'Etat/Province/Région/Comté/Territoire/Préfecture/République' ) } ; my( $Etat_Province2 ) = @action{ ( 'État/Province/Région/Comté/Territoire/Préfecture/République' ) } ; @@ -609,6 +611,13 @@ sub build_invoice { #print "ZZZ $object_type ( $urlSrc, $urlExe )\n" ; my ( $Nom1 ) = cut( $Nom, 42 ) ; + + my $clientVAT = '' ; + + if ( ( 'VAT if professional in Europe' eq $Nom_Option_2 ) and $Option_2_Valeur ) { + $clientVAT = $Option_2_Valeur ; + } + my $tex_variables = qq{ %% Begin input from paypal_bilan $VERSION \\providecommand{\\invoiceNumber}{$invoice} @@ -620,7 +629,7 @@ sub build_invoice { \\providecommand{\\clientAdrD}{$clientAdrD} \\providecommand{\\clientAdrE}{$clientAdrE} \\providecommand{\\clientAdrF}{$clientAdrF} -\\providecommand{\\clientVAT}{} +\\providecommand{\\clientVAT}{$clientVAT} \\providecommand{\\invoiceDate}{$Date} \\providecommand{\\invoiceHour}{$Heure} @@ -1031,8 +1040,8 @@ sub tva_stuff { $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)'; + $messageTVAFR = 'Exonération de TVA, articles 262 1-2 et ter du Code Général des Impôts'; + $messageTVAEN = '(VAT tax-exempt, articles 262 1-2 and ter of French General Tax Code)'; } foreach my $price ( $priceHT, $priceTVA, $priceTTC, $priceTTCusd ) { #print "[$price]\n" ; diff --git a/W/paypal_reply/paypal_bilan_1.55 b/W/paypal_reply/paypal_bilan_1.56 similarity index 99% rename from W/paypal_reply/paypal_bilan_1.55 rename to W/paypal_reply/paypal_bilan_1.56 index 3e60044..446da29 100755 --- a/W/paypal_reply/paypal_bilan_1.55 +++ b/W/paypal_reply/paypal_bilan_1.56 @@ -1,6 +1,6 @@ #!/usr/bin/perl -# $Id: paypal_bilan,v 1.55 2012/07/16 19:33:46 gilles Exp gilles $ +# $Id: paypal_bilan,v 1.56 2012/07/16 21:57:51 gilles Exp gilles $ use strict; use warnings; @@ -13,7 +13,7 @@ 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 $ ' ; +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" ; @@ -620,6 +620,7 @@ sub build_invoice { \\providecommand{\\clientAdrD}{$clientAdrD} \\providecommand{\\clientAdrE}{$clientAdrE} \\providecommand{\\clientAdrF}{$clientAdrF} +\\providecommand{\\clientVAT}{} \\providecommand{\\invoiceDate}{$Date} \\providecommand{\\invoiceHour}{$Heure} diff --git a/W/paypal_reply/paypal_build_invoices b/W/paypal_reply/paypal_build_invoices index 410b055..518283d 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.34 2012/07/16 14:00:28 gilles Exp gilles $ +# $Id: paypal_build_invoices,v 1.36 2012/08/10 22:37:18 gilles Exp gilles $ # usage: sh paypal_build_invoices /g/var/paypal_invoices/???? @@ -27,8 +27,9 @@ set -x #/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 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 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 --write_invoices --first_in 1891 /g/paypal/paypal_2012_08_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 @@ -51,6 +52,7 @@ set -x : /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 +: /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 1891 /g/paypal/paypal_2012_08_complet.csv set +x diff --git a/imapsync b/imapsync index 43af7c7..76b2c2d 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.498 $ +$Revision: 1.500 $ =head1 SYNOPSIS @@ -515,7 +515,7 @@ Entries for imapsync: Feedback (good or bad) will often be welcome. -$Id: imapsync,v 1.498 2012/07/20 14:28:45 gilles Exp gilles $ +$Id: imapsync,v 1.500 2012/08/10 04:58:46 gilles Exp gilles $ =cut @@ -626,13 +626,14 @@ my( $wholeheaderifneeded, %h1_msgs_copy_by_uid, $useuid, $h2_uidguess, $addheader, %h1, %h2, + $checkselectable, ); # main program # global variables initialisation -$rcs = '$Id: imapsync,v 1.498 2012/07/20 14:28:45 gilles Exp gilles $ '; +$rcs = '$Id: imapsync,v 1.500 2012/08/10 04:58:46 gilles Exp gilles $ '; $total_bytes_transferred = 0; $total_bytes_skipped = 0; @@ -712,6 +713,8 @@ if ( $fast ) { $usecache = 1 if ( $useuid and ( ! defined( $usecache ) ) ) ; $cacheaftercopy = 1 if ( $usecache and ( ! defined( $cacheaftercopy ) ) ) ; +$checkselectable = defined( $checkselectable ) ? $checkselectable : 1 ; + print banner_imapsync(@argv_copy); print "Temp directory is $tmpdir\n"; @@ -882,17 +885,6 @@ $password2 = ( defined( $passfile2 ) ) ? firstline ( $passfile2 ) : $password2 ; my $dry_message = '' ; $dry_message = "\t(not really since --dry mode)" if $dry ; -if ( ! ( 1 - or ( $maxsize - or $minsize - or $maxage - or $minage ) - and $usecache - and ! $delete ) ) { - die_clean( -"Problem --usecache can not be used safely with options --maxsize --minsize --maxage --minage -Use --nousecache or suppress the --max* --min* options\n" ) ; -} my $imap1 = (); my $imap2 = (); @@ -999,13 +991,14 @@ if (scalar(@exclude)) { # Remove no selectable folders -foreach my $folder (keys(%requested_folder)) { - if ( not $imap1->selectable($folder)) { - print "Warning: ignoring folder $folder because it is not selectable\n"; - remove_from_requested_folders($folder); - } -} - +$checkselectable and do { + foreach my $folder (keys(%requested_folder)) { + if ( not $imap1->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)); @@ -1143,12 +1136,14 @@ FOLDER: foreach my $h1_fold (@h1_folders_wanted) { ( $debug or $debugLIST ) and print "Host2 LIST: $h2_msgs_nb messages [@h2_msgs]\n"; - my $cache_base = "$tmpdir/imapsync_cache/$host1/$user1/$host2/$user2"; - 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(); + my $cache_base = "$tmpdir/imapsync_cache/$host1/$user1/$host2/$user2" ; + my $cache_dir = cache_folder( $cache_base, $h1_fold, $h2_fold ) ; + my ( $cache_1_2_ref, $cache_2_1_ref ) = ( {}, {} ) ; + my $h1_uidvalidity = $imap1->uidvalidity( ) || '' ; + my $h2_uidvalidity = $imap2->uidvalidity( ) || '' ; + + last FOLDER if $imap1->IsUnconnected() ; + last FOLDER if $imap2->IsUnconnected() ; if ( $usecache ) { print "cache directory: $cache_dir\n" ; @@ -1361,8 +1356,11 @@ FOLDER: foreach my $h1_fold (@h1_folders_wanted) { $debug and print "Host1 found msg $h1_fold/$h1_msg equals Host2 $h2_fold/$h2_msg\n" ; $total_bytes_skipped += $h1_size ; $nb_msg_skipped += 1 ; - $debugcache and print "touch $cache_dir/${h1_msg}_$h2_msg\n" if ( $usecache ) ; - touch( "$cache_dir/${h1_msg}_$h2_msg" ) if ( $usecache ) ; + if ( $usecache ) { + $debugcache and print "touch $cache_dir/${h1_msg}_$h2_msg\n" ; + touch( "$cache_dir/${h1_msg}_$h2_msg" ) + or die( "Couldn't touch $cache_dir/${h1_msg}_$h2_msg" ) ; + } } #$debug and print "MESSAGE $m_id\n"; @@ -1901,8 +1899,8 @@ sub banner_imapsync { my @argv_copy = @_; my $banner_imapsync = join("", '$RCSfile: imapsync,v $ ', - '$Revision: 1.498 $ ', - '$Date: 2012/07/20 14:28:45 $ ', + '$Revision: 1.500 $ ', + '$Date: 2012/08/10 04:58:46 $ ', "\n",localhost_info(), "\n", "Command line used:\n", "$0 ", command_line_nopassword(@argv_copy), "\n", @@ -2808,8 +2806,12 @@ sub copy_message { $h2_uidguess += 1 ; $total_bytes_transferred += $h1_size; $nb_msg_transferred += 1; - $debugcache and print "touch $cache_dir/${h1_msg}_$new_id\n" if ( $usecache and $cacheaftercopy and $new_id =~ m{^\d+$} ) ; - touch( "$cache_dir/${h1_msg}_$new_id" ) if ( $usecache and $cacheaftercopy and $new_id =~ m{^\d+$} ) ; + + if ( $usecache and $cacheaftercopy and $new_id =~ m{^\d+$} ) { + $debugcache and print "touch $cache_dir/${h1_msg}_$new_id\n" ; + touch( "$cache_dir/${h1_msg}_$new_id" ) + or die( "Couldn't touch $cache_dir/${h1_msg}_$new_id" ) ; + } if ( $delete ) { print "msg $h1_fold/$h1_msg deleted on host1\n"; unless($dry) { @@ -2906,6 +2908,20 @@ sub tests_cache_map { } +sub cache_dir_fix { + my $cache_dir = shift ; + $cache_dir =~ s/([;<>\*\|`&\$!#\(\)\[\]\{\}:'"\\])/\\$1/g ; + #print "cache_dir_fix: $cache_dir\n" ; + return( $cache_dir ) ; +} + +sub tests_cache_dir_fix { + ok( 'lalala' eq cache_dir_fix('lalala'), 'cache_dir_fix: lalala -> lalala' ); + ok( 'ii\\\\ii' eq cache_dir_fix('ii\ii'), 'cache_dir_fix: ii\ii -> ii\\\\ii' ); + ok( 'ii@ii' eq cache_dir_fix('ii@ii'), 'cache_dir_fix: ii@ii -> ii@ii' ); + ok( 'ii@ii\\:ii' eq cache_dir_fix('ii@ii:ii'), 'cache_dir_fix: ii@ii:ii -> ii@ii\\:ii' ); + +} sub get_cache { $debugcache and print "Entering get_cache\n"; @@ -2915,12 +2931,14 @@ sub get_cache { $debugcache and print "cache_dir : $cache_dir\n"; #$cache_dir =~ s{\\}{\\\\}g; - $cache_dir =~ s/([;<>\*\|`&\$!#\(\)\[\]\{\}:'"\\])/\\$1/g ; + $cache_dir = cache_dir_fix( $cache_dir ) if ( 'MSWin32' ne $OSNAME ) ; - $debugcache and print "cache_dir fix: $cache_dir\n"; + $debugcache and print "cache_dir_fix: $cache_dir\n" ; my @cache_files = bsd_glob( "$cache_dir/*" ) ; - #$debugcache and print "cache_files: [@cache_files]\n"; + #$debugcache and print "cache_files: [@cache_files]\n" ; + + $debugcache and print( "cache_files: ", scalar( @cache_files ), " files found\n" ) ; my( $cache_1_2_ref, $cache_2_1_ref ) = cache_map( \@cache_files, $h1_msgs_ref, $h2_msgs_ref ) ; @@ -3200,16 +3218,6 @@ sub tests_clean_cache_2 { } -sub tests_touch { - - ok( (-d 'tmp/tests/' or mkpath( 'tmp/tests/' )), 'tests_touch: mkpath tmp/tests/' ) ; - ok( 1 == touch( 'tmp/tests/lala'), 'tests_touch: tmp/tests/lala') ; - ok( 1 == touch( 'tmp/tests/\y'), 'tests_touch: tmp/tests/\y') ; - ok( 0 == touch( '/aaa'), 'tests_touch: not /aaa') ; - ok( 2 == touch( 'tmp/tests/lili', 'tmp/tests/lolo'), 'tests_touch: 2 files') ; - ok( 1 == touch( 'tmp/tests/\y', '/aaa'), 'tests_touch: 2 files, 1 fails' ) ; - -} sub tests_mkpath { @@ -3219,18 +3227,32 @@ sub tests_mkpath { ok( 1 == 1, 'tests_mkpath: 1 == 1' ) ; } +sub tests_touch { + + ok( (-d 'tmp/tests/' or mkpath( 'tmp/tests/' )), 'tests_touch: mkpath tmp/tests/' ) ; + ok( 1 == touch( 'tmp/tests/lala'), 'tests_touch: tmp/tests/lala') ; + ok( 1 == touch( 'tmp/tests/\y'), 'tests_touch: tmp/tests/\y') ; + ok( 0 == touch( '/aaa'), 'tests_touch: not /aaa') ; + ok( 1 == touch( 'tmp/tests/lili', 'tmp/tests/lolo'), 'tests_touch: 2 files') ; + ok( 0 == touch( 'tmp/tests/\y', '/aaa'), 'tests_touch: 2 files, 1 fails' ) ; + +} + + sub touch { my @files = @_ ; - my @result; + my $failures = 0 ; foreach my $file ( @files ) { my $fh = new IO::File ; - if ($fh->open(">> $file")) { + if ( $fh->open(">> $file" ) ) { $fh->close ; - push(@result, $file) ; - } + }else{ + print "Could not open file $file in write/append mode\n" ; + $failures++ ; + } } - return(@result); + return( ! $failures ); } sub cache_folder { @@ -3545,6 +3567,7 @@ sub get_options { "useuid!" => \$useuid, "addheader!" => \$addheader, "exitwhenover=i" => \$exitwhenover, + "checkselectable!" => \$checkselectable, ); $debug and print "get options: [$opt_ret]\n"; @@ -3734,7 +3757,7 @@ sub check_last_release { } sub imapsync_version { - my $rcs = '$Id: imapsync,v 1.498 2012/07/20 14:28:45 gilles Exp gilles $ '; + my $rcs = '$Id: imapsync,v 1.500 2012/08/10 04:58:46 gilles Exp gilles $ '; $rcs =~ m/,v (\d+\.\d+)/; my $VERSION = ($1) ? $1: "UNKNOWN"; return($VERSION); @@ -3928,6 +3951,7 @@ Several options are mandatory. --delete2folders --dry --justfolders --nofoldersizes --delete2foldersonly : delete only folders matching regex. --delete2foldersbutnot : do not delete folders matching regex. + Example: --delete2foldersbutnot "/Tasks|Contacts|Foo/" --noexpunge : Do not expunge messages on host1. Expunge really deletes messages marked deleted. Expunge is made at the beginning, on host1 only. @@ -4532,7 +4556,7 @@ sub tests_debug { SKIP: { skip "No test in normal run" if ( not $tests_debug ); - tests_add_header( ) ; + tests_cache_dir_fix( ) ; } } @@ -4568,6 +4592,8 @@ sub tests { tests_extract_header( ) ; tests_decompose_header( ) ; tests_epoch( ) ; + tests_add_header( ) ; + tests_cache_dir_fix( ) ; } } diff --git a/index.shtml b/index.shtml index 63fe26b..02b569f 100644 --- a/index.shtml +++ b/index.shtml @@ -5,7 +5,7 @@ Imapsync: an IMAP migration tool ( release <!--#exec cmd="cat VERSION"--> ) - + @@ -94,6 +94,15 @@ total is 93 millions for 2011

New features or bugfixes since previous releases:

+
    +
  • 1.500
  • +
  • Enhancement: Added option --nocheckselectable to fix INBOX issue with Jana-server.
  • +
  • Bug fix: The cache system didn't work in Win32 (problem with \ transformation).
  • +
  • Bug fix: Check the return of touch calls for the cache.
  • +
  • Usability: Example for --delete2foldersbutnot "m/Contacts|Agenda|Trash/"
  • +
+ +
  • 1.498
  • Usability: Use KiB MiB GiB etc in result summary. Patch from Mark Atwood.
  • @@ -215,7 +224,7 @@ any Unix, Linux, Windows, or Mac OS operating system.

    + One year of imapsync updates without extra payment.
    -+ 30 days money-back guarantee!
    ++ 30 days money-back guarantee! (any reason qualifies)

    @@ -232,7 +241,12 @@ Price 42 EUR is equal to around 50 USD, no problem to pay in USD (
    + +
    + +Enter your VAT if you're a European professional (for accounting). It's 2 letters followed by 11 digits, for example mine is FR74429303332. +
    + @@ -241,7 +255,7 @@ name="submit" alt="PayPal - The safer, easier way to pay online!"/>

    You will receive a download link just after the payment.
    You will also receive a gpg signed invoice within a few days by email.
    -Please give a postal address where the invoice will be needed (your company for example), +Please give a delivery postal address where the invoice will be needed (your company for example), since reedit is not easy (and forbidden by law).

    @@ -256,7 +270,7 @@ buying the latest win32 standalone imapsync.exe for 42 EUR

    + One year of imapsync updates without extra payment.
    -+ 30 days money-back guarantee!
    ++ 30 days money-back guarantee! (any reason qualifies)

    @@ -272,7 +286,12 @@ Price 42 EUR is equal to around 50 USD, no problem to pay in USD (
    + +
    + +Enter your VAT if you're a European professional (for accounting). It's 2 letters followed by 11 digits, for example mine is FR74429303332. +
    + @@ -281,7 +300,7 @@ name="submit" alt="PayPal - The safer, easier way to pay online!"/>

    You will receive a download link just after the payment.
    You will also receive a gpg signed invoice within a few days by email.
    -Please give a postal address where the invoice will be needed (your company for example), +Please give a delivery postal address where the invoice will be needed (your company for example), since reedit is not easy (and forbidden by law).

    @@ -308,6 +327,16 @@ Payment by Paypal account and credit card accepted.

    +imapsync usage + +
    + +Enter your VAT if you're a European professional (for accounting). It's 2 letters followed by 11 digits, for example mine is FR74429303332. +
    +

    You will also receive a gpg signed invoice within a few days by email.
    -Please give a postal address where the invoice will be needed (your company for example), +Please give a delivery postal address where the invoice will be needed (your company for example), since reedit is not easy (and forbidden by law).

    @@ -492,6 +521,7 @@ Don't hesitate to have a try, I will help you and make efforts to switch them to
  • imapcopy: http://home.arcor.de/armin.diehl/imapcopy/imapcopy.html
  • migrationtool: http://sourceforge.net/projects/migrationtool/
  • imapmigrate: http://sourceforge.net/projects/cyrus-utils/
  • +
  • larch: https://github.com/rgrove/larch (derived from wonko_imapsync)
  • wonko_imapsync: http://wonko.com/article/554
  • pop2imap: http://www.linux-france.org/prj/pop2imap/
  • exchange-away: http://exchange-away.sourceforge.net/
  • @@ -540,8 +570,9 @@ alt="Viewable With Any Browser" /> This document last modified on -($Id: index.shtml,v 1.122 2012/07/20 15:24:40 gilles Exp gilles $) +($Id: index.shtml,v 1.127 2012/08/11 01:40:17 gilles Exp gilles $)

    + diff --git a/test2.bat b/test2.bat index 203a20c..c53080d 100755 --- a/test2.bat +++ b/test2.bat @@ -1,5 +1,5 @@ -REM $Id: test2.bat,v 1.8 2012/02/25 14:42:23 gilles Exp gilles $ +REM $Id: test2.bat,v 1.9 2012/08/10 11:28:30 gilles Exp gilles $ cd C:\msys\1.0\home\Admin\imapsync REM perl ./imapsync --host1 p --user1 tata --passfile1 secret.tata --host2 p --user2 titi --passfile2 secret.titi --delete2 --expunge2 --folder INBOX @@ -26,6 +26,9 @@ REM --host2 imap.side2.org --user2 %%I --password2 %%J REM imapsync --host1 p --user1 tata --passfile1 secret.tata ^ REM --host2 p --user2 dollar --password2 "$%%&<>|^"^" --justlogin -imapsync --host1 p --user1 tata --passfile1 secret.tata ^ - --host2 p --user2 equal --password2 "==lalala" --justlogin --debugimap2 +REM imapsync --host1 p --user1 tata --passfile1 secret.tata ^ +REM --host2 p --user2 equal --password2 "==lalala" --justlogin --debugimap2 +perl ./imapsync --host1 p --user1 tata --passfile1 secret.tata ^ + --host2 p --user2 titi --passfile2 secret.titi ^ + --folder INBOX.useuid --useuid --debugcache --delete2 diff --git a/tests.sh b/tests.sh index 95ce1c4..ba43997 100644 --- a/tests.sh +++ b/tests.sh @@ -1,6 +1,6 @@ #!/bin/sh -# $Id: tests.sh,v 1.195 2012/07/18 11:10:00 gilles Exp gilles $ +# $Id: tests.sh,v 1.196 2012/08/10 11:29:11 gilles Exp gilles $ # Example 1: # CMD_PERL='perl -I./Mail-IMAPClient-3.25/lib' sh -x tests.sh @@ -486,7 +486,7 @@ ll_delete2foldersbutnot() { --host2 $HOST2 --user2 titi \ --passfile2 ../../var/pass/secret.titi \ --justfolders --nofoldersizes \ - --delete2foldersbutnot '/NEW_2|NEW_3|\[abc\]/' \ + --delete2foldersbutnot 'm{NEW_2|NEW_3|\[abc\]}' \ --dry }