diff --git a/mailnews/local/src/nsLocalMailFolder.cpp b/mailnews/local/src/nsLocalMailFolder.cpp index 6850f91faaed..628e28ef3fb7 100644 --- a/mailnews/local/src/nsLocalMailFolder.cpp +++ b/mailnews/local/src/nsLocalMailFolder.cpp @@ -674,6 +674,45 @@ nsMsgLocalMailFolder::CreateSubfolder(const char *folderName) return rv; } +NS_IMETHODIMP nsMsgLocalMailFolder::Compact() +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + + +NS_IMETHODIMP nsMsgLocalMailFolder::EmptyTrash() +{ + nsresult rv; + nsCOMPtr trashFolder; + rv = GetTrashFolder(getter_AddRefs(trashFolder)); + if (NS_SUCCEEDED(rv)) + { + nsCOMPtr parent; + rv = GetParent(getter_AddRefs(parent)); + if (NS_SUCCEEDED(rv) && parent) + { + nsCOMPtr parentFolder; + parentFolder = do_QueryInterface(parent, &rv); + if (NS_SUCCEEDED(rv) && parentFolder) + { + nsXPIDLString idlFolderName; + rv = trashFolder->GetName(getter_Copies(idlFolderName)); + if (NS_SUCCEEDED(rv)) + { + nsString folderName(idlFolderName); + char *cStringName = folderName.ToNewCString(); + trashFolder->SetParent(nsnull); + parentFolder->PropagateDelete(trashFolder, PR_TRUE); + parentFolder->CreateSubfolder(cStringName); + nsCRT::free(cStringName); + } + } + } + } + return rv; +} + + NS_IMETHODIMP nsMsgLocalMailFolder::Delete() { nsresult rv = GetDatabase(); diff --git a/mailnews/local/src/nsLocalMailFolder.h b/mailnews/local/src/nsLocalMailFolder.h index 534d1c2dc7d9..3b2fcf8db80b 100644 --- a/mailnews/local/src/nsLocalMailFolder.h +++ b/mailnews/local/src/nsLocalMailFolder.h @@ -96,6 +96,8 @@ public: NS_IMETHOD CreateSubfolder(const char *folderName); NS_IMETHOD AddSubfolder(nsAutoString *folderName, nsIMsgFolder** newFolder); + NS_IMETHOD Compact(); + NS_IMETHOD EmptyTrash(); NS_IMETHOD Delete (); NS_IMETHOD Rename (const char *newName); NS_IMETHOD Adopt(nsIMsgFolder *srcFolder, PRUint32 *outPos);