diff --git a/ChangeLog b/ChangeLog index b180b2f..5845f30 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,15 +1,41 @@ RCS file: RCS/imapsync,v Working file: imapsync -head: 1.31 +head: 1.37 branch: locks: strict access list: symbolic names: keyword substitution: kv -total revisions: 31; selected revisions: 31 +total revisions: 37; selected revisions: 37 description: ---------------------------- +revision 1.37 +date: 2003/10/16 01:37:52; author: gilles; state: Exp; lines: +9 -8 +Added a loop in case there is several identical key header +---------------------------- +revision 1.36 +date: 2003/10/16 01:23:51; author: gilles; state: Exp; lines: +4 -38 +Removed commented code in parse section. +---------------------------- +revision 1.35 +date: 2003/10/16 01:22:52; author: gilles; state: Exp; lines: +20 -19 +Use of parse_header_msg() in "to" server +---------------------------- +revision 1.34 +date: 2003/10/16 01:18:07; author: gilles; state: Exp; lines: +49 -24 +Wrote parse_header_msg() +Use of parse_header_msg for "from" server. +---------------------------- +revision 1.33 +date: 2003/10/16 00:47:43; author: gilles; state: Exp; lines: +6 -6 +Added prefix in debug output for headers +---------------------------- +revision 1.32 +date: 2003/10/16 00:36:17; author: gilles; state: Exp; lines: +17 -5 +Added code to check internal dates +Commented code about internal dates +---------------------------- revision 1.31 date: 2003/08/28 16:07:28; author: gilles; state: Exp; lines: +5 -5 Fixed bug converting separators diff --git a/README b/README index c7dab01..89ad4e4 100644 --- a/README +++ b/README @@ -1,7 +1,7 @@ NAME imapsync - synchronize mailboxes between two imap servers. - $Revision: 1.31 $ + $Revision: 1.37 $ INSTALL Get imapsync at http://www.linux-france.org/prj/imapsync/dist/ @@ -126,5 +126,5 @@ SIMILAR SOFTWARES Feedback (good or bad) will be always welcome. - $Id: imapsync,v 1.31 2003/08/28 16:07:28 gilles Exp $ + $Id: imapsync,v 1.37 2003/10/16 01:37:52 gilles Exp $ diff --git a/TODO b/TODO index cf59a4f..7493225 100644 --- a/TODO +++ b/TODO @@ -9,3 +9,11 @@ Update the list of tested IMAP servers (successes and failures). Add a CREDITS file. +Pb with namespace INBOX. +http://www.inter7.com/courierimap/FAQ.html#namespace +http://www.rfc-editor.org/rfc/rfc2342.txt + +Pb with date + +Pb with \Recent flag + diff --git a/VERSION b/VERSION index d0911c8..c7fafb2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.31 +1.37 diff --git a/imapsync b/imapsync index 8ff8968..1b90c9c 100755 --- a/imapsync +++ b/imapsync @@ -4,7 +4,7 @@ imapsync - synchronize mailboxes between two imap servers. -$Revision: 1.31 $ +$Revision: 1.37 $ =head1 INSTALL @@ -146,7 +146,7 @@ Rate imapsync : http://freshmeat.net/projects/imapsync/ Feedback (good or bad) will be always welcome. -$Id: imapsync,v 1.31 2003/08/28 16:07:28 gilles Exp $ +$Id: imapsync,v 1.37 2003/10/16 01:37:52 gilles Exp $ =cut @@ -169,12 +169,12 @@ my( use vars qw ($opt_G); # missing code for this will be option. -$rcs = ' $Id: imapsync,v 1.31 2003/08/28 16:07:28 gilles Exp $ '; +$rcs = ' $Id: imapsync,v 1.37 2003/10/16 01:37:52 gilles Exp $ '; $rcs =~ m/,v (\d+\.\d+)/; $VERSION = ($1) ? $1 : "UNKNOWN"; $error=0; -my $banner = '$RCSfile: imapsync,v $ ' . '$Revision: 1.31 $ ' . '$Date: 2003/08/28 16:07:28 $ ' . "\n"; +my $banner = '$RCSfile: imapsync,v $ ' . '$Revision: 1.37 $ ' . '$Date: 2003/10/16 01:37:52 $ ' . "\n"; get_options(); @@ -318,44 +318,12 @@ FOLDER: foreach my $f_fold (@f_folders) { $debug and print "From Parse\n"; foreach my $m (@f_msgs) { - $debug and print "-" x 50, "\nMSG $m\n"; - my $head = $from->parse_headers($m,"ALL"); - my $headstr; - $debug and print "Head NUM:", scalar(keys(%$head)), "\n"; - next unless(scalar(keys(%$head))); - foreach my $h (sort keys(%$head)){ - my $val = $head->{$h}[0]; - # no accent in headers ! - $val =~ y/יטאש/XXXX/; - $debug and print "H $h:", $val, "\n"; - $headstr .= "$h:". $val; - } - my $m_md5 = md5_base64($headstr); - my $size = $from->size($m); - $debug and print "From $m:$m_md5:$size\n"; - - $f_hash{"$m_md5:$size"}{'5'} = "$m_md5:$size"; - $f_hash{"$m_md5:$size"}{'s'} = $size; - $f_hash{"$m_md5:$size"}{'m'} = $m; + parse_header_msg($m, $from, "F", \%f_hash); } $debug and print "To Parse\n"; foreach my $m (@t_msgs) { - $debug and print "-" x 50, "\nMSG $m\n"; - my $head = $to->parse_headers($m,"ALL"); - my $headstr; - $debug and print "Head NUM:", scalar(keys(%$head)), "\n"; - next unless(scalar(keys(%$head))); - foreach my $h (sort keys(%$head)){ - $debug and print "$h:", $head->{$h}[0], "\n"; - $headstr .= "$h:".$head->{$h}[0]; - } - my $m_md5 = md5_base64($headstr); - my $size = $to->size($m); - $debug and print "To $m:$m_md5:$size\n"; - $t_hash{"$m_md5:$size"}{'5'} = "$m_md5:$size"; - $t_hash{"$m_md5:$size"}{'s'} = $size; - $t_hash{"$m_md5:$size"}{'m'} = $m; + parse_header_msg($m, $to, "T", \%t_hash); } $debug and print "Verifying\n"; # messages in "from" that are not good in "to" @@ -370,6 +338,10 @@ FOLDER: foreach my $f_fold (@f_folders) { print "Copying msg #$f_msg:$f_size to folder $t_fold\n"; unless ($dry) { my $string = $from->message_string($f_msg); + #my $d = $from->internaldate($f_msg); + #my $date_f = `date -d"$d" "+%d-%b-%Y %T %z"`; + #print "date from 1: [$d]\n"; + #print "date from 2: [$date_f]\n"; my $flags_f = join(" ", @{$from->flags($f_msg)}); my $new_id; print "flags from : [$flags_f]\n"; @@ -404,7 +376,15 @@ FOLDER: foreach my $f_fold (@f_folders) { $debug and print "flags from : @flags_f\n", "flags to : @flags_t\n"; - + $debug and print "Looking dates\n"; + my $d_f = $from->internaldate($f_msg); + my $d_t = $to->internaldate($t_msg); + $debug and print + "idate from : $d_f\n", + "idate to : $d_t\n"; + #unless ($d_f eq $d_t) { + # print "!!! Dates differ !!!\n"; + #} unless ($f_size == $t_size) { # Bad size print @@ -471,6 +451,31 @@ sub get_options } +sub parse_header_msg { + + my ($m, $imap, $s, $s_hash) = @_; + $debug and print "-" x 50, "\nMSG $m\n"; + my $head = $imap->parse_headers($m,"ALL"); + my $headstr; + $debug and print "Head NUM:", scalar(keys(%$head)), "\n"; + return unless(scalar(keys(%$head))); + foreach my $h (sort keys(%$head)){ + foreach my $val ( @{$head->{$h}}) { + # no accent in headers ! + $val =~ y/יטאש/XXXX/; + $debug and print "${s}H $h:", $val, "\n"; + $headstr .= "$h:". $val; + } + } + my $m_md5 = md5_base64($headstr); + my $size = $imap->size($m); + $debug and print "$s msg $m:$m_md5:$size\n"; + + $s_hash->{"$m_md5:$size"}{'5'} = "$m_md5:$size"; + $s_hash->{"$m_md5:$size"}{'s'} = $size; + $s_hash->{"$m_md5:$size"}{'m'} = $m; +} + sub firstline { # extract the first line of a file (without \n) diff --git a/zz b/learn/zz similarity index 100% rename from zz rename to learn/zz