зеркало из https://github.com/mozilla/pjs.git
Fix for 153465. In nsImapService::DeleteFolder(), if it's an aol server then use the new 'deletefolder' url to remove all msgs and the folder itself. r=naving, sr=bienvenu.
This commit is contained in:
Родитель
d61a5fd58f
Коммит
eb8506950b
|
@ -182,6 +182,8 @@ interface nsIImapUrl : nsISupports
|
||||||
const long nsImapSaveMessageToDisk = 0x10000030;
|
const long nsImapSaveMessageToDisk = 0x10000030;
|
||||||
const long nsImapOpenMimePart = 0x10000031;
|
const long nsImapOpenMimePart = 0x10000031;
|
||||||
const long nsImapMsgDownloadForOffline = 0x10000032;
|
const long nsImapMsgDownloadForOffline = 0x10000032;
|
||||||
|
const long nsImapDeleteFolderAndMsgs = 0x10000033;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
%{C++
|
%{C++
|
||||||
|
|
|
@ -2039,6 +2039,9 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
HandleMemoryFailure();
|
HandleMemoryFailure();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case nsIImapUrl::nsImapDeleteFolderAndMsgs:
|
||||||
|
DeleteFolderAndMsgs(mailboxName);
|
||||||
|
break;
|
||||||
case nsIImapUrl::nsImapDeleteAllMsgs:
|
case nsIImapUrl::nsImapDeleteAllMsgs:
|
||||||
{
|
{
|
||||||
uint32 numberOfMessages = GetServerStateParser().NumberOfMessages();
|
uint32 numberOfMessages = GetServerStateParser().NumberOfMessages();
|
||||||
|
@ -5719,6 +5722,31 @@ void nsImapProtocol::OnDeleteFolder(const char * sourceMailbox)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void nsImapProtocol::RemoveMsgsAndExpunge()
|
||||||
|
{
|
||||||
|
uint32 numberOfMessages = GetServerStateParser().NumberOfMessages();
|
||||||
|
if (numberOfMessages)
|
||||||
|
{
|
||||||
|
// Remove all msgs and expunge the folder (ie, compact it).
|
||||||
|
Store("1:*", "+FLAGS.SILENT (\\Deleted)", PR_FALSE); // use sequence #'s
|
||||||
|
if (GetServerStateParser().LastCommandSuccessful())
|
||||||
|
Expunge();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void nsImapProtocol::DeleteFolderAndMsgs(const char * sourceMailbox)
|
||||||
|
{
|
||||||
|
RemoveMsgsAndExpunge();
|
||||||
|
if (GetServerStateParser().LastCommandSuccessful())
|
||||||
|
{
|
||||||
|
// All msgs are deleted successfully - let's remove the folder itself.
|
||||||
|
PRBool reportingErrors = GetServerStateParser().GetReportingErrors();
|
||||||
|
GetServerStateParser().SetReportingErrors(PR_FALSE);
|
||||||
|
OnDeleteFolder(sourceMailbox);
|
||||||
|
GetServerStateParser().SetReportingErrors(reportingErrors);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void nsImapProtocol::OnRenameFolder(const char * sourceMailbox)
|
void nsImapProtocol::OnRenameFolder(const char * sourceMailbox)
|
||||||
{
|
{
|
||||||
char *destinationMailbox = OnCreateServerDestinationFolderPathString();
|
char *destinationMailbox = OnCreateServerDestinationFolderPathString();
|
||||||
|
|
|
@ -492,6 +492,8 @@ private:
|
||||||
void OnDeleteFolder(const char * aSourceMailbox);
|
void OnDeleteFolder(const char * aSourceMailbox);
|
||||||
void OnRenameFolder(const char * aSourceMailbox);
|
void OnRenameFolder(const char * aSourceMailbox);
|
||||||
void OnMoveFolderHierarchy(const char * aSourceMailbox);
|
void OnMoveFolderHierarchy(const char * aSourceMailbox);
|
||||||
|
void DeleteFolderAndMsgs(const char * aSourceMailbox);
|
||||||
|
void RemoveMsgsAndExpunge();
|
||||||
void FindMailboxesIfNecessary();
|
void FindMailboxesIfNecessary();
|
||||||
void CreateMailbox(const char *mailboxName);
|
void CreateMailbox(const char *mailboxName);
|
||||||
void DeleteMailbox(const char *mailboxName);
|
void DeleteMailbox(const char *mailboxName);
|
||||||
|
|
|
@ -1569,6 +1569,18 @@ nsImapService::DeleteFolder(nsIEventQueue* eventQueue,
|
||||||
nsCOMPtr<nsIImapUrl> imapUrl;
|
nsCOMPtr<nsIImapUrl> imapUrl;
|
||||||
nsCAutoString urlSpec;
|
nsCAutoString urlSpec;
|
||||||
|
|
||||||
|
// If it's an aol server then use 'deletefolder' url to
|
||||||
|
// remove all msgs first and then remove the folder itself.
|
||||||
|
PRBool removeFolderAndMsgs = PR_FALSE;
|
||||||
|
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||||
|
if (NS_SUCCEEDED(folder->GetServer(getter_AddRefs(server))) && server)
|
||||||
|
{
|
||||||
|
nsCOMPtr <nsIImapIncomingServer> imapServer = do_QueryInterface(server);
|
||||||
|
if (imapServer)
|
||||||
|
imapServer->GetIsAOLServer(&removeFolderAndMsgs);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
PRUnichar hierarchySeparator = GetHierarchyDelimiter(folder);
|
PRUnichar hierarchySeparator = GetHierarchyDelimiter(folder);
|
||||||
rv = CreateStartOfImapUrl(nsnull, getter_AddRefs(imapUrl), folder, urlListener, urlSpec, hierarchySeparator);
|
rv = CreateStartOfImapUrl(nsnull, getter_AddRefs(imapUrl), folder, urlListener, urlSpec, hierarchySeparator);
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
|
@ -1578,6 +1590,9 @@ nsImapService::DeleteFolder(nsIEventQueue* eventQueue,
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIURI> uri = do_QueryInterface(imapUrl);
|
nsCOMPtr<nsIURI> uri = do_QueryInterface(imapUrl);
|
||||||
|
|
||||||
|
if (removeFolderAndMsgs)
|
||||||
|
urlSpec.Append("/deletefolder>");
|
||||||
|
else
|
||||||
urlSpec.Append("/delete>");
|
urlSpec.Append("/delete>");
|
||||||
urlSpec.Append(char(hierarchySeparator));
|
urlSpec.Append(char(hierarchySeparator));
|
||||||
|
|
||||||
|
|
|
@ -635,6 +635,11 @@ void nsImapUrl::ParseImapPart(char *imapPartOfUrl)
|
||||||
m_imapAction = nsImapDeleteFolder;
|
m_imapAction = nsImapDeleteFolder;
|
||||||
ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
|
ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
|
||||||
}
|
}
|
||||||
|
else if (!nsCRT::strcasecmp(m_urlidSubString, "deletefolder"))
|
||||||
|
{
|
||||||
|
m_imapAction = nsImapDeleteFolderAndMsgs;
|
||||||
|
ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
|
||||||
|
}
|
||||||
else if (!nsCRT::strcasecmp(m_urlidSubString, "rename"))
|
else if (!nsCRT::strcasecmp(m_urlidSubString, "rename"))
|
||||||
{
|
{
|
||||||
m_imapAction = nsImapRenameFolder;
|
m_imapAction = nsImapRenameFolder;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче