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:
cavin%netscape.com 2002-06-21 21:55:10 +00:00
Родитель d61a5fd58f
Коммит eb8506950b
5 изменённых файлов: 53 добавлений и 1 удалений

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

@ -182,6 +182,8 @@ interface nsIImapUrl : nsISupports
const long nsImapSaveMessageToDisk = 0x10000030;
const long nsImapOpenMimePart = 0x10000031;
const long nsImapMsgDownloadForOffline = 0x10000032;
const long nsImapDeleteFolderAndMsgs = 0x10000033;
};
%{C++

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

@ -2039,6 +2039,9 @@ void nsImapProtocol::ProcessSelectedStateURL()
HandleMemoryFailure();
}
break;
case nsIImapUrl::nsImapDeleteFolderAndMsgs:
DeleteFolderAndMsgs(mailboxName);
break;
case nsIImapUrl::nsImapDeleteAllMsgs:
{
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)
{
char *destinationMailbox = OnCreateServerDestinationFolderPathString();

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

@ -492,6 +492,8 @@ private:
void OnDeleteFolder(const char * aSourceMailbox);
void OnRenameFolder(const char * aSourceMailbox);
void OnMoveFolderHierarchy(const char * aSourceMailbox);
void DeleteFolderAndMsgs(const char * aSourceMailbox);
void RemoveMsgsAndExpunge();
void FindMailboxesIfNecessary();
void CreateMailbox(const char *mailboxName);
void DeleteMailbox(const char *mailboxName);

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

@ -1569,6 +1569,18 @@ nsImapService::DeleteFolder(nsIEventQueue* eventQueue,
nsCOMPtr<nsIImapUrl> imapUrl;
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);
rv = CreateStartOfImapUrl(nsnull, getter_AddRefs(imapUrl), folder, urlListener, urlSpec, hierarchySeparator);
if (NS_SUCCEEDED(rv))
@ -1578,7 +1590,10 @@ nsImapService::DeleteFolder(nsIEventQueue* eventQueue,
{
nsCOMPtr<nsIURI> uri = do_QueryInterface(imapUrl);
urlSpec.Append("/delete>");
if (removeFolderAndMsgs)
urlSpec.Append("/deletefolder>");
else
urlSpec.Append("/delete>");
urlSpec.Append(char(hierarchySeparator));
nsXPIDLCString folderName;

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

@ -635,6 +635,11 @@ void nsImapUrl::ParseImapPart(char *imapPartOfUrl)
m_imapAction = nsImapDeleteFolder;
ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
}
else if (!nsCRT::strcasecmp(m_urlidSubString, "deletefolder"))
{
m_imapAction = nsImapDeleteFolderAndMsgs;
ParseFolderPath(&m_sourceCanonicalFolderPathSubString);
}
else if (!nsCRT::strcasecmp(m_urlidSubString, "rename"))
{
m_imapAction = nsImapRenameFolder;