Subject: | Message set "1:*" is buggy in fetch_hash( "1:*", "RFC822.SIZE", $hash_ref) |
Date: | Wed, 24 Jun 2015 02:49:45 +0200 |
To: | bug-Mail-IMAPClient [...] rt.cpan.org |
From: | Gilles LAMIRAL <gilles.lamiral [...] laposte.net> |
Hello Phil,
Message set "1:*" is buggy in fetch_hash( "1:*", "RFC822.SIZE", $hash_ref)
It doesn't work.
It does
UID FETCH 1: (* RFC822.SIZE )
instead of
UID FETCH 1:* ( RFC822.SIZE )
For example, the following code is buggy in 3.35
print "==== fetch_hash\n" ;
my $hashref = {} ;
$imap->fetch_hash( "1:*", "RFC822.SIZE", $hashref ) ;
The fix is easy, just permit the * in sub fetch_hash() when
considering the message set.
sub fetch() does not have this bug.
gilles@petite:~/public_html/imapsync/W/Mail-IMAPClient-3.35/lib/Mail 54$ diff IMAPClient.pm-3.35 IMAPClient.pm
2151c2151
< elsif ( $words[0] =~ s/^([,:\d]+)\s*// ) {
---
Show quoted text
> elsif ( $words[0] =~ s/^([,:\d\*]+)\s*// ) {
Attached is a full example to show and fix this bug.
It's called mail2world because I'm patching imapsync to allow
a successful sync with the weird IMAP4 Mail2World 2.6 server.
By the way a documentation example is wrong about fetch_hash
http://search.cpan.org/~plobbes/Mail-IMAPClient-3.35/lib/Mail/IMAPClient.pod#fetch_hash
my $hashref = {};
$imap->fetch_hash( "RFC822.SIZE", $hashref );
print "Msg #$m is $hashref->{$m} bytes\n" foreach my $m (keys %$hashref);
In this example
$hashref->{$m} should be instead
$hashref->{$m}->{'RFC822.SIZE'}
to print each message size.
Thanks in advance Phil!
Have a nice week.
--
Au revoir, 09 51 84 42 42
Gilles Lamiral. France, Baulon (35580) 06 20 79 76 06
Message body is not shown because sender requested not to inline it.