add option to make sure there are imap deleted messages before doing an expunge, off by default, patch by mikael@parknet.se, r=neil, sr=bienvenu 235004

This commit is contained in:
bienvenu%nventure.com 2004-10-12 17:17:18 +00:00
Родитель 36c0e3afff
Коммит 2e94252f62
2 изменённых файлов: 23 добавлений и 4 удалений

Просмотреть файл

@ -321,6 +321,7 @@ static PRBool gHideUnusedNamespaces = PR_TRUE;
static PRBool gHideOtherUsersFromList = PR_FALSE; static PRBool gHideOtherUsersFromList = PR_FALSE;
static PRBool gUseEnvelopeCmd = PR_FALSE; static PRBool gUseEnvelopeCmd = PR_FALSE;
static PRBool gUseLiteralPlus = PR_TRUE; static PRBool gUseLiteralPlus = PR_TRUE;
static PRBool gCheckDeletedBeforeExpunge = PR_FALSE; //bug 235004
nsresult nsImapProtocol::GlobalInitialization() nsresult nsImapProtocol::GlobalInitialization()
{ {
@ -343,6 +344,7 @@ nsresult nsImapProtocol::GlobalInitialization()
prefBranch->GetBoolPref("mail.imap.use_envelope_cmd", prefBranch->GetBoolPref("mail.imap.use_envelope_cmd",
&gUseEnvelopeCmd); &gUseEnvelopeCmd);
prefBranch->GetBoolPref("mail.imap.use_literal_plus", &gUseLiteralPlus); prefBranch->GetBoolPref("mail.imap.use_literal_plus", &gUseLiteralPlus);
prefBranch->GetBoolPref("mail.imap.check_deleted_before_expunge", &gCheckDeletedBeforeExpunge);
return NS_OK; return NS_OK;
} }
@ -4772,9 +4774,23 @@ void
nsImapProtocol::Expunge() nsImapProtocol::Expunge()
{ {
ProgressEventFunctionUsingId (IMAP_STATUS_EXPUNGING_MAILBOX); 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(); IncrementCommandTagNumber();
nsCAutoString command(GetServerCommandTag());
nsCString command(GetServerCommandTag());
command.Append(" expunge"CRLF); command.Append(" expunge"CRLF);
nsresult rv = SendData(command.get()); nsresult rv = SendData(command.get());

Просмотреть файл

@ -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_max_depth", 15);
pref("mail.imap.mime_parts_on_demand_threshold", 30000); pref("mail.imap.mime_parts_on_demand_threshold", 30000);
pref("mail.imap.use_literal_plus", true); pref("mail.imap.use_literal_plus", true);
pref("mail.imap.check_deleted_before_expunge", false);
pref("mail.thread_without_re", true); pref("mail.thread_without_re", true);
pref("mail.leave_on_server", false); pref("mail.leave_on_server", false);
pref("mail.default_cc", ""); 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.valid", true);
pref("mail.identity.default.fcc",true); pref("mail.identity.default.fcc",true);
pref("mail.identity.default.fcc_folder","mailbox://nobody@Local%20Folders/Sent"); 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. // but .doBcc and .doBccList are the right ones from now on.
pref("mail.identity.default.bcc_self",false); pref("mail.identity.default.bcc_self",false);
pref("mail.identity.default.bcc_others",false); pref("mail.identity.default.bcc_others",false);