1
0
mirror of https://github.com/imapsync/imapsync.git synced 2024-11-17 00:02:29 +01:00
This commit is contained in:
Nick Bebout 2012-04-16 17:34:41 -05:00
parent 1466872026
commit b62a0dae2a
58 changed files with 612 additions and 140 deletions

View File

@ -1,17 +1,26 @@
RCS file: RCS/imapsync,v RCS file: RCS/imapsync,v
Working file: imapsync Working file: imapsync
head: 1.487 head: 1.488
branch: branch:
locks: strict locks: strict
gilles: 1.487 gilles: 1.488
access list: access list:
symbolic names: symbolic names:
keyword substitution: kv keyword substitution: kv
total revisions: 487; selected revisions: 487 total revisions: 488; selected revisions: 488
description: description:
---------------------------- ----------------------------
revision 1.487 locked by: gilles; revision 1.488 locked by: gilles;
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."
The "good" escaping was bad. No escaping needed. It permits imapsync variables like ${h2_sep}
in --delete2foldersonly
But good escaping has to be done in parameter value like --delete2foldersbutnot /\[Gmail\]/
instead of --delete2foldersbutnot /[Gmail]/ (for example).
----------------------------
revision 1.487
date: 2012/02/29 05:29:21; author: gilles; state: Exp; lines: +7 -7 date: 2012/02/29 05:29:21; author: gilles; state: Exp; lines: +7 -7
Fixed a useless Perl warning. Fixed a useless Perl warning.
---------------------------- ----------------------------

17
FAQ
View File

@ -1,5 +1,5 @@
#!/bin/cat #!/bin/cat
# $Id: FAQ,v 1.104 2012/02/20 18:23:29 gilles Exp gilles $ # $Id: FAQ,v 1.106 2012/04/15 19:18:29 gilles Exp gilles $
+------------------+ +------------------+
| FAQ for imapsync | | FAQ for imapsync |
@ -43,6 +43,15 @@ like on Unix so in the examples of this FAQ the
command containing single quotes ' will fail on Windows. command containing single quotes ' will fail on Windows.
To fix it just replace single quotes ' by double quotes " To fix it just replace single quotes ' by double quotes "
=======================================================================
Q. How to verify imapsync.exe I got is the right file bit per bit?
R. Use md5sum to check integrity of the file.
Get md5sum.exe at http://etree.org/md5com.html
md5sum imapsync.exe
Then compare the checksum with the one given by the author.
======================================================================= =======================================================================
Q. How to install imapsync? Q. How to install imapsync?
@ -319,6 +328,12 @@ R2. With option --useuid imapsync doesn't use headers to identify
messages on both sides but it uses their imap uid. In that case messages on both sides but it uses their imap uid. In that case
duplicates on host1 are transfered on host2. duplicates on host1 are transfered on host2.
=======================================================================
Q. How can I remove duplicates on a uniq host
R. Just run imapsync on the same account with option --delete2,
ie with host1 == host2 and user1 == user2
======================================================================= =======================================================================
Q. I need to log every output on a file named log.txt Q. I need to log every output on a file named log.txt

21
INSTALL
View File

@ -1,4 +1,4 @@
# $Id: INSTALL,v 1.23 2012/01/30 19:23:36 gilles Exp gilles $ # $Id: INSTALL,v 1.24 2012/04/13 09:14:22 gilles Exp gilles $
# #
# INSTALL file for imapsync # INSTALL file for imapsync
# imapsync : IMAP sync or copy tool. # imapsync : IMAP sync or copy tool.
@ -67,19 +67,18 @@ Here is some individual module help:
perl -mMail::IMAPClient -e '' perl -mMail::IMAPClient -e ''
Get the Mail::IMAPClient module here: Get the latest Mail::IMAPClient module here:
http://search.cpan.org/ http://search.cpan.org/dist/Mail-IMAPClient/
http://search.cpan.org/~djkernen/
http://search.cpan.org/~djkernen/Mail-IMAPClient-2.2.9/ 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 :
In fact I use Mail-IMAPClient-2.2.9 and latest Mail-IMAPClient-2.xx
(xx >= 25)
To know the version you have on your system try :
perl -mMail::IMAPClient -e 'print $Mail::IMAPClient::VERSION, "\n"' perl -mMail::IMAPClient -e 'print $Mail::IMAPClient::VERSION, "\n"'
New Mail-IMAPClient-3.xx works now with imapsync, New Mail-IMAPClient-3.xx works now very well with imapsync,
at least with Mail-IMAPClient-3.25 (previous may bug) better than Mail-IMAPClient-2.2.9 with memory and other things,
at least with Mail-IMAPClient-3.25 (previous may bug).
Don't hesitate to use latest Mail-IMAPClient-3.xx
- Perl Digest::MD5 module. - Perl Digest::MD5 module.
try: try:

View File

@ -5,6 +5,12 @@ Changes from 2.99_01 to 3.16 made by Mark Overmeer
Changes from 0.09 to 2.99_01 made by David Kernen Changes from 0.09 to 2.99_01 made by David Kernen
- Potential compatibility issues from 3.17+ highlighted with '*' - Potential compatibility issues from 3.17+ highlighted with '*'
version 3.31: Mon, Mar 19, 2012 11:11:11 AM
- rt.cpan.org#74799: Support for partial data responses in fetch_hash
[Philip Garrett]
+ bonus: cleaner handling of BODY.PEEK responses
- properly handle ALL|FULL|FAST fetch macros in fetch_hash
version 3.30: Fri Nov 11 09:37:00 EST 2011 version 3.30: Fri Nov 11 09:37:00 EST 2011
- rt.cpan.org#72347: Starttls array ref argument dereferenced twice - rt.cpan.org#72347: Starttls array ref argument dereferenced twice
[Jonathan Buhacoff] [Jonathan Buhacoff]

View File

@ -1,6 +1,6 @@
--- #YAML:1.0 --- #YAML:1.0
name: Mail-IMAPClient name: Mail-IMAPClient
version: 3.30 version: 3.31
abstract: IMAP4 client library abstract: IMAP4 client library
author: author:
- Phil Pearl (Lobbes) <phil@zimbra.com> - Phil Pearl (Lobbes) <phil@zimbra.com>

View File

@ -7,7 +7,7 @@ use strict;
use warnings; use warnings;
package Mail::IMAPClient; package Mail::IMAPClient;
our $VERSION = '3.30'; our $VERSION = '3.31';
use Mail::IMAPClient::MessageSet; use Mail::IMAPClient::MessageSet;
@ -2130,25 +2130,60 @@ sub fetch_hash {
# fetch has similar logic for dealing with message list # fetch has similar logic for dealing with message list
my $msgs = 'ALL'; my $msgs = 'ALL';
if ( $words[0] ) { if ( $words[0] ) {
if ( $words[0] eq 'ALL' || ref $words[0] ) { if ( ref $words[0] ) {
$msgs = shift @words; $msgs = shift @words;
} }
elsif ( $words[0] =~ s/^([,:\d]+)\s*// ) { elsif ( $#words > 0 ) {
$msgs = $1; if ( $words[0] eq 'ALL' ) {
shift @words if $words[0] eq ""; $msgs = shift @words;
}
elsif ( $words[0] =~ s/^([,:\d]+)\s*// ) {
$msgs = $1;
shift @words if $words[0] eq "";
}
} }
} }
# message list (if any) is now removed from @words # message list (if any) is now removed from @words
my $what = join ' ', @words; my $what = join( " ", @words );
for (@words) { # RFC 3501:
s/([\( ])FAST([\) ])/${1}FLAGS INTERNALDATE RFC822\.SIZE$2/i; # fetch = "FETCH" SP sequence-set SP ("ALL" / "FULL" / "FAST" /
s/([\( ])FULL([\) ])/${1}FLAGS INTERNALDATE RFC822\.SIZE ENVELOPE BODY$2/i; # fetch-att / "(" fetch-att *(SP fetch-att) ")")
my %macro = (
"ALL" => [qw(FLAGS INTERNALDATE RFC822.SIZE ENVELOPE)],
"FULL" => [qw(FLAGS INTERNALDATE RFC822.SIZE ENVELOPE BODY)],
"FAST" => [qw(FLAGS INTERNALDATE RFC822.SIZE)],
);
if ( $macro{$what} ) {
@words = @{ $macro{$what} };
} }
my %words = map { uc($_) => 1 } @words; else {
$what = "($what)";
my @twords;
foreach my $word (@words) {
$word = uc($word);
my $output = $self->fetch( $msgs, "($what)" ) # server response to BODY[]<10.20> is a field named BODY[]<10>
if ( $word =~ /^BODY/ ) {
$word =~ s/<(\d+)\.\d+>$/<$1>/;
# server response to BODY.PEEK[] is a field named BODY[]
# BUG? allow for BODY.PEEK in response (historical behavior)
if ( $word =~ /^BODY\.PEEK/ ) {
push( @twords, $word );
$word =~ s/^BODY\.PEEK/BODY/;
}
}
unshift( @twords, $word );
}
@words = @twords;
}
my %words = map { $_ => 1 } @words;
my $output = $self->fetch( $msgs, $what )
or return undef; or return undef;
while ( my $l = shift @$output ) { while ( my $l = shift @$output ) {
@ -2157,7 +2192,7 @@ s/([\( ])FULL([\) ])/${1}FLAGS INTERNALDATE RFC822\.SIZE ENVELOPE BODY$2/i;
my ( $key, $value ); my ( $key, $value );
ATTR: ATTR:
while ( $l and $l !~ m/\G\s*\)\s*$/gc ) { while ( $l and $l !~ m/\G\s*\)\s*$/gc ) {
if ( $l =~ m/\G\s*([^\s\[]+(?:\[[^\]]*\])?)\s*/gc ) { if ( $l =~ m/\G\s*([^\s\[]+(?:\[[^\]]*\])?(?:<[^>]*>)?)\s*/gc ) {
$key = uc($1); $key = uc($1);
} }
elsif ( !defined $key ) { elsif ( !defined $key ) {
@ -2220,13 +2255,9 @@ s/([\( ])FULL([\) ])/${1}FLAGS INTERNALDATE RFC822\.SIZE ENVELOPE BODY$2/i;
$uids->{$mid} = $entry; $uids->{$mid} = $entry;
} }
# remove things not asked for (i.e. UID/$mid)
for my $word ( keys %$entry ) { for my $word ( keys %$entry ) {
next if exists $words{$word}; next if ( exists $words{$word} );
if ( my ($stuff) = $word =~ m/^BODY(\[.*)$/ ) {
next if exists $words{ "BODY.PEEK" . $stuff };
}
delete $entry->{$word}; delete $entry->{$word};
} }
} }

View File

@ -1,6 +1,5 @@
#!/usr/bin/perl #!/usr/bin/perl
# #
#
# tests for fetch_hash() # tests for fetch_hash()
# #
# fetch_hash() calls fetch() internally. rather than refactor # fetch_hash() calls fetch() internally. rather than refactor
@ -9,7 +8,7 @@
use strict; use strict;
use warnings; use warnings;
use Test::More tests => 20; use Test::More tests => 22;
BEGIN { use_ok('Mail::IMAPClient') or exit; } BEGIN { use_ok('Mail::IMAPClient') or exit; }
@ -110,6 +109,18 @@ my @tests = (
[ [1], qw(BODY.PEEK[]) ], [ [1], qw(BODY.PEEK[]) ],
{ "1" => { "BODY.PEEK[]" => q{foo}, }, }, { "1" => { "BODY.PEEK[]" => q{foo}, }, },
], ],
[
"BODY[]<0.1024> requests match BODY[]<0> responses",
[ q{* 1 FETCH (BODY[]<0>}, q{foo}, ")\r\n" ],
[ [1], qw(BODY[]<0.1024>) ],
{ "1" => { "BODY[]<0>" => q{foo}, }, },
],
[
"BODY.PEEK[]<0.1024> requests match BODY[]<0> responses",
[ q{* 1 FETCH (BODY[]<0>}, q{foo}, ")\r\n" ],
[ [1], qw(BODY.PEEK[]<0.1024>) ],
{ "1" => { "BODY[]<0>" => q{foo}, }, },
],
[ [
"escaped ENVELOPE subject", "escaped ENVELOPE subject",
[ [

View File

@ -1,5 +1,5 @@
# $Id: Makefile,v 1.93 2012/02/07 10:55:04 gilles Exp gilles $ # $Id: Makefile,v 1.94 2012/04/15 19:19:14 gilles Exp gilles $
.PHONY: help usage all .PHONY: help usage all
@ -32,7 +32,7 @@ VERSION_EXE=$(shell cat ./VERSION_EXE)
HELLO=$(shell date;uname -a) HELLO=$(shell date;uname -a)
IMAPClient_2xx=./Mail-IMAPClient-2.2.9 IMAPClient_2xx=./Mail-IMAPClient-2.2.9
IMAPClient_3xx=./Mail-IMAPClient-3.30/lib IMAPClient_3xx=./Mail-IMAPClient-3.31/lib
IMAPClient=$(IMAPClient_3xx) IMAPClient=$(IMAPClient_3xx)
hello: hello:

4
README
View File

@ -3,7 +3,7 @@ NAME
Synchronise mailboxes between two imap servers. Good at IMAP migration. Synchronise mailboxes between two imap servers. Good at IMAP migration.
More than 44 different IMAP server softwares supported with success. More than 44 different IMAP server softwares supported with success.
$Revision: 1.487 $ $Revision: 1.488 $
SYNOPSIS SYNOPSIS
To synchronise imap account "foo" on "imap.truc.org" to imap account To synchronise imap account "foo" on "imap.truc.org" to imap account
@ -444,5 +444,5 @@ SIMILAR SOFTWARES
Feedback (good or bad) will often be welcome. Feedback (good or bad) will often be welcome.
$Id: imapsync,v 1.487 2012/02/29 05:29:21 gilles Exp gilles $ $Id: imapsync,v 1.488 2012/04/15 17:38:21 gilles Exp gilles $

5
TODO
View File

@ -1,5 +1,5 @@
#!/bin/cat #!/bin/cat
# $Id: TODO,v 1.110 2012/02/07 00:20:32 gilles Exp gilles $ # $Id: TODO,v 1.111 2012/04/15 19:18:54 gilles Exp gilles $
TODO file for imapsync TODO file for imapsync
---------------------- ----------------------
@ -62,6 +62,9 @@ http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=503159
http://www.linux-france.org/prj/imapsync_list/msg00022.html http://www.linux-france.org/prj/imapsync_list/msg00022.html
http://mail.google.com/support/bin/answer.py?hl=en&answer=77657 http://mail.google.com/support/bin/answer.py?hl=en&answer=77657
http://mail.google.com/support/bin/answer.py?answer=78892 http://mail.google.com/support/bin/answer.py?answer=78892
Look at larch https://github.com/rgrove/larch/
http://wonko.com/
Add and option to sync to & from files. Add and option to sync to & from files.

View File

@ -1 +1 @@
1.487 1.488

View File

@ -1 +1 @@
1.487 1.488

View File

@ -5,10 +5,10 @@
echo paypal_bilan_tests_invoice echo paypal_bilan_tests_invoice
paypal_bilan_tests_invoice() { paypal_bilan_tests_invoice() {
# DID output no diff between paypal_bilan_1.46 and 1.47 # DID output no diff between paypal_bilan_1.47 and 1.48
( (
#set -x #set -x
/g/public_html/imapsync/W/paypal_reply/paypal_bilan_1.46 --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.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/var/paypal_bilan/tests/paypal_invoice.out1 2>&1 > /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' /g/paypal/paypal_201?_??_complet.csv \
> /g/var/paypal_bilan/tests/paypal_invoice.out2 2>&1 > /g/var/paypal_bilan/tests/paypal_invoice.out2 2>&1

View File

@ -1,6 +1,6 @@
#!/usr/bin/perl #!/usr/bin/perl
# $Id: paypal_bilan,v 1.47 2012/02/24 12:22:05 gilles Exp gilles $ # $Id: paypal_bilan,v 1.48 2012/04/15 09:24:49 gilles Exp gilles $
use strict; use strict;
use warnings; use warnings;
@ -477,8 +477,10 @@ sub compute_line {
$FR_flag = ' FR' if $Pays eq 'France' ; $FR_flag = ' FR' if $Pays eq 'France' ;
my $IND_flag = '' ; my $IND_flag = '' ;
$IND_flag = ' IND' if ('imapsync usage' eq $Nom_Option_1 and 'individual' eq $Valeur_Option_1 ) ; $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" ;
print "FE $invoice$FR_flag$IND_flag imapsync $Nom\n" ; print "FE $invoice$FR_flag$IND_flag imapsync$SUPPORT_flag $Nom\n" ;
printf( "%.2f [EUR %.2f]\n", $Montant, $MontantEUR ) ; printf( "%.2f [EUR %.2f]\n", $Montant, $MontantEUR ) ;
} }
} }

View File

@ -1,6 +1,6 @@
#!/usr/bin/perl #!/usr/bin/perl
# $Id: paypal_bilan,v 1.46 2012/02/24 11:53:06 gilles Exp gilles $ # $Id: paypal_bilan,v 1.47 2012/02/24 12:22:05 gilles Exp gilles $
use strict; use strict;
use warnings; use warnings;
@ -27,6 +27,7 @@ my $total_eur_invoice = 0 ;
my $nb_invoice = 0 ; my $nb_invoice = 0 ;
my $nb_invoice_refund = 0 ; my $nb_invoice_refund = 0 ;
my $nb_invoice_suspended = 0 ; my $nb_invoice_suspended = 0 ;
my $nb_invoice_canceled = 0 ;
my ( $tests, $testeur ) ; my ( $tests, $testeur ) ;
my $debug ; my $debug ;
@ -41,6 +42,7 @@ my $bnc = '' ;
my $usdeur = 1.2981 ; my $usdeur = 1.2981 ;
my $invoices ; my $invoices ;
my %invoice_refund ; my %invoice_refund ;
my %invoice_canceled ;
my %invoice_suspended ; my %invoice_suspended ;
my $write_invoices = 0 ; my $write_invoices = 0 ;
my $avoid_numbers ; my $avoid_numbers ;
@ -148,6 +150,10 @@ foreach my $invoice ( @invoices_wanted ) {
my $nb_invoice_sent = scalar( @invoice_sent ) ; my $nb_invoice_sent = scalar( @invoice_sent ) ;
@invoice_not_sent = sort { $a <=> $b } keys( %invoice_not_sent ) ; @invoice_not_sent = sort { $a <=> $b } keys( %invoice_not_sent ) ;
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 "USD banque $total_usd_received\n" ; print "USD banque $total_usd_received\n" ;
print "USD invoice $total_usd_invoice\n" ; print "USD invoice $total_usd_invoice\n" ;
my $total_eur_from_usd ; my $total_eur_from_usd ;
@ -174,8 +180,9 @@ print "EUR total TVA $total_TVA_EUR\n" ;
print "EUR total HT sup $total_HT_EUR_sup\n" ; print "EUR total HT sup $total_HT_EUR_sup\n" ;
print "EUR total TVA sup $total_TVA_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 $nb_invoice ( from $first_invoice_paypal to $last_invoice )\n" ;
print "Nb invoice refund $nb_invoice_refund\n" ; print "Nb invoice canceled $nb_invoice_canceled @invoice_canceled\n" ;
print "Nb invoice suspended $nb_invoice_suspended\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 "Nb invoice sent $nb_invoice_sent\n" ;
print "Have to send invoices @invoice_not_sent\n" if ( @invoice_not_sent ) ; print "Have to send invoices @invoice_not_sent\n" if ( @invoice_not_sent ) ;
@ -420,7 +427,6 @@ sub compute_line {
and 'EUR' eq $Devise and 'EUR' eq $Devise
and 'Remboursé' eq $Etat and 'Remboursé' eq $Etat
) { ) {
#$invoice = $first_invoice + $nb_invoice ;
$invoice = next_invoice( ) ; $invoice = next_invoice( ) ;
$nb_invoice++ ; $nb_invoice++ ;
$nb_invoice_refund++; $nb_invoice_refund++;
@ -429,12 +435,24 @@ sub compute_line {
$print_details and print ( "[$invoice] [$Date] [$Heure] [$Fuseau_horaire] [$Nom] [$Type] [$Etat] [$Devise] [$Montant] [$Numero_davis_de_reception] [$Solde]\n" ) ; $print_details and print ( "[$invoice] [$Date] [$Heure] [$Fuseau_horaire] [$Nom] [$Type] [$Etat] [$Devise] [$Montant] [$Numero_davis_de_reception] [$Solde]\n" ) ;
} }
if (
'Paiement sur site marchand reçu' eq $Type
and 'EUR' eq $Devise
and 'Annulé' eq $Etat
) {
$invoice = next_invoice( ) ;
$nb_invoice++ ;
$nb_invoice_canceled++;
$invoice_canceled{ $invoice }++ ;
$print_details and print ( "[$invoice] [$Date] [$Heure] [$Fuseau_horaire] [$Nom] [$Type] [$Etat] [$Devise] [$Montant] [$Numero_davis_de_reception] [$Solde]\n" ) ;
}
if ( if (
'Paiement sur site marchand reçu' eq $Type 'Paiement sur site marchand reçu' eq $Type
and 'EUR' eq $Devise and 'EUR' eq $Devise
and 'Suspendu' eq $Etat and 'Suspendu' eq $Etat
) { ) {
#$invoice = $first_invoice + $nb_invoice ;
$invoice = next_invoice( ) ; $invoice = next_invoice( ) ;
$nb_invoice++ ; $nb_invoice++ ;
$nb_invoice_suspended++; $nb_invoice_suspended++;
@ -448,7 +466,6 @@ sub compute_line {
and 'EUR' eq $Devise and 'EUR' eq $Devise
and 'Non compensé' eq $Etat and 'Non compensé' eq $Etat
) { ) {
#$invoice = $first_invoice + $nb_invoice ;
$invoice = next_invoice( ) ; $invoice = next_invoice( ) ;
$nb_invoice++ ; $nb_invoice++ ;
$print_details and print ( "[$invoice] [$Date] [$Heure] [$Fuseau_horaire] [$Nom] [$Type] [$Etat] [$Devise] [$Montant] [$Numero_davis_de_reception] [$Solde]\n" ) ; $print_details and print ( "[$invoice] [$Date] [$Heure] [$Fuseau_horaire] [$Nom] [$Type] [$Etat] [$Devise] [$Montant] [$Numero_davis_de_reception] [$Solde]\n" ) ;

View File

@ -0,0 +1,293 @@
#!/usr/bin/perl
# $Id: paypal_build_invoice_from_email,v 1.1 2012/03/14 00:24:50 gilles Exp gilles $
use warnings;
use strict;
use Getopt::Long;
use Test::More 'no_plan';
my ($msg_id_file, $msg_id);
my ($amount, $name, $email);
my (
$paypal_line, $paypal_info,
$buyer, $description, $object,
$url, $release, $release_exe,
) ;
my( $day, $month, $year, $hour, $min, $sec, $fuseau, $transaction,
$postal_address ) ;
my ( $help, $debug, $tests ) ;
my $numopt = scalar( @ARGV ) ;
my $test_builder = Test::More->builder;
$test_builder->no_ending(1);
my $opt_ret = GetOptions(
"help" => \$help,
"debug!" => \$debug,
"tests!" => \$tests,
);
if ($tests) {
$test_builder->no_ending(0);
tests();
exit;
}
usage() and exit if ($help or ! $numopt) ;
$msg_id_file = $ARGV[1];
$msg_id = firstline($msg_id_file);
$debug and print "Hi!\n" ;
while(<>) {
$debug and print "LINE 1:$_" ;
next if ( ! /^(.*Num.+ro de transaction.*)$/ );
$paypal_line = $1;
$paypal_info = "===== Paypal id =====\n$paypal_line\n";
$debug and print "paypal_line: [$paypal_line]\n" ;
( $day, $month, $year, $hour, $min, $sec, $fuseau, $transaction )
= paypal_infos( $paypal_line ) ;
$debug and print "$day, $month, $year, $hour, $min, $sec, $fuseau, $transaction\n" ;
last;
}
while(<>) {
$debug and print "LINE 2:$_" ;
if ( /^Vous avez re.*paiement d'un montant de (.*) de la part de (.*) \((.*)\)/) {
($amount, $name, $email) = ($1, $2, $3);
last;
}
if ( /^Vous avez re.*paiement d'un montant de (.*) de la part de (.*)/) {
($amount, $name, $email) = ($1, "", $2);
last;
}
}
$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 = "http://ks.lamiral.info/imapsync/dist/$path_last/" ;
#print "[$amount] [$name] [$email] [$paypal_line]\n";
while(<>) {
$debug and print "LINE 3:$_" ;
if ( /^Acheteur/ ) {
$buyer .= "===== Acheteur =====\n";
last;
}
if ( /^Informations sur l'acheteur/ ) {
$buyer .= "===== Acheteur =====\n";
chomp( $name = <> );
$buyer .= "$name\n" ;
last;
}
}
while(<>) {
$debug and print "LINE 4a:$_" ;
$buyer .= $_ if ( ! /^Adresse de livraison/ );
last if ( /^Adresse de livraison/ );
}
while(<>) {
$debug and print "LINE 4b:$_" ;
$postal_address .= $_ if ( ! /^Instructions .* l'attention du marchand/ and "\n" ne $_ );
last if ( /^Instructions .* l'attention du marchand/ );
}
my @postal_address = split( "\n", $postal_address ) ;
my $country = $postal_address[-1] ;
while(<>) {
$debug and print "LINE 4c:$_" ;
$buyer .= $_ if ( ! /^-----------------------------------/ );
last if ( /^-----------------------------------/ );
}
while(<>) {
$debug and print "LINE 5:$_" ;
next if ( ! /^Description :(.*)/ );
$object = $1 ;
$description = "===== Details =====\n";
$description .= $_;
last;
}
while(<>) {
$debug and print "LINE 6:$_" ;
$description .= $_;
last if ( /^Paiement envoy/ );
last if ( /^N.*d'avis de r.*ception/ );
}
my $address = 'gilles.lamiral@laposte.net';
my $address2 = 'gilles@lamiral.info';
my $rcstag = '$Id: paypal_build_invoice_from_email,v 1.1 2012/03/14 00:24:50 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:
$url" ;
my $next_releases =
"Next imapsync releases will be available to you for one year without extra payment.
You'll be subscribed to a newsletter [imapsync_update] announcing new releases.
Just keep this message and ask for the new links in case you miss the newsletter.
Run imapsync without any argument to know if a new release is available." ;
my $thanks_software = "I thank you for buying and using imapsync,
I wish you successful transfers!" ;
my $thanks_support = "I thank you for buying support and using imapsync,
I wish you successful transfers, I will help you to succeed." ;
my $support_info = 'Now you have access to imapsync professional support.
You can contact me (Gilles LAMIRAL) by email or phone.
Email address: gilles.lamiral@laposte.net.
Professionnal phone number: +33 951 84 42 42 (France)
Mobile phone number: +33 620 79 76 06 (France).
I can call you back for free in many countries on landline telephone numbers
and to mobile numbers in the United States and France. So do not hesitate
to send me a note if you need vocal support.' ;
my $text_software = "$download_info\n
$next_releases\n
You will receive an invoice soon.\n
$thanks_software" ;
my $text_support = "$support_info\n
You will receive an invoice soon.\n
$thanks_support" ;
my $subject_software = "[imapsync download] imapsync release $release [$email]" ;
my $subject_support = "[imapsync support] imapsync release $release [$email]" ;
my $subject ;
my $text ;
if ( 'imapsync support' eq $object ) {
$text = $text_support ;
$subject = $subject_support ;
}else{
$text = $text_software ;
$subject = $subject_software ;
}
my $message = <<EOM
X-Comment: $rcstag
In-Reply-To: $msg_id
From: Gilles LAMIRAL <$address>
To: <$email>
Bcc: Gilles LAMIRAL <$address>, <$address2>
Subject: $subject
Hello $name,
$text
$paypal_info
$buyer
$description
==== Vendeur ====
Gilles LAMIRAL
4 La Billais
35580 Baulon
FRANCE
Tel: +33 951 84 42 42
Mob: +33 620 79 76 06
Fax: +33 956 84 42 42
email: $address
--
Au revoir, 09 51 84 42 42
Gilles Lamiral. France, Baulon (35580) 06 20 79 76 06
EOM
;
=pod
=cut
#print $message;
#print "[$amount] [$name] [$email] [$paypal_line] [$object]\n";
print "[$postal_address]
@postal_address
$country
\n" ;
sub firstline {
# extract the first line of a file (without \n)
my($file) = @_;
my $line = "";
open FILE, $file or die("error [$file]: $! ");
chomp($line = <FILE>);
close FILE;
$line = ($line) ? $line: "error !EMPTY! [$file]";
return $line;
}
sub tests {
SKIP: {
skip "No test in normal run" if ( not $tests ) ;
tests_paypal_infos() ;
}
}
sub paypal_infos {
my $paypal_infos = shift ;
$paypal_infos =~ /(\d{1,2}) (.*) (\d{4}) (\d\d):(\d\d):(\d\d) (.*) \| Num.*ro de transaction : (.*)/ ;
my( $day, $month, $year, $hour, $min, $sec, $fuseau, $transaction )
= ( $1, $2, $3, $4, $5, $6, $7, $8 ) ;
#print "$day, $month, $year, $hour, $min, $sec, $fuseau, $transaction\n" ;
return( $day, $month, $year, $hour, $min, $sec, $fuseau, $transaction ) ;
}
sub tests_paypal_infos {
#ok( 1 == 1 ) ;
my( $day, $month, $year, $hour, $min, $sec, $fuseau, $transaction )
= paypal_infos( "14 mar 2012 01:47:55 CET | Numéro de transaction : 75E02654YS4206549" ) ;
ok( '14' eq $day, 'paypal_infos: day' ) ;
ok( 'mar' eq $month, 'paypal_infos: month' ) ;
ok( '2012' eq $year, 'paypal_infos: year' ) ;
ok( '01' eq $hour, 'paypal_infos: hour' ) ;
ok( '47' eq $min, 'paypal_infos: min' ) ;
ok( '55' eq $sec, 'paypal_infos: sec' ) ;
ok( 'CET' eq $fuseau, 'paypal_infos: fuseau' ) ;
ok( '75E02654YS4206549' eq $transaction, 'paypal_infos: transaction' ) ;
( $day, $month, $year, $hour, $min, $sec, $fuseau, $transaction )
= paypal_infos( "1 fév 2012 20:18:10 CET | Numéro de transaction : 5HF11160SD123724S" ) ;
ok( '1' eq $day, 'paypal_infos: day' ) ;
ok( 'fév' eq $month, 'paypal_infos: month' ) ;
}

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# $Id: paypal_build_invoices,v 1.26 2012/02/24 12:32:56 gilles Exp gilles $ # $Id: paypal_build_invoices,v 1.29 2012/04/13 10:42:44 gilles Exp gilles $
# usage: sh paypal_build_invoices /g/var/paypal_invoices/???? # usage: sh paypal_build_invoices /g/var/paypal_invoices/????
@ -22,24 +22,28 @@ set -x
#/g/public_html/imapsync/W/paypal_reply/paypal_bilan --write_invoices --first_in 1094 /g/paypal/paypal_2011_10_complet.csv #/g/public_html/imapsync/W/paypal_reply/paypal_bilan --write_invoices --first_in 1094 /g/paypal/paypal_2011_10_complet.csv
#/g/public_html/imapsync/W/paypal_reply/paypal_bilan --write_invoices --first_in 1185 /g/paypal/paypal_2011_11_complet.csv #/g/public_html/imapsync/W/paypal_reply/paypal_bilan --write_invoices --first_in 1185 /g/paypal/paypal_2011_11_complet.csv
#/g/public_html/imapsync/W/paypal_reply/paypal_bilan --write_invoices --first_in 1263 /g/paypal/paypal_2011_12_complet.csv #/g/public_html/imapsync/W/paypal_reply/paypal_bilan --write_invoices --first_in 1263 /g/paypal/paypal_2011_12_complet.csv
/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 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 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 --first_in 147 /g/paypal/paypal_2010_11_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 : /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 214 /g/paypal/paypal_2010_12_complet.csv
: /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 294 --usdeur 1.3385 /g/paypal/paypal_2011_01_complet.csv : /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 294 --usdeur 1.3385 /g/paypal/paypal_2011_01_complet.csv
: /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 382 /g/paypal/paypal_2011_02_complet.csv : /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 382 --usdeur 1.3692 /g/paypal/paypal_2011_02_complet.csv
: /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 473 /g/paypal/paypal_2011_03_complet.csv : /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 473 --usdeur 1.3809 /g/paypal/paypal_2011_03_complet.csv
: /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 570 /g/paypal/paypal_2011_04_complet.csv : /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 570 --usdeur 1.4172 /g/paypal/paypal_2011_04_complet.csv
: /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 645 /g/paypal/paypal_2011_05_complet.csv : /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 645 --usdeur 1.4810 /g/paypal/paypal_2011_05_complet.csv
: /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 733 /g/paypal/paypal_2011_06_complet.csv : /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 /g/paypal/paypal_2011_07_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 /g/paypal/paypal_2011_08_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 /g/paypal/paypal_2011_10_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 /g/paypal/paypal_2011_11_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 /g/paypal/paypal_2011_12_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 1335 /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 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
set +x set +x
# La totale # La totale

View File

@ -83,7 +83,7 @@ extract_mail() {
convert_utf8() { convert_utf8() {
mkdir -p $tmpdir/msg_out_utf8/ mkdir -p $tmpdir/msg_out_utf8/
test -z "`ls $tmpdir/msg_out/`" && echo no mail && return test -z "`ls $tmpdir/msg_out/*_d/*.txt`" && echo no mail && return
for f in $tmpdir/msg_out/*_d/*.txt; do for f in $tmpdir/msg_out/*_d/*.txt; do
b=`basename "$f"` b=`basename "$f"`
d=`dirname "$f"` d=`dirname "$f"`
@ -113,8 +113,9 @@ troncate_last_2_chars() {
build_reply() { build_reply() {
mkdir -p $tmpdir/msg_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 for f in $tmpdir/msg_out_utf8/*/*.txt; do
#echo "$f" echo "$f"
d=`dirname "$f"` d=`dirname "$f"`
bd=`basename "$d"` bd=`basename "$d"`
file_id=`troncate_last_2_chars $bd` file_id=`troncate_last_2_chars $bd`
@ -122,6 +123,7 @@ build_reply() {
test -f "$d_reply/$file_id.txt" && continue test -f "$d_reply/$file_id.txt" && continue
mkdir -p "$d_reply" mkdir -p "$d_reply"
echo building "$d_reply/$file_id.txt" 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" paypal_build_reply "$f" "$tmpdir/msg_id/$file_id" > "$d_reply/$file_id.txt"
done done
} }
@ -139,21 +141,38 @@ build_reply_arg() {
done done
} }
build_invoice_arg() {
for f in "$@"; do
#echo "$f"
d=`dirname "$f"`
bd=`basename "$d"`
file_id=`troncate_last_2_chars $bd`
d_invoice="$tmpdir/invoices/$file_id"
echo building "$d_invoice/imapsync_var.tex"
echo paypal_build_invoice_from_email "$f" "$tmpdir/msg_id/$file_id"
paypal_build_invoice_from_email "$f" "$tmpdir/msg_id/$file_id"
done
}
debug_mode() { debug_mode() {
#return 0 return 0
return 1 return 1
} }
send_reply() { send_reply() {
mkdir -p $tmpdir/msg_sent/ mkdir -p $tmpdir/msg_sent/
test -z "`ls $tmpdir/msg_reply/*/*.txt`" && echo no mail && return
for f in $tmpdir/msg_reply/*/*.txt; do for f in $tmpdir/msg_reply/*/*.txt; do
b=`basename "$f"` b=`basename "$f"`
d=`dirname "$f"` d=`dirname "$f"`
bd=`basename "$d"` bd=`basename "$d"`
d_sent="$tmpdir/msg_sent/$bd" d_sent="$tmpdir/msg_sent/$bd"
debug_mode && echo "paypal_send $f"
test -f "$d_sent/$b" && continue test -f "$d_sent/$b" && continue
mkdir -p "$d_sent" mkdir -p "$d_sent"
debug_mode && echo "paypal_send $f"
test X"--send" = X"$1" && paypal_send --send --subscribe "$f" && touch "$d_sent/$b" test X"--send" = X"$1" && paypal_send --send --subscribe "$f" && touch "$d_sent/$b"
#test X"--send" = X"$1" && touch "$d_sent/$b" #test X"--send" = X"$1" && touch "$d_sent/$b"
test X"" = X"$1" && paypal_send "$f" test X"" = X"$1" && paypal_send "$f"
@ -218,9 +237,9 @@ paypal_all_dev() {
build_reply build_reply
echo "Done build_reply in $tmpdir/msg_reply/" echo "Done build_reply in $tmpdir/msg_reply/"
echo "Will send_reply $@" echo "Will send_reply $@"
send_reply "$@" send_reply "$@"
echo "Done send_reply $@" echo "Done send_reply $@"
} }

View File

@ -5,24 +5,20 @@
set -e set -e
#set -x #set -x
# Add path to commands at home # Add path to commands at home
PATH=$PATH:/g/public_html/imapsync/W/paypal_reply PATH=$PATH:/g/public_html/imapsync/W/paypal_reply
PERL5LIB=/g/public_html/imapsync/Mail-IMAPClient-3.28/lib PERL5LIB=/g/public_html/imapsync/Mail-IMAPClient-3.30/lib
export PERL5LIB export PERL5LIB
test -f /g/public_html/imapsync/W/paypal_reply/paypal_functions \ test -f /g/public_html/imapsync/W/paypal_reply/paypal_functions \
&& . /g/public_html/imapsync/W/paypal_reply/paypal_functions && . /g/public_html/imapsync/W/paypal_reply/paypal_functions
DATE_1=`date` DATE_1=`date`
echo "==== paypal_reply_test ====" echo "==== paypal_reply_test ===="
paypal_reply_petite_dev "$@" paypal_reply_petite_dev "$@"
echo echo
DATE_2=`date` DATE_2=`date`
echo "Debut : $DATE_1" echo "Debut : $DATE_1"

4
i3
View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# $Id: i3,v 1.8 2011/11/12 21:49:00 gilles Exp gilles $ # $Id: i3,v 1.9 2012/04/15 19:18:02 gilles Exp gilles $
BASE=`dirname $0` BASE=`dirname $0`
perl -I${BASE}/Mail-IMAPClient-3.30/lib ${BASE}/imapsync "$@" perl -I${BASE}/Mail-IMAPClient-3.31/lib ${BASE}/imapsync "$@"

View File

@ -20,7 +20,7 @@ Synchronise mailboxes between two imap servers.
Good at IMAP migration. More than 44 different IMAP server softwares Good at IMAP migration. More than 44 different IMAP server softwares
supported with success. supported with success.
$Revision: 1.487 $ $Revision: 1.488 $
=head1 SYNOPSIS =head1 SYNOPSIS
@ -519,7 +519,7 @@ Entries for imapsync:
Feedback (good or bad) will often be welcome. Feedback (good or bad) will often be welcome.
$Id: imapsync,v 1.487 2012/02/29 05:29:21 gilles Exp gilles $ $Id: imapsync,v 1.488 2012/04/15 17:38:21 gilles Exp gilles $
=cut =cut
@ -636,7 +636,7 @@ my(
# global variables initialisation # global variables initialisation
$rcs = '$Id: imapsync,v 1.487 2012/02/29 05:29:21 gilles Exp gilles $ '; $rcs = '$Id: imapsync,v 1.488 2012/04/15 17:38:21 gilles Exp gilles $ ';
$total_bytes_transferred = 0; $total_bytes_transferred = 0;
$total_bytes_skipped = 0; $total_bytes_skipped = 0;
@ -1868,8 +1868,8 @@ sub banner_imapsync {
my @argv_copy = @_; my @argv_copy = @_;
my $banner_imapsync = join("", my $banner_imapsync = join("",
'$RCSfile: imapsync,v $ ', '$RCSfile: imapsync,v $ ',
'$Revision: 1.487 $ ', '$Revision: 1.488 $ ',
'$Date: 2012/02/29 05:29:21 $ ', '$Date: 2012/04/15 17:38:21 $ ',
"\n",localhost_info(), "\n", "\n",localhost_info(), "\n",
"Command line used:\n", "Command line used:\n",
"$0 ", command_line_nopassword(@argv_copy), "\n", "$0 ", command_line_nopassword(@argv_copy), "\n",
@ -3674,7 +3674,7 @@ sub check_last_release {
} }
sub imapsync_version { sub imapsync_version {
my $rcs = '$Id: imapsync,v 1.487 2012/02/29 05:29:21 gilles Exp gilles $ '; my $rcs = '$Id: imapsync,v 1.488 2012/04/15 17:38:21 gilles Exp gilles $ ';
$rcs =~ m/,v (\d+\.\d+)/; $rcs =~ m/,v (\d+\.\d+)/;
my $VERSION = ($1) ? $1: "UNKNOWN"; my $VERSION = ($1) ? $1: "UNKNOWN";
return($VERSION); return($VERSION);
@ -4262,11 +4262,11 @@ sub delete_folders_in_2_not_in_1 {
my $dry_message = ''; my $dry_message = '';
$dry_message = "\t(not really since --dry mode)" if $dry; $dry_message = "\t(not really since --dry mode)" if $dry;
foreach my $folder (@h2_folders_not_in_1) { foreach my $folder (@h2_folders_not_in_1) {
if ( defined( $delete2foldersonly ) and eval( "\$folder !~ \$delete2foldersonly" ) ) { if ( defined( $delete2foldersonly ) and eval( "\$folder !~ $delete2foldersonly" ) ) {
print "Not deleting $folder because of --delete2foldersonly $delete2foldersonly\n"; print "Not deleting $folder because of --delete2foldersonly $delete2foldersonly\n";
next; next;
} }
if ( defined( $delete2foldersbutnot ) and eval( "\$folder =~ \$delete2foldersbutnot" ) ) { if ( defined( $delete2foldersbutnot ) and eval( "\$folder =~ $delete2foldersbutnot" ) ) {
print "Not deleting $folder because of --delete2foldersbutnot $delete2foldersbutnot\n"; print "Not deleting $folder because of --delete2foldersbutnot $delete2foldersbutnot\n";
next; next;
} }

View File

@ -5,7 +5,7 @@
<title>Imapsync: an IMAP migration tool ( release <!--#exec cmd="cat VERSION"--> )</title> <title>Imapsync: an IMAP migration tool ( release <!--#exec cmd="cat VERSION"--> )</title>
<meta name="generator" content="Bluefish 1.0.7"/> <meta name="generator" content="Bluefish 1.0.7"/>
<meta name="author" content="Gilles LAMIRAL"/> <meta name="author" content="Gilles LAMIRAL"/>
<meta name="date" content="2012-02-20T18:40:26+0100"/> <meta name="date" content="2012-04-15T21:16:36+0200"/>
<meta name="copyright" content="None"/> <meta name="copyright" content="None"/>
<meta name="keywords" content="imap, transfert, migration"/> <meta name="keywords" content="imap, transfert, migration"/>
<meta name="description" content="imap migration tool"/> <meta name="description" content="imap migration tool"/>
@ -31,7 +31,7 @@
<ul class="none"> <ul class="none">
<li>Buy <a href="#buy_source"><b>imapsync source code</b></a> (any OS)</li> <li>Buy <a href="#buy_source"><b>imapsync source code</b></a> (any OS)</li>
<li>Buy <a href="#buy_exe"><b>standalone win32</b></a> <b>imapsync.exe</b> (also <b>works on win64</b>)</li> <li>Buy <a href="#buy_exe"><b>standalone win32</b></a> <b>imapsync.exe</b> (also <b>works on win64</b>)</li>
<li>Buy professional <a href="#buy_support">imapsync <b>support</b></a> to succeed your migration</li> <li>Buy <b>full professional</b> <a href="#buy_support">imapsync <b>support</b></a> to succeed your migration</li>
<li>Are your <a href="#imap_server_success">imap servers <b>supported</b></a> by imapsync?</li> <li>Are your <a href="#imap_server_success">imap servers <b>supported</b></a> by imapsync?</li>
</ul> </ul>
@ -63,12 +63,12 @@ for <b>2 ways synchronizations</b>.
<p>Alternatives to imapsync are listed in the <a href="#similar"><b>Similar softwares</b></a> section. <p>Alternatives to imapsync are listed in the <a href="#similar"><b>Similar softwares</b></a> section.
</p> </p>
<h2><a id="NUMBERS"></a>Some numbers for past year 2011</h2> <h2><a id="NUMBERS"></a>Some numbers for 2011</h2>
<ul> <ul>
<li>Number of <b>imapsync users</b> per month: between <b>2 and 3 thousands </b>users</li> <li>Number of <b>imapsync users</b> per month: between <b>2 and 3 thousands </b>users</li>
<li>Number of <b>imapsync transfers</b> between <b>3 and 25 millions mailboxes </b>transfers per month, 93 millions in 2011</li> <li>Number of <b>imapsync transfers</b> between <b>3 and 25 millions mailboxes </b>transfers per month, total is 93 millions in 2011</li>
<li>Pourcentage between <b>operating systems</b> users running imapsync: <li>Percentage between <b>operating systems</b> users running imapsync:
<ul> <ul>
<li><b>Linux: 65 %</b></li> <li><b>Linux: 65 %</b></li>
<li><b>Win32: 18 %</b></li> <li><b>Win32: 18 %</b></li>
@ -93,6 +93,29 @@ for <b>2 ways synchronizations</b>.
<p>New features or bugfixes since previous releases:</p> <p>New features or bugfixes since previous releases:</p>
<ul>
<li><b>1.488</b></li>
<li><b>Bug fix</b>: Reverse half of the last patch about --delete2foldersonly since it destroyed a good feature permitting imapsync variables like ${h2_sep}
in --delete2foldersonly, the good escaping has to be done in the parameter value:
<ul>
<li>--delete2foldersonly --delete2foldersbutnot need good escaping in call, not in code. Example: --delete2foldersbutnot "/\[Gmail\]/"</li>
</ul>
</li>
<li>Bug fix: removed several useless Perl warnings in different contexts.</li>
</ul>
<ul>
<li><b>1.487</b></li>
<li><b>Bug fix</b>: for example the issue was <b>brackets in [Gmail] folder names</b> in the context of cache --useuid.
Thanks to Pierre GUILLAUME, applied patch about:
<ul>
<li>$cache_dir and bsd_globs() that needs escaped characters.</li>
<li>eval and --delete2foldersonly --delete2foldersbutnot that need also good escaping.</li>
</ul>
</li>
<li>Bug fix: removed several useless Perl warnings in different contexts.</li>
</ul>
<ul> <ul>
<li><b>1.484</b></li> <li><b>1.484</b></li>
<li><b>Bug fix</b>: Back to select() (read-write mode) instead of examine() (read-only mode in 1.468) on host1. <b>Needed with --delete</b></li> <li><b>Bug fix</b>: Back to select() (read-write mode) instead of examine() (read-only mode in 1.468) on host1. <b>Needed with --delete</b></li>
@ -107,13 +130,14 @@ See for example <a href="http://support.google.com/a/bin/answer.py?hl=en&amp;ans
<li><b>Better behavior</b>: Check if a message exists before fetching it (could have been deleted recently)</li> <li><b>Better behavior</b>: Check if a message exists before fetching it (could have been deleted recently)</li>
<li><b>Usability</b>: Unified outout in --debug mode. Lines start with Host1 or Host2.</li> <li><b>Usability</b>: Unified outout in --debug mode. Lines start with Host1 or Host2.</li>
<li><b>Usability</b>: Changed output about messages ignored to better reflect what is going on.</li> <li><b>Usability</b>: Changed output about messages ignored to better reflect what is going on.</li>
<li><b>Better behavior</b>: --split down to 100 by defaultto follow the recommendation of RFC2683 section 3.2.1.5 <li><b>Better behavior</b>: --split down to 100 by default to follow the recommendation of RFC2683 section 3.2.1.5
Thanks to Phil Pearl for this advice.</li> Thanks to Phil Pearl for this advice.</li>
</ul> </ul>
<ul> <ul>
<li><b>1.476</b></li> <li><b>1.476</b></li>
<li><b>Usability</b>: Added <b>start</b> and <b>end dates</b> in the final statistics.</li> <li><b>Usability</b>: Added <b>start</b> and <b>end dates</b> in the final statistics.</li>
<li><b>Better behavior</b>: Default headers used to identify a message are now "Message-Id" and "Received" (<b>Exchange compatibility</b> bu default).</li> <li><b>Better behavior</b>: Default headers used to identify a message are now "Message-Id" and "Received" (<b>Exchange compatibility</b> bu default).</li>
@ -135,7 +159,7 @@ Thanks to Phil Pearl for this advice.</li>
</ul> </ul>
--> -->
<h2><a id="DOC_BASIC"></a>Basic usage</h2> <h2><a id="DOC_BASIC"></a>Simple transfer on Windows</h2>
<p> <p>
See <b><a href="./imapsync_example.bat.txt">imapsync_example.bat.txt</a></b> batch file example See <b><a href="./imapsync_example.bat.txt">imapsync_example.bat.txt</a></b> batch file example
@ -143,7 +167,7 @@ that you can easily adapt with your parameters (remove .txt extension in order t
</p> </p>
<h2><a id="DOC_MASS"></a>Huge usage</h2> <h2><a id="DOC_MASS"></a>Massive transfers</h2>
<p> <p>
See <b><a href="./file.txt">file.txt</a></b> example for <b>batch massive migration</b> See <b><a href="./file.txt">file.txt</a></b> example for <b>batch massive migration</b>
@ -171,20 +195,22 @@ See <b><a href="./file.txt">file.txt</a></b> example for <b>batch massive migrat
<p>Buy <b>latest</b> imapsync Perl <b>source code</b> for <b>42 EUR</b> <p>Buy <b>latest</b> imapsync Perl <b>source code</b> for <b>42 EUR</b>
</p> </p>
<p>
<b>+ One year</b> of imapsync <b>updates</b> without extra payment.<br/>
<b>+ 30 days money-back guarantee!</b><br/>
<b>+ A little support</b>.
</p>
<p>
42 EUR is equal to around <b>54 USD</b>, no problem to pay in USD (or any currency) with paypal:
</p>
<p> <p>
The Perl <b>imapsync</b> source code will run anywhere a <b>Perl interpreter can run</b>: any Unix, Linux, Windows, or Mac OS operating system. The Perl <b>imapsync</b> source code will run anywhere a <b>Perl interpreter can run</b>: any Unix, Linux, Windows, or Mac OS operating system.
</p> </p>
<p>
<b>+ One year</b> of imapsync <b>updates</b> without extra payment.<br/>
<b>+ 30 days money-back guarantee!</b><br/>
<b>+ Limited support</b>.
</p>
<p>
Payment by Paypal account and credit card accepted. <br/>
Price <b>42 EUR</b> is equal to around <b>54 USD</b>, no problem to pay in USD (or any currency) via paypal:
</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<p> <p>
<input type="hidden" name="cmd" value="_s-xclick"/> <input type="hidden" name="cmd" value="_s-xclick"/>
@ -203,15 +229,16 @@ name="submit" alt="PayPal - The safer, easier way to pay online!"/>
<p>You will receive a download link <b>just after</b> the payment. <p>You will receive a download link <b>just after</b> the payment.
</p> </p>
<h2><a id="buy_support"></a>Buy professional support for imapsync</h2> <h2><a id="buy_support"></a>Buy full professional support for imapsync</h2>
<p>You will be able to expose your issues by email or phone and to converse until your issues are solved. <p>You will be able to expose your issues by email or phone and we'll work together until complete success.
</p> </p>
<p>For <b>180 EUR</b> buy imapsync <b>support</b> by the developper who wrote and maintains imapsync. <p>For <b>90 EUR</b> buy imapsync <b>full support</b> done by the imapsync designer/developper.
</p> </p>
<p> <p>
180 EUR is equal to around <b>230 USD</b>, no problem to pay in USD (or any currency) with paypal: Payment by Paypal account and credit card accepted. <br/>
90 EUR is equal to around <b>120 USD</b>, no problem to pay in USD (or any currency) with paypal:
</p> </p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
@ -239,12 +266,12 @@ buying the latest win32 <b>standalone imapsync.exe</b> for <b>42 EUR</b>
<p> <p>
<b>+ One year</b> of imapsync <b>updates</b> without extra payment.<br/> <b>+ One year</b> of imapsync <b>updates</b> without extra payment.<br/>
<b>+ 30 days money-back guarantee!</b><br/> <b>+ 30 days money-back guarantee!</b><br/>
<b>+ A little support</b>. <b>+ Limited support</b>.
</p> </p>
<p> <p>
42 EUR is equal to around <b>54 USD</b>, no problem to pay in USD (or any currency) with paypal: Payment by Paypal account and credit card accepted. <br/>
Price <b>42 EUR</b> is equal to around <b>54 USD</b>, no problem to pay in USD (or any currency) via paypal:
</p> </p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
@ -284,8 +311,7 @@ The build system for imapsync.exe is XP Pro SP2 on a Intel Celeron 400 MHz 256 M
<p>The <a href="FAQ">FAQ</a> file presents Frequently Asked Questions (and not so frequently asked ones). <p>The <a href="FAQ">FAQ</a> file presents Frequently Asked Questions (and not so frequently asked ones).
</p> </p>
<p>The <a href="TODO">TODO</a> file list what may be coded or done in the future.<br/> <p>The <a href="TODO">TODO</a> file list what may be coded or done in the future.
See also the <a href="#WANTED">wanted</a> section.
</p> </p>
<p>All the people I thank are in the <a href="CREDITS">CREDITS</a> file. <p>All the people I thank are in the <a href="CREDITS">CREDITS</a> file.
@ -343,20 +369,6 @@ See also the <a href="#WANTED">wanted</a> section.
</p> </p>
<h2><a id="WANTED"></a>WANTED!</h2>
<p>I fix bugs as soon as possible and I code new features when I find them useful.<br/>
Don't hesitate to ask for them.
</p>
<p>Some features and their time to be done evaluation:</p>
<table cellpadding="10" cellspacing="0" border="1">
<tr align="right"><th>DONE</th><th>Feature </th><th>Time guessed</th><th>Time spent</th></tr>
<tr align="right"><td> <b>No</b></td><td>Backup to files </td><td>20 hours </td><td> 60 min </td></tr>
<tr align="right"><td> <b>No</b></td><td>Efficient Gmail backup </td><td>20 hours </td><td> 80 min </td></tr>
<tr align="right"><td> <b>No</b></td><td>Better error reporting </td><td> 5 hours </td><td> 0 min </td></tr>
</table>
<h2><a id="imap_server_success"></a>Lists of imap server software failures and success stories</h2> <h2><a id="imap_server_success"></a>Lists of imap server software failures and success stories</h2>
@ -481,7 +493,8 @@ Prices are given par mailbox and may be outdated (december 2011).</p>
<li> Migrationwiz 10 USD: <a href="http://www.migrationwiz.com/">http://www.migrationwiz.com/</a></li> <li> Migrationwiz 10 USD: <a href="http://www.migrationwiz.com/">http://www.migrationwiz.com/</a></li>
<li> Rackspace migration 10 USD: <a href="http://www.rackspace.com/apps/email_hosting/migrations/">http://www.rackspace.com/apps/email_hosting/migrations/</a></li> <li> Rackspace migration 10 USD: <a href="http://www.rackspace.com/apps/email_hosting/migrations/">http://www.rackspace.com/apps/email_hosting/migrations/</a></li>
<li> Yippiemove 15 USD: <a href="http://www.yippiemove.com">http://www.yippiemove.com/</a></li> <li> Yippiemove 15 USD: <a href="http://www.yippiemove.com">http://www.yippiemove.com/</a></li>
<li>Trueswitch 29.5 USD: <a href="http://www.trueswitch.com">http://www.trueswitch.com</a></li> <li> Audriga Gmbh 14.99 EUR : <a href="https://www.email-umzug.de/en.html">https://www.email-umzug.de/</a></li>
<li> Trueswitch 29.5 USD: <a href="http://www.trueswitch.com">http://www.trueswitch.com</a></li>
</ul> </ul>
<hr/> <hr/>
@ -510,7 +523,7 @@ alt="Viewable With Any Browser" />
<!--#config timefmt="%D" --> <!--#config timefmt="%D" -->
<!--#config timefmt="%A %B %d, %Y" --> <!--#config timefmt="%A %B %d, %Y" -->
<b>This document last modified on <!--#echo var="LAST_MODIFIED" --></b> <b>This document last modified on <!--#echo var="LAST_MODIFIED" --></b>
($Id: index.shtml,v 1.112 2012/02/20 18:23:06 gilles Exp gilles $) ($Id: index.shtml,v 1.117 2012/04/15 19:16:51 gilles Exp gilles $)
</p> </p>
</body> </body>

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# $Id: tests.sh,v 1.192 2012/02/25 14:41:47 gilles Exp gilles $ # $Id: tests.sh,v 1.194 2012/04/15 19:17:33 gilles Exp gilles $
# Example 1: # Example 1:
# CMD_PERL='perl -I./Mail-IMAPClient-3.25/lib' sh -x tests.sh # CMD_PERL='perl -I./Mail-IMAPClient-3.25/lib' sh -x tests.sh
@ -23,7 +23,7 @@ echo HOST2=$HOST2
# few debugging tests use: # few debugging tests use:
CMD_PERL_2xx='perl -I./Mail-IMAPClient-2.2.9' CMD_PERL_2xx='perl -I./Mail-IMAPClient-2.2.9'
CMD_PERL_3xx='perl -I./Mail-IMAPClient-3.30/lib' CMD_PERL_3xx='perl -I./Mail-IMAPClient-3.31/lib'
CMD_PERL=${CMD_PERL:-$CMD_PERL_3xx} CMD_PERL=${CMD_PERL:-$CMD_PERL_3xx}
@ -248,6 +248,8 @@ ll_folder() {
--folder INBOX.yop --folder INBOX.Trash --folder INBOX.yop --folder INBOX.Trash
} }
ll_folder_noexist() { ll_folder_noexist() {
! $CMD_PERL ./imapsync \ ! $CMD_PERL ./imapsync \
--host1 $HOST1 --user1 tata \ --host1 $HOST1 --user1 tata \
@ -449,7 +451,8 @@ ll_delete2foldersonly() {
--justfolders --nofoldersizes \ --justfolders --nofoldersizes \
--regextrans2 's,${h1_prefix}(.*),${h2_prefix}NEW${h2_sep}$1,' \ --regextrans2 's,${h1_prefix}(.*),${h2_prefix}NEW${h2_sep}$1,' \
--regextrans2 's,^INBOX$,${h2_prefix}NEW${h2_sep}INBOX,' \ --regextrans2 's,^INBOX$,${h2_prefix}NEW${h2_sep}INBOX,' \
--delete2foldersonly '/${h2_prefix}NEW/' --delete2foldersonly '/${h2_prefix}NEW/' --dry
# --delete2foldersonly '${h2_prefix}NEW'
} }
ll_delete2foldersonly_tmp() { ll_delete2foldersonly_tmp() {
@ -471,7 +474,7 @@ ll_delete2foldersbutnot() {
--host2 $HOST2 --user2 titi \ --host2 $HOST2 --user2 titi \
--passfile2 ../../var/pass/secret.titi \ --passfile2 ../../var/pass/secret.titi \
--justfolders --nofoldersizes \ --justfolders --nofoldersizes \
--delete2foldersbutnot '/NEW_2|NEW_3/' \ --delete2foldersbutnot '/NEW_2|NEW_3|\[abc\]/' \
--dry --dry
} }
@ -1260,6 +1263,32 @@ ll_regexmess_scwchu()
echo 'rm /home/vmail/titi/.scwchu/cur/*' echo 'rm /home/vmail/titi/.scwchu/cur/*'
} }
ll_regexmess_wong()
{
$CMD_PERL ./imapsync \
--host1 $HOST1 --user1 tata \
--passfile1 ../../var/pass/secret.tata \
--host2 $HOST2 --user2 titi \
--passfile2 ../../var/pass/secret.titi \
--folder INBOX.scwchu \
--regexmess 's{\A}{Content-Type: text/plain; charset="big5"\n}gxms' \
--debugcontent --debug
echo "sudo sh -c 'rm /home/vmail/titi/.scwchu/cur/*'"
}
ll_regexmess_wong_2()
{
#Received: from hkuhp22.hku.hk
$CMD_PERL ./imapsync \
--host1 $HOST1 --user1 tata \
--passfile1 ../../var/pass/secret.tata \
--host2 $HOST2 --user2 titi \
--passfile2 ../../var/pass/secret.titi \
--folder INBOX.scwchu \
--regexmess 's{\A(.*?(?!^$))^(Received: from hkuhp22.hku.hk.*?)$}{$1Content-Type: text/plain; charset="big5"\n$2}gms' \
--debugcontent --debug --dry
echo "sudo sh -c 'rm /home/vmail/titi/.scwchu/cur/*'"
}
ll_flags() ll_flags()
{ {
@ -1648,6 +1677,17 @@ ll_memory_consumption() {
} }
ll_remove_duplicates() {
$CMD_PERL ./imapsync \
--host1 $HOST1 --user1 tata \
--passfile1 ../../var/pass/secret.tata \
--host2 $HOST1 --user2 tata \
--passfile2 ../../var/pass/secret.tata \
--folder INBOX.duplicates --delete2
}
msw() { msw() {
if can_send; then if can_send; then
sendtestmessage toto sendtestmessage toto
@ -1678,13 +1718,13 @@ msw2() {
xxxxx_gmail() { xxxxx_gmail() {
! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \ ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
--host1 $HOST2 \
--user1 tata \
--passfile1 ../../var/pass/secret.tata \
--host2 imap.gmail.com \ --host2 imap.gmail.com \
--ssl2 \ --ssl2 \
--user2 gilles.lamiral@gmail.com \ --user2 gilles.lamiral@gmail.com \
--passfile2 ../../var/pass/secret.gilles_gmail \ --passfile2 ../../var/pass/secret.gilles_gmail \
--host1 $HOST2 \
--user1 tata \
--passfile1 ../../var/pass/secret.tata \
--nofoldersizes \ --nofoldersizes \
--justfolders --regextrans2 's/ //g' --exclude 'INBOX.yop.YAP' --exclude Gmail --justfolders --regextrans2 's/ //g' --exclude 'INBOX.yop.YAP' --exclude Gmail
} }
@ -1763,13 +1803,13 @@ xxxxx_gmail_5_justlogin() {
xxxxx_gmail_6() { xxxxx_gmail_6() {
! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \ ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
--host1 $HOST2 \
--user1 tata \
--passfile1 ../../var/pass/secret.tata \
--host2 imap.gmail.com \ --host2 imap.gmail.com \
--ssl2 \ --ssl2 \
--user2 gilles.lamiral@gmail.com \ --user2 gilles.lamiral@gmail.com \
--passfile2 ../../var/pass/secret.gilles_gmail \ --passfile2 ../../var/pass/secret.gilles_gmail \
--host1 $HOST2 \
--user1 tata \
--passfile1 ../../var/pass/secret.tata \
--nofoldersizes \ --nofoldersizes \
--justfolders \ --justfolders \
--regextrans2 "s, +$,,g" --regextrans2 "s, +/,/,g" \ --regextrans2 "s, +$,,g" --regextrans2 "s, +/,/,g" \
@ -1778,6 +1818,20 @@ xxxxx_gmail_6() {
#--dry --prefix2 '[Gmail]/' #--dry --prefix2 '[Gmail]/'
} }
xxxxx_gmail_7() {
! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
--host1 $HOST2 \
--user1 tata \
--passfile1 ../../var/pass/secret.tata \
--host2 imap.gmail.com \
--ssl2 \
--user2 gilles.lamiral@gmail.com \
--passfile2 ../../var/pass/secret.gilles_gmail \
--nofoldersizes \
--folder INBOX.yop.yap
}
gmail_xxxxx() { gmail_xxxxx() {