diff --git a/mailnews/imap/src/nsImapProtocol.cpp b/mailnews/imap/src/nsImapProtocol.cpp index d0200f932eb..086f97d4c03 100644 --- a/mailnews/imap/src/nsImapProtocol.cpp +++ b/mailnews/imap/src/nsImapProtocol.cpp @@ -321,6 +321,7 @@ static PRBool gHideUnusedNamespaces = PR_TRUE; static PRBool gHideOtherUsersFromList = PR_FALSE; static PRBool gUseEnvelopeCmd = PR_FALSE; static PRBool gUseLiteralPlus = PR_TRUE; +static PRBool gCheckDeletedBeforeExpunge = PR_FALSE; //bug 235004 nsresult nsImapProtocol::GlobalInitialization() { @@ -343,6 +344,7 @@ nsresult nsImapProtocol::GlobalInitialization() prefBranch->GetBoolPref("mail.imap.use_envelope_cmd", &gUseEnvelopeCmd); prefBranch->GetBoolPref("mail.imap.use_literal_plus", &gUseLiteralPlus); + prefBranch->GetBoolPref("mail.imap.check_deleted_before_expunge", &gCheckDeletedBeforeExpunge); return NS_OK; } @@ -4772,9 +4774,23 @@ void nsImapProtocol::Expunge() { ProgressEventFunctionUsingId (IMAP_STATUS_EXPUNGING_MAILBOX); + + if(gCheckDeletedBeforeExpunge) + { + GetServerStateParser().ResetSearchResultSequence(); + Search("SEARCH DELETED", PR_FALSE, PR_FALSE); + if (GetServerStateParser().LastCommandSuccessful()) + { + nsImapSearchResultIterator *search = GetServerStateParser().CreateSearchResultIterator(); + nsMsgKey key = search->GetNextMessageNumber(); + delete search; + if (key == 0) + return; //no deleted messages to expunge (bug 235004) + } + } + IncrementCommandTagNumber(); - - nsCString command(GetServerCommandTag()); + nsCAutoString command(GetServerCommandTag()); command.Append(" expunge"CRLF); nsresult rv = SendData(command.get()); diff --git a/mailnews/mailnews.js b/mailnews/mailnews.js index e4435d2dadd..eff44522999 100644 --- a/mailnews/mailnews.js +++ b/mailnews/mailnews.js @@ -101,6 +101,7 @@ pref("mail.imap.mime_parts_on_demand", true); pref("mail.imap.mime_parts_on_demand_max_depth", 15); pref("mail.imap.mime_parts_on_demand_threshold", 30000); pref("mail.imap.use_literal_plus", true); +pref("mail.imap.check_deleted_before_expunge", false); pref("mail.thread_without_re", true); pref("mail.leave_on_server", false); pref("mail.default_cc", ""); @@ -316,8 +317,10 @@ pref("mail.identity.default.compose_html", true); pref("mail.identity.default.valid", true); pref("mail.identity.default.fcc",true); pref("mail.identity.default.fcc_folder","mailbox://nobody@Local%20Folders/Sent"); - -// keep these defaults for backwards compatibility and migration + + +// keep these defaults for backwards compatibility and migration + // but .doBcc and .doBccList are the right ones from now on. pref("mail.identity.default.bcc_self",false); pref("mail.identity.default.bcc_others",false);