mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 01:48:05 +00:00
41720 r=bivenvenu sr=sspitzer. Make the filters work on rename and warn and
disable the filter on delete of a folder. Also added msgWindow to some pop mail retrieval and filter routines.
This commit is contained in:
parent
31d4fa1710
commit
472546ee63
@ -136,8 +136,8 @@ const nsMsgBiffState nsMsgBiffState_Unknown = 2; // We dunno whether there is ne
|
||||
void Delete ();
|
||||
|
||||
void deleteSubFolders(in nsISupportsArray folders, in nsIMsgWindow msgWindow);
|
||||
void propagateDelete(in nsIMsgFolder folder, in boolean deleteStorage);
|
||||
void recursiveDelete(in boolean deleteStorage);
|
||||
void propagateDelete(in nsIMsgFolder folder, in boolean deleteStorage, in nsIMsgWindow msgWindow);
|
||||
void recursiveDelete(in boolean deleteStorage, in nsIMsgWindow msgWindow);
|
||||
|
||||
void createSubfolder(in wstring folderName, in nsIMsgWindow msgWindow);
|
||||
[noscript] nsIMsgFolder addSubfolder(in nsAutoString folderName);
|
||||
@ -366,6 +366,7 @@ const nsMsgBiffState nsMsgBiffState_Unknown = 2; // We dunno whether there is ne
|
||||
const unsigned long allMessageCountNotifications = 0;
|
||||
void enableNotifications(in long notificationType, in boolean enable);
|
||||
boolean isCommandEnabled(in string command);
|
||||
boolean changeFilterDestination(in nsIMsgFolder folder, in boolean caseInsensitive);
|
||||
|
||||
attribute nsIMsgRetentionSettings retentionSettings;
|
||||
attribute nsIMsgDownloadSettings downloadSettings;
|
||||
|
@ -64,6 +64,7 @@ sendingUnsent=Sending Unsent Messages
|
||||
|
||||
compactingFolder=Compacting folder %S...
|
||||
autoCompactAllFolders=Do you wish to compact all local and offline folders because the total wasted space in all accounts exceeds the purge threshhold?
|
||||
disableFilter=Filters that are affected by deleting '%S' folder are now disabled.
|
||||
|
||||
# LOCALIZATION NOTES(verboseFolderFormat): %1$S is folder name, %2$S is server name
|
||||
verboseFolderFormat=%1$S on %2$S
|
||||
|
@ -92,7 +92,8 @@ interface nsIMsgFilterList : nsISupports {
|
||||
in string headers,
|
||||
//[array, size_is(headerSize)] in string headers,
|
||||
in unsigned long headerSize,
|
||||
in nsIMsgFilterHitNotify listener);
|
||||
in nsIMsgFilterHitNotify listener,
|
||||
in nsIMsgWindow msgWindow);
|
||||
|
||||
// IO routines, used by filter object filing code.
|
||||
|
||||
@ -100,6 +101,8 @@ interface nsIMsgFilterList : nsISupports {
|
||||
void writeStrAttr(in nsMsgFilterFileAttribValue attrib, in string value, in nsIOFileStream stream);
|
||||
void writeWstrAttr(in nsMsgFilterFileAttribValue attrib, in wstring value, in nsIOFileStream stream);
|
||||
void writeBoolAttr(in nsMsgFilterFileAttribValue attrib, in boolean value, in nsIOFileStream stream);
|
||||
boolean changeFilterTarget(in string oldUri, in string newUri, in boolean caseInsensitive);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -223,10 +223,15 @@ NS_IMETHODIMP nsMsgFilter::SetActionPriority(nsMsgPriorityValue aPriority)
|
||||
NS_IMETHODIMP
|
||||
nsMsgFilter::SetActionTargetFolderUri(const char *aUri)
|
||||
{
|
||||
nsresult rv=NS_OK;
|
||||
NS_ENSURE_TRUE(m_action.m_type == nsMsgFilterAction::MoveToFolder,
|
||||
NS_ERROR_ILLEGAL_VALUE);
|
||||
m_action.m_folderUri = aUri;
|
||||
return NS_OK;
|
||||
if (aUri)
|
||||
m_action.m_folderUri = aUri;
|
||||
else
|
||||
SetEnabled(PR_FALSE);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -253,7 +258,8 @@ nsMsgFilter::GetActionTargetFolderUri(char** aResult)
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
NS_ENSURE_TRUE(m_action.m_type == nsMsgFilterAction::MoveToFolder,
|
||||
NS_ERROR_ILLEGAL_VALUE);
|
||||
*aResult = m_action.m_folderUri.ToNewCString();
|
||||
if (m_action.m_folderUri)
|
||||
*aResult = m_action.m_folderUri.ToNewCString();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -389,12 +395,14 @@ nsresult nsMsgFilter::ConvertMoveToFolderValue(nsCString &moveValue)
|
||||
if (rootFolder)
|
||||
{
|
||||
rootFolder->FindSubFolder (m_action.m_originalServerPath, getter_AddRefs(destIFolder));
|
||||
|
||||
nsCOMPtr <nsIMsgFolder> msgFolder;
|
||||
msgFolder = do_QueryInterface(destIFolder);
|
||||
destIFolder->GetURI(getter_Copies(folderUri));
|
||||
m_action.m_folderUri.Assign(folderUri);
|
||||
moveValue.Assign(folderUri);
|
||||
if (destIFolder)
|
||||
{
|
||||
nsCOMPtr <nsIMsgFolder> msgFolder;
|
||||
msgFolder = do_QueryInterface(destIFolder);
|
||||
destIFolder->GetURI(getter_Copies(folderUri));
|
||||
m_action.m_folderUri.Assign(folderUri);
|
||||
moveValue.Assign(folderUri);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -444,21 +452,20 @@ nsresult nsMsgFilter::ConvertMoveToFolderValue(nsCString &moveValue)
|
||||
#endif
|
||||
destFolderUri.Append('/');
|
||||
destFolderUri.Append(moveValue);
|
||||
//local folders are case-insensitive
|
||||
localMailRootMsgFolder->GetChildWithURI (destFolderUri, PR_TRUE, PR_TRUE /*caseInsensitive*/, getter_AddRefs(destIMsgFolder));
|
||||
localMailRootMsgFolder->GetChildWithURI (destFolderUri, PR_TRUE, PR_FALSE /*caseInsensitive*/, getter_AddRefs(destIMsgFolder));
|
||||
|
||||
if (destIMsgFolder)
|
||||
{
|
||||
destIMsgFolder->GetURI(getter_Copies(folderUri));
|
||||
m_action.m_folderUri.Assign(folderUri);
|
||||
m_action.m_folderUri.Assign(folderUri);
|
||||
moveValue.Assign(folderUri);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
m_action.m_folderUri = moveValue;
|
||||
|
||||
SetActionTargetFolderUri(moveValue);
|
||||
|
||||
return NS_OK;
|
||||
// set m_action.m_value.m_folderUri
|
||||
}
|
||||
|
@ -120,7 +120,8 @@ nsMsgFilterList::ApplyFiltersToHdr(nsMsgFilterTypeType filterType,
|
||||
nsIMsgDatabase *db,
|
||||
const char *headers,
|
||||
PRUint32 headersSize,
|
||||
nsIMsgFilterHitNotify *listener)
|
||||
nsIMsgFilterHitNotify *listener,
|
||||
nsIMsgWindow *msgWindow)
|
||||
{
|
||||
nsCOMPtr <nsIMsgFilter> filter;
|
||||
PRUint32 filterCount = 0;
|
||||
@ -891,8 +892,52 @@ nsMsgFilterList::GetVersion(PRInt16 *aResult)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP nsMsgFilterList::ChangeFilterTarget(const char *oldFolderUri, const char *newFolderUri, PRBool caseInsensitive, PRBool *changed)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
PRUint32 numFilters;
|
||||
rv = m_filters->Count(&numFilters);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
nsCOMPtr <nsIMsgFilter> filter;
|
||||
nsMsgRuleActionType actionType;
|
||||
nsXPIDLCString folderUri;
|
||||
nsCOMPtr <nsISupports> filterSupports;
|
||||
for (PRUint32 index = 0; index < numFilters; index++)
|
||||
{
|
||||
filterSupports = getter_AddRefs(m_filters->ElementAt(index));
|
||||
filter = do_QueryInterface(filterSupports, &rv);
|
||||
if (NS_SUCCEEDED(rv) && filter)
|
||||
{
|
||||
rv = filter->GetAction(&actionType);
|
||||
if (NS_SUCCEEDED(rv) && actionType == nsMsgFilterAction::MoveToFolder)
|
||||
{
|
||||
rv = filter->GetActionTargetFolderUri(getter_Copies(folderUri));
|
||||
if (NS_SUCCEEDED(rv) && folderUri)
|
||||
if (caseInsensitive)
|
||||
{
|
||||
if (PL_strcasecmp(folderUri,oldFolderUri) == 0 ) //local
|
||||
{
|
||||
rv = filter->SetActionTargetFolderUri(newFolderUri);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
if (changed) //for rename it will be null
|
||||
*changed =PR_TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (PL_strcmp(folderUri,oldFolderUri) == 0 ) //imap
|
||||
{
|
||||
rv = filter->SetActionTargetFolderUri(newFolderUri);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
if (changed) //for rename it will be null;
|
||||
*changed =PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
void nsMsgFilterList::Dump()
|
||||
{
|
||||
|
@ -1525,3 +1525,27 @@ nsMsgDBFolder::GetPurgeThreshold(PRInt32 *aThreshold)
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP //called on the folder that is renamed or about to be deleted
|
||||
nsMsgDBFolder::ChangeFilterDestination(nsIMsgFolder *newFolder, PRBool caseInsensitive, PRBool *changed)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr <nsIMsgFilterList> filterList;
|
||||
rv = GetFilterList(getter_AddRefs(filterList));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsXPIDLCString oldUri;
|
||||
rv = GetURI(getter_Copies(oldUri));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsXPIDLCString newUri;
|
||||
if (newFolder) //for delete this will be null
|
||||
{
|
||||
rv = newFolder->GetURI(getter_Copies(newUri));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
}
|
||||
|
||||
rv = filterList->ChangeFilterTarget(oldUri, newUri, caseInsensitive, changed);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -100,6 +100,7 @@ public:
|
||||
NS_IMETHOD GetOfflineStoreOutputStream(nsIOutputStream **outputStream);
|
||||
NS_IMETHOD GetOfflineStoreInputStream(nsIInputStream **outputStream);
|
||||
NS_IMETHOD IsCommandEnabled(const char *command, PRBool *result);
|
||||
NS_IMETHOD ChangeFilterDestination(nsIMsgFolder *oldFolder, PRBool caseInsensitive, PRBool *changed);
|
||||
|
||||
protected:
|
||||
virtual nsresult ReadDBFolderInfo(PRBool force);
|
||||
|
@ -53,6 +53,12 @@
|
||||
#include "nsIIOService.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIMsgWindow.h"
|
||||
#include "nsIPrompt.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsTextFormatter.h"
|
||||
|
||||
static NS_DEFINE_CID(kStandardUrlCID, NS_STANDARDURL_CID);
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
@ -1040,7 +1046,7 @@ NS_IMETHODIMP nsMsgFolder::DeleteSubFolders(nsISupportsArray *folders,
|
||||
nsCOMPtr<nsISupports> supports = getter_AddRefs(folders->ElementAt(i));
|
||||
folder = do_QueryInterface(supports);
|
||||
if(folder)
|
||||
PropagateDelete(folder, PR_TRUE);
|
||||
PropagateDelete(folder, PR_TRUE, msgWindow);
|
||||
}
|
||||
return rv;
|
||||
|
||||
@ -1055,7 +1061,7 @@ NS_IMETHODIMP nsMsgFolder::CreateStorageIfMissing(nsIUrlListener* /* urlListener
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::PropagateDelete(nsIMsgFolder *folder, PRBool deleteStorage)
|
||||
NS_IMETHODIMP nsMsgFolder::PropagateDelete(nsIMsgFolder *folder, PRBool deleteStorage, nsIMsgWindow *msgWindow)
|
||||
{
|
||||
nsresult status = NS_OK;
|
||||
|
||||
@ -1076,7 +1082,7 @@ NS_IMETHODIMP nsMsgFolder::PropagateDelete(nsIMsgFolder *folder, PRBool deleteSt
|
||||
//Remove self as parent
|
||||
child->SetParent(nsnull);
|
||||
// maybe delete disk storage for it, and its subfolders
|
||||
status = child->RecursiveDelete(deleteStorage);
|
||||
status = child->RecursiveDelete(deleteStorage, msgWindow);
|
||||
|
||||
if (status == NS_OK)
|
||||
{
|
||||
@ -1097,7 +1103,7 @@ NS_IMETHODIMP nsMsgFolder::PropagateDelete(nsIMsgFolder *folder, PRBool deleteSt
|
||||
}
|
||||
else
|
||||
{
|
||||
status = child->PropagateDelete (folder, deleteStorage);
|
||||
status = child->PropagateDelete (folder, deleteStorage, msgWindow);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1105,7 +1111,7 @@ NS_IMETHODIMP nsMsgFolder::PropagateDelete(nsIMsgFolder *folder, PRBool deleteSt
|
||||
return status;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::RecursiveDelete(PRBool deleteStorage)
|
||||
NS_IMETHODIMP nsMsgFolder::RecursiveDelete(PRBool deleteStorage, nsIMsgWindow *msgWindow)
|
||||
{
|
||||
// If deleteStorage is PR_TRUE, recursively deletes disk storage for this folder
|
||||
// and all its subfolders.
|
||||
@ -1125,7 +1131,7 @@ NS_IMETHODIMP nsMsgFolder::RecursiveDelete(PRBool deleteStorage)
|
||||
if(NS_SUCCEEDED(status))
|
||||
{
|
||||
child->SetParent(nsnull);
|
||||
status = child->RecursiveDelete(deleteStorage); // recur
|
||||
status = child->RecursiveDelete(deleteStorage,msgWindow); // recur
|
||||
if (NS_SUCCEEDED(status))
|
||||
{
|
||||
mSubFolders->RemoveElement(supports); // unlink it from this's child list
|
||||
@ -1144,9 +1150,12 @@ NS_IMETHODIMP nsMsgFolder::RecursiveDelete(PRBool deleteStorage)
|
||||
}
|
||||
|
||||
// now delete the disk storage for _this_
|
||||
if (deleteStorage && (status == NS_OK))
|
||||
status = Delete();
|
||||
|
||||
if (deleteStorage && (status == NS_OK))
|
||||
{
|
||||
if ((mFlags & MSG_FOLDER_FLAG_TRASH) == 0)
|
||||
WarnAndDisableFilter(msgWindow);
|
||||
status = Delete();
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -2554,3 +2563,45 @@ NS_IMETHODIMP nsMsgFolder::GenerateMessageURI(nsMsgKey msgKey, char **aURI)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsMsgFolder::WarnAndDisableFilter(nsIMsgWindow *msgWindow)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
PRBool changed;
|
||||
rv = ChangeFilterDestination(nsnull, PR_FALSE, &changed);
|
||||
if (msgWindow && changed)
|
||||
{
|
||||
nsCOMPtr <nsIDocShell> docShell;
|
||||
msgWindow->GetRootDocShell(getter_AddRefs(docShell));
|
||||
nsCOMPtr<nsIStringBundleService> bundleService =
|
||||
do_GetService(NS_STRINGBUNDLE_CONTRACTID);
|
||||
if (bundleService)
|
||||
{
|
||||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
bundleService->CreateBundle("chrome://messenger/locale/messenger.properties",
|
||||
getter_AddRefs(bundle));
|
||||
if (bundle)
|
||||
{
|
||||
nsXPIDLString formatString;
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("disableFilter").get(),
|
||||
getter_Copies(formatString));
|
||||
nsXPIDLString folderName;
|
||||
GetName(getter_Copies(folderName));
|
||||
if (folderName && formatString)
|
||||
{
|
||||
PRUnichar *alertString = nsTextFormatter::smprintf(formatString.get(), folderName.get());
|
||||
if (docShell)
|
||||
{
|
||||
nsCOMPtr<nsIPrompt> dialog(do_GetInterface(docShell));
|
||||
if (dialog && alertString)
|
||||
{
|
||||
dialog->Alert(nsnull, alertString);
|
||||
nsTextFormatter::smprintf_free(alertString);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
@ -91,8 +91,8 @@ public:
|
||||
NS_IMETHOD Delete(void);
|
||||
NS_IMETHOD DeleteSubFolders(nsISupportsArray *folders, nsIMsgWindow *msgWindow);
|
||||
NS_IMETHOD CreateStorageIfMissing(nsIUrlListener* urlListener);
|
||||
NS_IMETHOD PropagateDelete(nsIMsgFolder *folder, PRBool deleteStorage);
|
||||
NS_IMETHOD RecursiveDelete(PRBool deleteStorage);
|
||||
NS_IMETHOD PropagateDelete(nsIMsgFolder *folder, PRBool deleteStorage, nsIMsgWindow *msgWindow);
|
||||
NS_IMETHOD RecursiveDelete(PRBool deleteStorage, nsIMsgWindow *msgWindow);
|
||||
NS_IMETHOD CreateSubfolder(const PRUnichar *folderName, nsIMsgWindow *msgWindow);
|
||||
NS_IMETHOD AddSubfolder(nsAutoString *folderName, nsIMsgFolder **newFolder);
|
||||
NS_IMETHOD Compact(nsIUrlListener *aListener, nsIMsgWindow *msgWindow);
|
||||
@ -231,7 +231,7 @@ protected:
|
||||
|
||||
// helper routine to parse the URI and update member variables
|
||||
nsresult parseURI(PRBool needServer=PR_FALSE);
|
||||
|
||||
nsresult WarnAndDisableFilter(nsIMsgWindow *msgWindow);
|
||||
protected:
|
||||
PRUint32 mFlags;
|
||||
nsWeakPtr mParent; //This won't be refcounted for ownership reasons.
|
||||
@ -261,7 +261,6 @@ protected:
|
||||
PRInt32 mNumNewBiffMessages;
|
||||
|
||||
PRBool mIsCachable;
|
||||
|
||||
//
|
||||
// stuff from the uri
|
||||
//
|
||||
|
@ -1202,7 +1202,7 @@ NS_IMETHODIMP nsImapIncomingServer::PossibleImapMailbox(const char *folderPath,
|
||||
if (hideFolder)
|
||||
{
|
||||
nsCOMPtr<nsISupports> support(do_QueryInterface(child, &rv));
|
||||
a_nsIFolder->PropagateDelete(child, PR_FALSE);
|
||||
a_nsIFolder->PropagateDelete(child, PR_FALSE, nsnull);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1139,7 +1139,7 @@ NS_IMETHODIMP nsImapMailFolder::EmptyTrash(nsIMsgWindow *msgWindow,
|
||||
aSupportsArray->RemoveElementAt(i);
|
||||
aFolder = do_QueryInterface(aSupport);
|
||||
if (aFolder)
|
||||
trashFolder->PropagateDelete(aFolder, PR_TRUE);
|
||||
trashFolder->PropagateDelete(aFolder, PR_TRUE, msgWindow);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2019,7 +2019,7 @@ nsImapMailFolder::DeleteSubFolders(nsISupportsArray* folders, nsIMsgWindow *msgW
|
||||
}
|
||||
|
||||
if (confirmed && deleteNoTrash) //delete subfolders only if you are deleting things from trash
|
||||
return nsMsgFolder::DeleteSubFolders(folders, nsnull);
|
||||
return nsMsgFolder::DeleteSubFolders(folders, msgWindow);
|
||||
else
|
||||
return rv;
|
||||
}
|
||||
@ -2038,7 +2038,6 @@ NS_IMETHODIMP nsImapMailFolder::GetNewMessages(nsIMsgWindow *aWindow, nsIUrlList
|
||||
if (NS_SUCCEEDED(rv) && imapServer)
|
||||
imapServer->GetDownloadBodiesOnGetNewMail(&m_downloadingFolderForOfflineUse);
|
||||
|
||||
|
||||
// Check preferences to see if we should check all folders for new
|
||||
// messages, or just the inbox.
|
||||
PRBool checkAllFolders = PR_FALSE;
|
||||
@ -2463,7 +2462,7 @@ NS_IMETHODIMP nsImapMailFolder::NormalEndHeaderParseStream(nsIImapProtocol*
|
||||
if (!m_moveCoalescer)
|
||||
m_moveCoalescer = new nsImapMoveCoalescer(this, msgWindow);
|
||||
m_filterList->ApplyFiltersToHdr(nsMsgFilterType::InboxRule, newMsgHdr, this, mDatabase,
|
||||
headers, headersSize, this);
|
||||
headers, headersSize, this, msgWindow);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2661,7 +2660,11 @@ NS_IMETHODIMP nsImapMailFolder::ApplyFilterHit(nsIMsgFilter *filter, PRBool *app
|
||||
{
|
||||
|
||||
if (actionType == nsMsgFilterAction::MoveToFolder)
|
||||
{
|
||||
filter->GetActionTargetFolderUri(getter_Copies(actionTargetFolderUri));
|
||||
if (!actionTargetFolderUri || !actionTargetFolderUri[0])
|
||||
return rv;
|
||||
}
|
||||
nsCOMPtr<nsIMsgDBHdr> msgHdr;
|
||||
|
||||
if (m_msgParser)
|
||||
@ -2709,7 +2712,7 @@ NS_IMETHODIMP nsImapMailFolder::ApplyFilterHit(nsIMsgFilter *filter, PRBool *app
|
||||
rv = GetURI(getter_Copies(uri));
|
||||
|
||||
if ((const char*)actionTargetFolderUri &&
|
||||
nsCRT::strcasecmp(uri, actionTargetFolderUri))
|
||||
nsCRT::strcmp(uri, actionTargetFolderUri))
|
||||
{
|
||||
msgHdr->GetFlags(&msgFlags);
|
||||
|
||||
@ -5687,6 +5690,7 @@ NS_IMETHODIMP nsImapMailFolder::RenameClient( nsIMsgFolder *msgFolder, const cha
|
||||
nsAutoString unicodeOnlineName; unicodeOnlineName.AssignWithConversion(onlineName);
|
||||
folderInfo->SetMailboxName(&unicodeOnlineName);
|
||||
}
|
||||
msgFolder->ChangeFilterDestination(child, PR_FALSE /*caseInsensitive*/, nsnull);
|
||||
}
|
||||
unusedDB->SetSummaryValid(PR_TRUE);
|
||||
unusedDB->Commit(nsMsgDBCommitType::kLargeCommit);
|
||||
@ -5699,7 +5703,7 @@ NS_IMETHODIMP nsImapMailFolder::RenameClient( nsIMsgFolder *msgFolder, const cha
|
||||
msgFolder->GetParent(getter_AddRefs(parent));
|
||||
nsCOMPtr<nsIMsgFolder> msgParent = do_QueryInterface(parent);
|
||||
msgFolder->SetParent(nsnull);
|
||||
msgParent->PropagateDelete(msgFolder,PR_FALSE);
|
||||
msgParent->PropagateDelete(msgFolder,PR_FALSE, nsnull);
|
||||
|
||||
if(NS_SUCCEEDED(rv) && child)
|
||||
{
|
||||
@ -5796,6 +5800,7 @@ NS_IMETHODIMP nsImapMailFolder::RenameSubfolders(nsIMsgFolder *oldFolder)
|
||||
imapFolder->SetOnlineName(onlineCName.get());
|
||||
imapFolder->SetHierarchyDelimiter(hierarchyDelimiter);
|
||||
imapFolder->SetBoxFlags(boxflags);
|
||||
msgFolder->ChangeFilterDestination(child, PR_FALSE /*caseInsensitive*/, nsnull);
|
||||
|
||||
rv = aEnumerator->Next();
|
||||
|
||||
|
@ -772,7 +772,7 @@ void ImportThreadData::DriverAbort()
|
||||
{
|
||||
if (abort && !threadAlive && destRoot) {
|
||||
if (ownsDestRoot) {
|
||||
destRoot->RecursiveDelete( PR_TRUE);
|
||||
destRoot->RecursiveDelete(PR_TRUE, nsnull);
|
||||
}
|
||||
else {
|
||||
// FIXME: just delete the stuff we created?
|
||||
@ -983,7 +983,7 @@ ImportMailThread( void *stuff)
|
||||
if (pData->ownsDestRoot) {
|
||||
IMPORT_LOG0( "Calling destRoot->RecursiveDelete\n");
|
||||
|
||||
destRoot->RecursiveDelete( PR_TRUE);
|
||||
destRoot->RecursiveDelete( PR_TRUE, nsnull);
|
||||
}
|
||||
else {
|
||||
// FIXME: just delete the stuff we created?
|
||||
|
@ -46,7 +46,7 @@ interface nsIPop3Sink : nsISupports {
|
||||
[noscript] void IncorporateWrite(in string block,
|
||||
in long length);
|
||||
|
||||
[noscript] void IncorporateComplete();
|
||||
[noscript] void IncorporateComplete(in nsIMsgWindow msgWindow);
|
||||
[noscript] void IncorporateAbort(in boolean uidlDownload);
|
||||
|
||||
void BiffGetNewMail();
|
||||
|
@ -969,7 +969,7 @@ NS_IMETHODIMP nsMsgLocalMailFolder::EmptyTrash(nsIMsgWindow *msgWindow,
|
||||
{
|
||||
nsString folderName(idlFolderName);
|
||||
trashFolder->SetParent(nsnull);
|
||||
parentFolder->PropagateDelete(trashFolder, PR_TRUE);
|
||||
parentFolder->PropagateDelete(trashFolder, PR_TRUE, msgWindow);
|
||||
parentFolder->CreateSubfolder(folderName.get(),nsnull);
|
||||
nsCOMPtr<nsIMsgFolder> newTrashFolder;
|
||||
rv = GetTrashFolder(getter_AddRefs(newTrashFolder));
|
||||
@ -1024,7 +1024,6 @@ nsresult nsMsgLocalMailFolder::IsChildOfTrash(PRBool *result)
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsMsgLocalMailFolder::Delete()
|
||||
{
|
||||
nsresult rv;
|
||||
@ -1235,7 +1234,7 @@ NS_IMETHODIMP nsMsgLocalMailFolder::Rename(const PRUnichar *aNewName, nsIMsgWind
|
||||
if (parentFolder)
|
||||
{
|
||||
SetParent(nsnull);
|
||||
parentFolder->PropagateDelete(this, PR_FALSE);
|
||||
parentFolder->PropagateDelete(this, PR_FALSE, msgWindow);
|
||||
}
|
||||
|
||||
oldPathSpec->Rename(newNameStr.get());
|
||||
@ -1262,6 +1261,7 @@ NS_IMETHODIMP nsMsgLocalMailFolder::Rename(const PRUnichar *aNewName, nsIMsgWind
|
||||
newFolder->SetName(newFolderName.get());
|
||||
nsCOMPtr<nsISupports> newFolderSupport = do_QueryInterface(newFolder);
|
||||
NotifyItemAdded(parentSupport, newFolderSupport, "folderView");
|
||||
ChangeFilterDestination(newFolder, PR_TRUE /*caseInsenstive*/, nsnull);
|
||||
}
|
||||
/***** jefft -
|
||||
* Needs to find a way to reselect the new renamed folder and the
|
||||
@ -1928,6 +1928,8 @@ nsMsgLocalMailFolder::CopyFolderLocal( nsIMsgFolder *destFolder, nsIMsgFolder *s
|
||||
srcFolder->GetFlags(&flags);
|
||||
newMsgFolder->SetFlags(flags);
|
||||
|
||||
rv = srcFolder->ChangeFilterDestination(newMsgFolder, PR_TRUE, nsnull);
|
||||
|
||||
if (newMsgFolder)
|
||||
{
|
||||
newMsgFolder->SetName(folderName.get());
|
||||
@ -1965,7 +1967,7 @@ nsMsgLocalMailFolder::CopyFolderLocal( nsIMsgFolder *destFolder, nsIMsgFolder *s
|
||||
{
|
||||
msgParent = do_QueryInterface(parent);
|
||||
if (msgParent)
|
||||
msgParent->PropagateDelete(srcFolder, PR_FALSE); // The files have already been moved, so delete storage PR_FALSE
|
||||
msgParent->PropagateDelete(srcFolder, PR_FALSE, msgWindow); // The files have already been moved, so delete storage PR_FALSE
|
||||
if (!oldPath.IsDirectory())
|
||||
{
|
||||
AddDirectorySeparator(oldPath);
|
||||
|
@ -282,7 +282,7 @@ void nsMsgMailboxParser::DoneParsingFolder(nsresult status)
|
||||
{
|
||||
/* End of file. Flush out any partial line remaining in the buffer. */
|
||||
FlushLastLine();
|
||||
PublishMsgHeader();
|
||||
PublishMsgHeader(nsnull);
|
||||
|
||||
// only mark the db valid if we've succeeded.
|
||||
if (NS_SUCCEEDED(status) && m_mailDB) // finished parsing, so flush db folder info
|
||||
@ -328,7 +328,7 @@ void nsMsgMailboxParser::FolderTypeSpecificTweakMsgHeader(nsIMsgDBHdr * /* tweak
|
||||
}
|
||||
|
||||
// Tell the world about the message header (add to db, and view, if any)
|
||||
PRInt32 nsMsgMailboxParser::PublishMsgHeader()
|
||||
PRInt32 nsMsgMailboxParser::PublishMsgHeader(nsIMsgWindow *msgWindow)
|
||||
{
|
||||
FinishHeader();
|
||||
if (m_newMsgHdr)
|
||||
@ -412,7 +412,7 @@ PRInt32 nsMsgMailboxParser::HandleLine(char *line, PRUint32 lineLength)
|
||||
|
||||
NS_ASSERTION (m_state == nsIMsgParseMailMsgState::ParseBodyState ||
|
||||
m_state == nsIMsgParseMailMsgState::ParseHeadersState, "invalid parse state"); /* else folder corrupted */
|
||||
PublishMsgHeader();
|
||||
PublishMsgHeader(nsnull);
|
||||
Clear();
|
||||
status = StartNewEnvelope(line, lineLength);
|
||||
NS_ASSERTION(status >= 0, " error starting envelope parsing mailbox");
|
||||
@ -1460,7 +1460,7 @@ void nsParseNewMailState::DoneParsingFolder(nsresult status)
|
||||
ParseFolderLine(m_ibuffer, m_ibuffer_fp);
|
||||
m_ibuffer_fp = 0;
|
||||
}
|
||||
PublishMsgHeader();
|
||||
PublishMsgHeader(nsnull);
|
||||
if (!moved && m_mailDB) // finished parsing, so flush db folder info
|
||||
UpdateDBFolderInfo();
|
||||
|
||||
@ -1477,7 +1477,7 @@ void nsParseNewMailState::DoneParsingFolder(nsresult status)
|
||||
m_obuffer_size = 0;
|
||||
}
|
||||
|
||||
PRInt32 nsParseNewMailState::PublishMsgHeader()
|
||||
PRInt32 nsParseNewMailState::PublishMsgHeader(nsIMsgWindow *msgWindow)
|
||||
{
|
||||
PRBool moved = PR_FALSE;
|
||||
|
||||
@ -1490,7 +1490,7 @@ PRInt32 nsParseNewMailState::PublishMsgHeader()
|
||||
{
|
||||
// flush the inbox because filters will read from disk
|
||||
m_inboxFileStream->flush();
|
||||
ApplyFilters(&moved);
|
||||
ApplyFilters(&moved, msgWindow);
|
||||
}
|
||||
if (!moved)
|
||||
{
|
||||
@ -1560,7 +1560,7 @@ nsresult nsParseNewMailState::GetTrashFolder(nsIMsgFolder **pTrashFolder)
|
||||
return rv;
|
||||
}
|
||||
|
||||
void nsParseNewMailState::ApplyFilters(PRBool *pMoved)
|
||||
void nsParseNewMailState::ApplyFilters(PRBool *pMoved, nsIMsgWindow *msgWindow)
|
||||
{
|
||||
m_msgMovedByFilter = PR_FALSE;
|
||||
|
||||
@ -1580,7 +1580,8 @@ void nsParseNewMailState::ApplyFilters(PRBool *pMoved)
|
||||
matchTermStatus =
|
||||
m_filterList->ApplyFiltersToHdr(nsMsgFilterType::InboxRule,
|
||||
msgHdr, inbox, m_mailDB,
|
||||
headers, headersSize, this);
|
||||
headers, headersSize, this,
|
||||
msgWindow);
|
||||
}
|
||||
|
||||
if (pMoved)
|
||||
@ -1610,6 +1611,8 @@ NS_IMETHODIMP nsParseNewMailState::ApplyFilterHit(nsIMsgFilter *filter, PRBool *
|
||||
{
|
||||
if (actionType == nsMsgFilterAction::MoveToFolder)
|
||||
filter->GetActionTargetFolderUri(getter_Copies(actionTargetFolderUri));
|
||||
if (!actionTargetFolderUri)
|
||||
return rv;
|
||||
nsCOMPtr<nsIMsgDBHdr> msgHdr = m_newMsgHdr;
|
||||
PRUint32 msgFlags;
|
||||
|
||||
@ -2080,10 +2083,10 @@ MSG_FolderInfoMail *ParseIMAPMailboxState::GetTrashFolder()
|
||||
|
||||
|
||||
// only apply filters for new unread messages in the imap inbox
|
||||
void ParseIMAPMailboxState::ApplyFilters(PRBool *pMoved)
|
||||
void ParseIMAPMailboxState::ApplyFilters(PRBool *pMoved, nsIMsgWindow *msgWindow)
|
||||
{
|
||||
if (fParsingInbox && !(GetCurrentMsg()->GetFlags() & MSG_FLAG_READ) )
|
||||
nsParseNewMailState::ApplyFilters(pMoved);
|
||||
nsParseNewMailState::ApplyFilters(pMoved, msgWindow);
|
||||
else
|
||||
*pMoved = PR_FALSE;
|
||||
|
||||
@ -2092,7 +2095,7 @@ void ParseIMAPMailboxState::ApplyFilters(PRBool *pMoved)
|
||||
}
|
||||
|
||||
|
||||
PRInt32 ParseIMAPMailboxState::PublishMsgHeader()
|
||||
PRInt32 ParseIMAPMailboxState::PublishMsgHeader(nsIMsgWindow *msgWindow)
|
||||
{
|
||||
PRBool moved = PR_FALSE;
|
||||
|
||||
@ -2102,7 +2105,7 @@ PRInt32 ParseIMAPMailboxState::PublishMsgHeader()
|
||||
{
|
||||
FolderTypeSpecificTweakMsgHeader(m_parseMsgState->m_newMsgHdr);
|
||||
if (!m_disableFilters) {
|
||||
ApplyFilters(&moved);
|
||||
ApplyFilters(&moved, msgWindow);
|
||||
}
|
||||
if (!moved)
|
||||
{
|
||||
|
@ -183,7 +183,7 @@ public:
|
||||
protected:
|
||||
nsCOMPtr<nsIMsgStatusFeedback> m_statusFeedback;
|
||||
|
||||
virtual PRInt32 PublishMsgHeader();
|
||||
virtual PRInt32 PublishMsgHeader(nsIMsgWindow *msgWindow);
|
||||
virtual void FolderTypeSpecificTweakMsgHeader(nsIMsgDBHdr *tweakMe);
|
||||
void FreeBuffers();
|
||||
|
||||
@ -237,11 +237,11 @@ public:
|
||||
NS_IMETHOD ApplyFilterHit(nsIMsgFilter *filter, PRBool *applyMore);
|
||||
|
||||
nsOutputFileStream *GetLogFile();
|
||||
virtual PRInt32 PublishMsgHeader();
|
||||
virtual PRInt32 PublishMsgHeader(nsIMsgWindow *msgWindow);
|
||||
protected:
|
||||
char *m_tmpdbName; // Temporary filename of new database
|
||||
PRBool m_usingTempDB;
|
||||
virtual void ApplyFilters(PRBool *pMoved);
|
||||
virtual void ApplyFilters(PRBool *pMoved, nsIMsgWindow *msgWindow);
|
||||
virtual nsresult GetTrashFolder(nsIMsgFolder **pTrashFolder);
|
||||
virtual nsresult MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
|
||||
nsIMsgDatabase *sourceDB,
|
||||
@ -277,9 +277,9 @@ public:
|
||||
const IDArray &GetBodyKeys() { return fFetchBodyKeys; }
|
||||
MSG_UrlQueue *GetFilterUrlQueue() {return fUrlQueue;}
|
||||
protected:
|
||||
virtual PRInt32 PublishMsgHeader();
|
||||
virtual PRInt32 PublishMsgHeader(nsIMsgWindow *msgWindow);
|
||||
virtual void FolderTypeSpecificTweakMsgHeader(nsIMsgDBHdr *tweakMe);
|
||||
virtual void ApplyFilters(PRBool *pMoved);
|
||||
virtual void ApplyFilters(PRBool *pMoved, nsIMsgWindow *msgWindow);
|
||||
|
||||
virtual MSG_FolderInfoMail *GetTrashFolder();
|
||||
virtual nsresult MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
|
||||
|
@ -2194,8 +2194,13 @@ nsPop3Protocol::RetrResponse(nsIInputStream* inputStream,
|
||||
{
|
||||
if (m_pop3ConData->dot_fix && m_pop3ConData->assumed_end && m_pop3ConData->msg_closure)
|
||||
{
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsUrl = do_QueryInterface(m_url, &rv);
|
||||
nsCOMPtr<nsIMsgWindow> msgWindow;
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = mailnewsUrl->GetMsgWindow(getter_AddRefs(msgWindow));
|
||||
|
||||
rv =
|
||||
m_nsIPop3Sink->IncorporateComplete();
|
||||
m_nsIPop3Sink->IncorporateComplete(msgWindow);
|
||||
// The following was added to prevent the loss of Data when we try
|
||||
// and write to somewhere we dont have write access error to (See
|
||||
// bug 62480)
|
||||
@ -2254,8 +2259,12 @@ nsPop3Protocol::RetrResponse(nsIInputStream* inputStream,
|
||||
if (pauseForMoreData && m_pop3ConData->dot_fix &&
|
||||
m_pop3ConData->assumed_end && m_pop3ConData->msg_closure)
|
||||
{
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsUrl = do_QueryInterface(m_url, &rv);
|
||||
nsCOMPtr<nsIMsgWindow> msgWindow;
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = mailnewsUrl->GetMsgWindow(getter_AddRefs(msgWindow));
|
||||
rv =
|
||||
m_nsIPop3Sink->IncorporateComplete();
|
||||
m_nsIPop3Sink->IncorporateComplete(msgWindow);
|
||||
|
||||
// The following was added to prevent the loss of Data when we try
|
||||
// and write to somewhere we dont have write access error to (See
|
||||
@ -2397,7 +2406,11 @@ nsPop3Protocol::HandleLine(char *line, PRUint32 line_length)
|
||||
if (!m_pop3ConData->dot_fix || m_pop3ConData->truncating_cur_msg ||
|
||||
(m_pop3ConData->parsed_bytes >= (m_pop3ConData->pop3_size -3)))
|
||||
{
|
||||
rv = m_nsIPop3Sink->IncorporateComplete();
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsUrl = do_QueryInterface(m_url, &rv);
|
||||
nsCOMPtr<nsIMsgWindow> msgWindow;
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = mailnewsUrl->GetMsgWindow(getter_AddRefs(msgWindow));
|
||||
rv = m_nsIPop3Sink->IncorporateComplete(msgWindow);
|
||||
|
||||
// The following was added to prevent the loss of Data when we try
|
||||
// and write to somewhere we dont have write access error to (See
|
||||
|
@ -406,7 +406,7 @@ nsresult nsPop3Sink::WriteLineToMailbox(char *buffer)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPop3Sink::IncorporateComplete()
|
||||
nsPop3Sink::IncorporateComplete(nsIMsgWindow *msgWindow)
|
||||
{
|
||||
if (m_buildMessageUri && m_baseMessageUri)
|
||||
{
|
||||
@ -422,7 +422,7 @@ nsPop3Sink::IncorporateComplete()
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
NS_ASSERTION(m_newMailParser, "could not get m_newMailParser");
|
||||
if (m_newMailParser)
|
||||
m_newMailParser->PublishMsgHeader();
|
||||
m_newMailParser->PublishMsgHeader(msgWindow);
|
||||
|
||||
// do not take out this printf as it is used by QA
|
||||
// as part of the smoketest process!. They depend on seeing
|
||||
|
@ -1187,7 +1187,7 @@ nsNntpIncomingServer::Unsubscribe(const PRUnichar *aUnicharName)
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!newsgroupFolder) return NS_ERROR_FAILURE;
|
||||
|
||||
rv = serverFolder->PropagateDelete(newsgroupFolder, PR_TRUE /* delete storage */);
|
||||
rv = serverFolder->PropagateDelete(newsgroupFolder, PR_TRUE /* delete storage */, nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
/* since we've unsubscribed to a newsgroup, the newsrc needs to be written out */
|
||||
|
Loading…
Reference in New Issue
Block a user