зеркало из https://github.com/mozilla/pjs.git
Fix for 135993. Clear temporary return receipt filter when sent folder is changed and recreate this temporary filter when updating folders. r/sr=sspiter.
This commit is contained in:
Родитель
7efb28f3a5
Коммит
028f21150f
|
@ -363,6 +363,13 @@ interface nsIMsgIncomingServer : nsISupports {
|
|||
*/
|
||||
void configureTemporaryReturnReceiptsFilter(in nsIMsgFilterList filterList);
|
||||
|
||||
/**
|
||||
* If Sent folder pref is changed we need to clear the temporary
|
||||
* return receipt filter so that the new return receipt filter can
|
||||
* be recreated (by ConfigureTemporaryReturnReceiptsFilter()).
|
||||
*/
|
||||
void clearTemporaryReturnReceiptsFilter();
|
||||
|
||||
/**
|
||||
* spam settings
|
||||
*/
|
||||
|
|
|
@ -52,6 +52,9 @@
|
|||
#include "nsRDFCID.h"
|
||||
#include "nsMsgFolderFlags.h"
|
||||
#include "nsIMsgFolder.h"
|
||||
#include "nsIMsgIncomingServer.h"
|
||||
#include "nsIMsgAccountManager.h"
|
||||
#include "nsMsgBaseCID.h"
|
||||
#include "prprf.h"
|
||||
#include "nsISupportsObsolete.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
|
@ -510,7 +513,27 @@ nsMsgIdentity::setFolderPref(const char *prefname, const char *value)
|
|||
nsCOMPtr<nsIRDFService> rdf(do_GetService(kRDFServiceCID, &rv));
|
||||
|
||||
if (nsCRT::strcmp(prefname, "fcc_folder") == 0)
|
||||
{
|
||||
// Clear the temporary return receipt filter so that the new filter
|
||||
// rule can be recreated (by ConfigureTemporaryReturnReceiptsFilter()).
|
||||
nsCOMPtr<nsIMsgAccountManager> accountManager =
|
||||
do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsCOMPtr<nsISupportsArray> servers;
|
||||
rv = accountManager->GetServersForIdentity(this, getter_AddRefs(servers));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
PRUint32 cnt = 0;
|
||||
servers->Count(&cnt);
|
||||
if (cnt > 0)
|
||||
{
|
||||
nsCOMPtr<nsISupports> supports = getter_AddRefs(servers->ElementAt(0));
|
||||
nsCOMPtr<nsIMsgIncomingServer> server = do_QueryInterface(supports,&rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
server->ClearTemporaryReturnReceiptsFilter(); // okay to fail; no need to check for return code
|
||||
}
|
||||
folderflag = MSG_FOLDER_FLAG_SENTMAIL;
|
||||
}
|
||||
else if (nsCRT::strcmp(prefname, "draft_folder") == 0)
|
||||
folderflag = MSG_FOLDER_FLAG_DRAFTS;
|
||||
else if (nsCRT::strcmp(prefname, "stationery_folder") == 0)
|
||||
|
|
|
@ -1765,17 +1765,9 @@ nsMsgIncomingServer::ConfigureTemporaryReturnReceiptsFilter(nsIMsgFilterList *fi
|
|||
newFilter->SetEnabled(enable);
|
||||
else if (enable)
|
||||
{
|
||||
nsCOMPtr<nsIMsgFolder> rootFolder;
|
||||
rv = GetRootMsgFolder(getter_AddRefs(rootFolder));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRUint32 numFolders;
|
||||
nsCOMPtr<nsIMsgFolder> sentFolder;
|
||||
|
||||
rootFolder->GetFoldersWithFlag(MSG_FOLDER_FLAG_SENTMAIL, 1,
|
||||
&numFolders,
|
||||
getter_AddRefs(sentFolder));
|
||||
if (sentFolder)
|
||||
nsXPIDLCString actionTargetFolderUri;
|
||||
rv = identity->GetFccFolder(getter_Copies(actionTargetFolderUri));
|
||||
if (!actionTargetFolderUri.IsEmpty())
|
||||
{
|
||||
filterList->CreateFilter(internalReturnReceiptFilterName.get(),
|
||||
getter_AddRefs(newFilter));
|
||||
|
@ -1829,20 +1821,30 @@ nsMsgIncomingServer::ConfigureTemporaryReturnReceiptsFilter(nsIMsgFilterList *fi
|
|||
nsCOMPtr<nsIMsgRuleAction> filterAction;
|
||||
newFilter->CreateAction(getter_AddRefs(filterAction));
|
||||
filterAction->SetType(nsMsgFilterAction::MoveToFolder);
|
||||
nsXPIDLCString actionTargetFolderUri;
|
||||
rv = sentFolder->GetURI(getter_Copies(actionTargetFolderUri));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
filterAction->SetTargetFolderUri(actionTargetFolderUri);
|
||||
newFilter->AppendAction(filterAction);
|
||||
filterList->InsertFilterAt(0, newFilter);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgIncomingServer::ClearTemporaryReturnReceiptsFilter()
|
||||
{
|
||||
if (mFilterList)
|
||||
{
|
||||
nsCOMPtr<nsIMsgFilter> mdnFilter;
|
||||
nsresult rv = mFilterList->GetFilterNamed(
|
||||
NS_LITERAL_STRING("mozilla-temporary-internal-MDN-receipt-filter").get(),
|
||||
getter_AddRefs(mdnFilter));
|
||||
if (NS_SUCCEEDED(rv) && mdnFilter)
|
||||
return mFilterList->RemoveFilter(mdnFilter);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgIncomingServer::GetMsgFolderFromURI(nsIMsgFolder *aFolderResource, const char *aURI, nsIMsgFolder **aFolder)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче