diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_client.cpp b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_client.cpp index a252dc8cd5..c0d36cdd6c 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_client.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_client.cpp @@ -958,7 +958,9 @@ IMAP4Client::ReceiveLine(BString &out) } }else{ // Log an error somewhere instead + runner->Stop(); runner->ShowError("IMAP Timeout."); + return B_TIMED_OUT; } PRINT(("S:%s\n",out.String())); return len; @@ -1120,7 +1122,9 @@ int IMAP4Client::GetResponse(BString &tag, NestedString *parsed_response, bool r } }else{ // Log an error somewhere instead + runner->Stop(); runner->ShowError("IMAP Timeout."); + return B_TIMED_OUT; } return answer; } diff --git a/src/kits/mail/ChainRunner.cpp b/src/kits/mail/ChainRunner.cpp index e8597eff82..d48b637bb0 100644 --- a/src/kits/mail/ChainRunner.cpp +++ b/src/kits/mail/ChainRunner.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -335,7 +336,7 @@ BMailChainRunner::MessageReceived(BMessage *msg) case 'INIT': if (init_addons() == B_OK) break; - case 'STOP': { + case B_QUIT_REQUESTED: { CallCallbacksFor(chain_cb, B_OK); // who knows what the code was? @@ -539,7 +540,13 @@ BMailChainRunner::get_messages(BStringList *list) void BMailChainRunner::Stop() { - PostMessage('STOP'); + BMessageQueue *looper_queue = MessageQueue(); + looper_queue->Lock(); + BMessage *msg; + while (msg = looper_queue->NextMessage()) delete msg; //-- Ensure STOP makes the front of the queue + + PostMessage(B_QUIT_REQUESTED); + looper_queue->Unlock(); }