From 165991b56aeb1427e116f5762c189381984bb242 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Fri, 18 Mar 2011 04:49:32 +0000 Subject: [PATCH] When fetching the message body also fetch the flags in one go. For example, gmail does not send flag change updates. If a message is marked as read by another client the haiku client at least updates the flags and mark it as read when fetching the body. Thats the way Opera is doing it. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41018 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../inbound_protocols/imap/imap_lib/IMAPHandler.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPHandler.cpp b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPHandler.cpp index a0a81962c3..0b5510fa81 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPHandler.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPHandler.cpp @@ -454,7 +454,7 @@ FetchBodyCommand::Command() { BString command = "FETCH "; command << fMessage; - command += " BODY.PEEK[TEXT]"; + command += " (FLAGS BODY.PEEK[TEXT])"; return command; } @@ -464,14 +464,17 @@ FetchBodyCommand::Handle(const BString& response) { if (response.FindFirst("FETCH") < 0) return false; + BString extracted = response; int32 message; if (!IMAPParser::RemoveUntagedFromLeft(extracted, "FETCH", message)) return false; - if (message != fMessage) return false; + int32 flags = FetchMinMessageCommand::ExtractFlags(extracted); + fStorage.SetFlags(fIMAPMailbox.MessageNumberToUID(message), flags); + int32 textPos = extracted.FindFirst("BODY[TEXT]"); if (textPos < 0) return false;