From 7aafe6e5e722d6494fc7e9dadcf389f5b707da75 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Wed, 9 Mar 2011 22:22:36 +0000 Subject: [PATCH] There could more then one message fetch failing, count them to notify the listener. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40892 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../inbound_protocols/imap/imap_lib/IMAPHandler.cpp | 12 +++++++----- .../inbound_protocols/imap/imap_lib/IMAPHandler.h | 2 +- 2 files changed, 8 insertions(+), 6 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 c0f8501e99..aa2139b7e2 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 @@ -318,16 +318,18 @@ FetchMessageCommand::FetchMessageCommand(IMAPMailbox& mailbox, fMessage(firstMessage), fEndMessage(lastMessage), fOutData(NULL), - fFetchBodyLimit(fetchBodyLimit), - fHandled(false) + fFetchBodyLimit(fetchBodyLimit) { - + if (fEndMessage > 0) + fUnhandled = fEndMessage - fMessage + 1; + else + fUnhandled = 1; } FetchMessageCommand::~FetchMessageCommand() { - if (!fHandled) + for (int32 i = 0; i < fUnhandled; i++) fIMAPMailbox.Listener().FetchEnd(); } @@ -409,7 +411,7 @@ FetchMessageCommand::Handle(const BString& response) BString lastLine; fConnectionReader.GetNextLine(lastLine); - fHandled = true; + fUnhandled--; bool bodyIsComing = true; if (fFetchBodyLimit >= 0 && fFetchBodyLimit <= messageSize) diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPHandler.h b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPHandler.h index d9f7bb8986..031db60ceb 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPHandler.h +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPHandler.h @@ -140,7 +140,7 @@ private: int32 fEndMessage; BPositionIO* fOutData; int32 fFetchBodyLimit; - bool fHandled; + int32 fUnhandled; };