From bfe62cfa341fea4183b1f1fc34e2dfedf4e91db3 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Sun, 18 May 2008 21:27:02 +0000 Subject: [PATCH] Only peek at IMAP messages, as we set the read flag manually --- mailboxes/folders-lib.pl | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/mailboxes/folders-lib.pl b/mailboxes/folders-lib.pl index 786ca9033..f35762a6c 100644 --- a/mailboxes/folders-lib.pl +++ b/mailboxes/folders-lib.pl @@ -173,7 +173,7 @@ elsif ($_[2]->{'type'} == 4) { else { # Whole messages @rv = &imap_command($h, - sprintf "FETCH %d:%d (UID FLAGS RFC822)", $start+1, $end+1); + sprintf "FETCH %d:%d (UID FLAGS BODY.PEEK[])", $start+1, $end+1); } # Parse the headers or whole messages that came back @@ -447,7 +447,7 @@ elsif ($folder->{'type'} == 4) { # hitting a the IMAP server's max request limit local @rv = map { undef } @$ids; local $wanted = $headersonly ? "(RFC822.SIZE UID FLAGS RFC822.HEADER)" - : "(UID FLAGS RFC822)"; + : "(UID FLAGS BODY.PEEK[])"; if (@$ids) { for(my $chunk=0; $chunk<@$ids; $chunk+=1000) { local $chunkend = $chunk+999; @@ -2991,23 +2991,13 @@ for(my $i=0; $i[$i]; - push(@needmail, $mail); - $oldread{$mail->{'id'}} = &get_mail_read($folder, $mail); + push(@needmail, $mails->[$i]); } @needmail = &mailbox_select_mails($folder, [ map { $_->{'id'} } @needmail ], 0); foreach my $i (@needbody) { $mails->[$i] = shift(@needmail); } - if (defined(&set_mail_read)) { - # Put back original read flag, as the select will clobber it - # on the IMAP server - foreach my $i (@needbody) { - local $mail = $mails->[$i]; - &set_mail_read($folder, $mail, $oldread{$mail->{'id'}}); - } - } } # Now we have bodies, check for attachments