зеркало из https://github.com/mozilla/gecko-dev.git
112927 sr=bienvenu. Made it so that we alert the user in case we cannot
parse rules.dat, upon getting filterList
This commit is contained in:
Родитель
4ce37993eb
Коммит
ba6500b0e5
|
@ -290,7 +290,7 @@ function checkUserServerChanges(showAlert) {
|
|||
var filterList;
|
||||
if (account && (newType != "nntp")) {
|
||||
var server = account.incomingServer;
|
||||
filterList = server.filterList;
|
||||
filterList = server.getFilterList(null);
|
||||
}
|
||||
var userChangeText, serverChangeText;
|
||||
if ( (oldHost != newHost) && (filterList != undefined) && filterList.filterCount )
|
||||
|
|
|
@ -144,8 +144,8 @@ const nsMsgBiffState nsMsgBiffState_Unknown = 2; // We dunno whether there is ne
|
|||
*/
|
||||
readonly attribute nsIMsgFolder rootFolder;
|
||||
|
||||
/* filter for this folder */
|
||||
readonly attribute nsIMsgFilterList filterList;
|
||||
/* function to get the filter list on folder's server */
|
||||
nsIMsgFilterList getFilterList( in nsIMsgWindow msgWindow);
|
||||
|
||||
void ForceDBClosed ();
|
||||
void Delete ();
|
||||
|
|
|
@ -169,7 +169,8 @@ interface nsIMsgIncomingServer : nsISupports {
|
|||
/* empty trash on exit */
|
||||
attribute boolean emptyTrashOnExit;
|
||||
|
||||
readonly attribute nsIMsgFilterList filterList;
|
||||
/* get filter list */
|
||||
nsIMsgFilterList getFilterList(in nsIMsgWindow aMsgWindow);
|
||||
|
||||
/* we use this to set the default local path. we use this when migrating prefs */
|
||||
void SetDefaultLocalPath(in nsIFileSpec aDefaultLocalPath);
|
||||
|
|
|
@ -20,17 +20,17 @@
|
|||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIMsgFilterList.idl"
|
||||
#include "nsIMsgWindow.idl"
|
||||
|
||||
[scriptable, uuid(6673cad0-072e-11d3-8d70-00805f8a6617)]
|
||||
interface nsIMsgFilterService : nsISupports {
|
||||
|
||||
nsIMsgFilterList OpenFilterList(in nsIFileSpec filterFile, in nsIMsgFolder rootFolder);
|
||||
nsIMsgFilterList OpenFilterList(in nsIFileSpec filterFile, in nsIMsgFolder rootFolder, in nsIMsgWindow msgWindow);
|
||||
void CloseFilterList(in nsIMsgFilterList filterList);
|
||||
|
||||
void SaveFilterList(in nsIMsgFilterList filterList,
|
||||
in nsIFileSpec filterFile);
|
||||
|
||||
void CancelFilterList(in nsIMsgFilterList filterList);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -30,6 +30,8 @@ const nsMsgFilterMotion = Components.interfaces.nsMsgFilterMotion;
|
|||
var gFilterBundle;
|
||||
var gPromptService;
|
||||
var gFilterListDialogAlreadyOpen = false;
|
||||
var gFilterListMsgWindow = null;
|
||||
|
||||
function onLoad()
|
||||
{
|
||||
rdf = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);
|
||||
|
@ -37,6 +39,11 @@ function onLoad()
|
|||
var gPromptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService();
|
||||
gPromptService = gPromptService.QueryInterface(Components.interfaces.nsIPromptService);
|
||||
|
||||
var msgWindowContractID = "@mozilla.org/messenger/msgwindow;1";
|
||||
var nsIMsgWindow = Components.interfaces.nsIMsgWindow;
|
||||
gFilterListMsgWindow = Components.classes[msgWindowContractID].createInstance(nsIMsgWindow);
|
||||
gFilterListMsgWindow.SetDOMWindow(window);
|
||||
|
||||
gFilterBundle = document.getElementById("bundle_filter");
|
||||
|
||||
editButton = document.getElementById("editButton");
|
||||
|
@ -48,6 +55,8 @@ function onLoad()
|
|||
|
||||
updateButtons();
|
||||
|
||||
moveToAlertPosition();
|
||||
|
||||
// get the selected server if it can have filters.
|
||||
var firstItem = getSelectedServerForFilters();
|
||||
|
||||
|
@ -61,8 +70,6 @@ function onLoad()
|
|||
selectServer(firstItem);
|
||||
}
|
||||
|
||||
moveToAlertPosition();
|
||||
|
||||
if (("arguments" in window) && window.arguments[0] && ("prefillValue" in window.arguments[0]))
|
||||
onNewFilter(window.arguments[0].prefillValue);
|
||||
}
|
||||
|
@ -99,6 +106,16 @@ function onServerClick(event)
|
|||
// roots the tree at the specified server
|
||||
function setServer(uri)
|
||||
{
|
||||
var resource = rdf.GetResource(uri);
|
||||
var msgFolder = resource.QueryInterface(Components.interfaces.nsIMsgFolder);
|
||||
|
||||
//Calling getFilterList will detect any errors in rules.dat, backup the file, and alert the user
|
||||
//we need to do this because tree.setAttribute will cause rdf to call getFilterList and there is
|
||||
//no way to pass msgWindow in that case.
|
||||
|
||||
if (msgFolder)
|
||||
msgFolder.getFilterList(gFilterListMsgWindow);
|
||||
|
||||
var tree = document.getElementById("filterTree");
|
||||
tree.setAttribute("ref", uri);
|
||||
updateButtons();
|
||||
|
@ -124,9 +141,7 @@ function selectServer(uri)
|
|||
// update the server menu
|
||||
var serverMenu = document.getElementById("serverMenu");
|
||||
var menuitems = serverMenu.getElementsByAttribute("id", uri);
|
||||
|
||||
serverMenu.selectedItem = menuitems[0];
|
||||
|
||||
setServer(uri);
|
||||
}
|
||||
|
||||
|
@ -152,9 +167,7 @@ function currentFilterList()
|
|||
{
|
||||
var serverMenu = document.getElementById("serverMenu");
|
||||
var serverUri = serverMenu.value;
|
||||
|
||||
var filterList = rdf.GetResource(serverUri).GetDelegate("filter", Components.interfaces.nsIMsgFilterList);
|
||||
|
||||
return filterList;
|
||||
}
|
||||
|
||||
|
@ -350,4 +363,3 @@ function onFilterDoubleClick(event)
|
|||
if (t.parentNode.parentNode.localName == "treeitem")
|
||||
onEditFilter();
|
||||
}
|
||||
|
||||
|
|
|
@ -9,3 +9,4 @@ folderNotFoundText=The mail filter %1$S cannot move messages to the %2$S folder,
|
|||
folderNotFoundIgnoreButton=Ignore Filter
|
||||
folderNotFoundDeleteButton=Delete Filter
|
||||
untitledFilterName=untitled filter
|
||||
filterListBackUpMsg=Your filters do not work because the rules.dat file, which contains your filters, could not be read. A new rules.dat file will be created and a backup of the old file, called rulesbackup.dat, will be created in the same directory.
|
||||
|
|
|
@ -125,7 +125,7 @@ nsMsgFilterDelegateFactory::getFilterListDelegate(nsIRDFResource *aOuter,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIMsgFilterList> filterList;
|
||||
rv = folder->GetFilterList(getter_AddRefs(filterList));
|
||||
rv = folder->GetFilterList(nsnull, getter_AddRefs(filterList));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
*aResult = filterList;
|
||||
|
|
|
@ -43,6 +43,12 @@
|
|||
#include "nsFileStream.h"
|
||||
#include "nsMsgFilterList.h"
|
||||
#include "nsSpecialSystemDirectory.h"
|
||||
#include "nsIPrompt.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIMsgWindow.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIStringBundle.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsMsgFilterService, nsIMsgFilterService)
|
||||
|
||||
|
@ -55,7 +61,7 @@ nsMsgFilterService::~nsMsgFilterService()
|
|||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFilterService::OpenFilterList(nsIFileSpec *filterFile, nsIMsgFolder *rootFolder, nsIMsgFilterList **resultFilterList)
|
||||
NS_IMETHODIMP nsMsgFilterService::OpenFilterList(nsIFileSpec *filterFile, nsIMsgFolder *rootFolder, nsIMsgWindow *aMsgWindow, nsIMsgFilterList **resultFilterList)
|
||||
{
|
||||
nsresult ret = NS_OK;
|
||||
|
||||
|
@ -93,7 +99,18 @@ NS_IMETHODIMP nsMsgFilterService::OpenFilterList(nsIFileSpec *filterFile, nsIMsg
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_RELEASE(filterList);
|
||||
if (ret == NS_MSG_FILTER_PARSE_ERROR && aMsgWindow)
|
||||
{
|
||||
ret = BackUpFilterFile(filterFile, aMsgWindow);
|
||||
NS_ENSURE_SUCCESS(ret, ret);
|
||||
ret = filterFile->Truncate(0);
|
||||
NS_ENSURE_SUCCESS(ret, ret);
|
||||
return OpenFilterList(filterFile, rootFolder, aMsgWindow, resultFilterList);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -156,5 +173,91 @@ NS_IMETHODIMP nsMsgFilterService::CancelFilterList(nsIMsgFilterList *filterList)
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsresult nsMsgFilterService::BackUpFilterFile(nsIFileSpec *aFilterFile, nsIMsgWindow *aMsgWindow)
|
||||
{
|
||||
nsresult rv;
|
||||
AlertBackingUpFilterFile(aMsgWindow);
|
||||
aFilterFile->CloseStream();
|
||||
|
||||
nsCOMPtr<nsILocalFile> localFilterFile;
|
||||
nsFileSpec filterFileSpec;
|
||||
aFilterFile->GetFileSpec(&filterFileSpec);
|
||||
rv = NS_FileSpecToIFile(&filterFileSpec, getter_AddRefs(localFilterFile));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsCOMPtr<nsILocalFile> localParentDir;
|
||||
nsCOMPtr <nsIFileSpec> parentDir;
|
||||
rv = aFilterFile->GetParent(getter_AddRefs(parentDir));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsFileSpec parentDirSpec;
|
||||
parentDir->GetFileSpec(&parentDirSpec);
|
||||
|
||||
rv = NS_FileSpecToIFile(&parentDirSpec, getter_AddRefs(localParentDir));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
//if back-up file exists delete the back up file otherwise copy fails.
|
||||
nsCOMPtr <nsILocalFile> backupFile;
|
||||
rv = NS_FileSpecToIFile(&parentDirSpec, getter_AddRefs(backupFile));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
backupFile->Append("rulesbackup.dat");
|
||||
PRBool exists;
|
||||
backupFile->Exists(&exists);
|
||||
if (exists)
|
||||
backupFile->Remove(PR_FALSE);
|
||||
|
||||
return localFilterFile->CopyTo(localParentDir, "rulesbackup.dat");
|
||||
}
|
||||
|
||||
nsresult nsMsgFilterService::AlertBackingUpFilterFile(nsIMsgWindow *aMsgWindow)
|
||||
{
|
||||
return ThrowAlertMsg("filterListBackUpMsg", aMsgWindow);
|
||||
}
|
||||
|
||||
nsresult //Do not use this routine if you have to call it very often because it creates a new bundle each time
|
||||
nsMsgFilterService::GetStringFromBundle(const char *aMsgName, PRUnichar **aResult)
|
||||
{
|
||||
nsresult rv=NS_OK;
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
nsCOMPtr <nsIStringBundle> bundle;
|
||||
rv = GetFilterStringBundle(getter_AddRefs(bundle));
|
||||
if (NS_SUCCEEDED(rv) && bundle)
|
||||
rv=bundle->GetStringFromName(NS_ConvertASCIItoUCS2(aMsgName).get(), aResult);
|
||||
return rv;
|
||||
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMsgFilterService::GetFilterStringBundle(nsIStringBundle **aBundle)
|
||||
{
|
||||
nsresult rv=NS_OK;
|
||||
NS_ENSURE_ARG_POINTER(aBundle);
|
||||
nsCOMPtr<nsIStringBundleService> bundleService =
|
||||
do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
|
||||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
if (bundleService && NS_SUCCEEDED(rv))
|
||||
bundleService->CreateBundle("chrome://messenger/locale/filter.properties",
|
||||
getter_AddRefs(bundle));
|
||||
NS_IF_ADDREF(*aBundle = bundle);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMsgFilterService::ThrowAlertMsg(const char*aMsgName, nsIMsgWindow *aMsgWindow)
|
||||
{
|
||||
nsXPIDLString alertString;
|
||||
nsresult rv = GetStringFromBundle(aMsgName, getter_Copies(alertString));
|
||||
if (NS_SUCCEEDED(rv) && alertString && aMsgWindow)
|
||||
{
|
||||
nsCOMPtr <nsIDocShell> docShell;
|
||||
aMsgWindow->GetRootDocShell(getter_AddRefs(docShell));
|
||||
if (docShell)
|
||||
{
|
||||
nsCOMPtr<nsIPrompt> dialog(do_GetInterface(docShell));
|
||||
if (dialog && alertString)
|
||||
dialog->Alert(nsnull, alertString);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,8 @@
|
|||
|
||||
#include "nsIMsgFilterService.h"
|
||||
|
||||
class nsIMsgWindow;
|
||||
class nsIStringBundle;
|
||||
|
||||
|
||||
|
||||
|
@ -59,6 +61,12 @@ public:
|
|||
with dialog boxes. To apply the new list call MSG_CloseFilterList.
|
||||
|
||||
*/
|
||||
nsresult BackUpFilterFile(nsIFileSpec *aFilterFile, nsIMsgWindow *aMsgWindow);
|
||||
nsresult AlertBackingUpFilterFile(nsIMsgWindow *aMsgWindow);
|
||||
nsresult ThrowAlertMsg(const char*aMsgName, nsIMsgWindow *aMsgWindow);
|
||||
nsresult GetStringFromBundle(const char *aMsgName, PRUnichar **aResult);
|
||||
nsresult GetFilterStringBundle(nsIStringBundle **aBundle);
|
||||
|
||||
};
|
||||
|
||||
#endif // _nsMsgFilterService_H_
|
||||
|
|
|
@ -255,7 +255,7 @@ nsresult nsFilterTestDriver::OnOpenFilterFile()
|
|||
|
||||
if (filterFile.Exists())
|
||||
{
|
||||
nsresult res = m_filterService->OpenFilterList(&filterFile, nsnull, getter_AddRefs(filterList));
|
||||
nsresult res = m_filterService->OpenFilterList(&filterFile, nsnull, nsnull, getter_AddRefs(filterList));
|
||||
if (NS_SUCCEEDED(res))
|
||||
{
|
||||
}
|
||||
|
@ -274,7 +274,7 @@ nsresult nsFilterTestDriver::OnWriteFilterList()
|
|||
|
||||
if (filterFile.Exists())
|
||||
{
|
||||
nsresult res = m_filterService->OpenFilterList(&filterFile, nsnull, getter_AddRefs(filterList));
|
||||
nsresult res = m_filterService->OpenFilterList(&filterFile, nsnull, nsnull, getter_AddRefs(filterList));
|
||||
if (NS_SUCCEEDED(res))
|
||||
{
|
||||
filterFile.MakeUnique();
|
||||
|
|
|
@ -1589,7 +1589,7 @@ nsMsgDBFolder::MatchOrChangeFilterDestination(nsIMsgFolder *newFolder, PRBool ca
|
|||
rv = server->GetCanHaveFilters(&canHaveFilters);
|
||||
if (NS_SUCCEEDED(rv) && canHaveFilters)
|
||||
{
|
||||
rv = server->GetFilterList(getter_AddRefs(filterList));
|
||||
rv = server->GetFilterList(nsnull, getter_AddRefs(filterList));
|
||||
if (filterList && NS_SUCCEEDED(rv))
|
||||
{
|
||||
rv = filterList->MatchOrChangeFilterTarget(oldUri, newUri, caseInsensitive, found);
|
||||
|
|
|
@ -2129,13 +2129,11 @@ NS_IMETHODIMP nsMsgFolder::GetRootFolder(nsIMsgFolder * *aRootFolder)
|
|||
// if this happens, bail.
|
||||
if (!server) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsCOMPtr<nsIFolder> aRoot;
|
||||
rv = server->GetRootFolder(getter_AddRefs(aRoot));
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!aRoot) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
return aRoot->QueryInterface(NS_GET_IID(nsIMsgFolder), (void**)aRootFolder);
|
||||
rv = server->GetRootMsgFolder(aRootFolder);
|
||||
if (!aRootFolder)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
else
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -2523,24 +2521,15 @@ nsMsgFolder::RecursiveSetDeleteIsMoveToTrash(PRBool bVal)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgFolder::GetFilterList(nsIMsgFilterList **aResult)
|
||||
nsMsgFolder::GetFilterList(nsIMsgWindow *aMsgWindow, nsIMsgFilterList **aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
// only get filters for root folders in the base class
|
||||
#ifdef NS_DEBUG
|
||||
PRBool isServer=PR_FALSE;
|
||||
rv = GetIsServer(&isServer);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "error getting serverness");
|
||||
NS_ASSERTION(isServer, "Getting filter for non-server?");
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||
rv = GetServer(getter_AddRefs(server));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(server, NS_ERROR_FAILURE);
|
||||
|
||||
return server->GetFilterList(aResult);
|
||||
return server->GetFilterList(aMsgWindow, aResult);
|
||||
}
|
||||
|
||||
/* void enableNotifications (in long notificationType, in boolean enable); */
|
||||
|
|
|
@ -103,7 +103,7 @@ public:
|
|||
NS_IMETHOD GetNoSelect(PRBool *aNoSelect);
|
||||
NS_IMETHOD GetCanSubscribe(PRBool *aCanSubscribe);
|
||||
NS_IMETHOD GetCanFileMessages(PRBool *aCanFileMessages);
|
||||
NS_IMETHOD GetFilterList(nsIMsgFilterList **aFilterList);
|
||||
NS_IMETHOD GetFilterList(nsIMsgWindow *aMsgWindow, nsIMsgFilterList **aFilterList);
|
||||
NS_IMETHOD GetCanCreateSubfolders(PRBool *aCanCreateSubfolders);
|
||||
NS_IMETHOD GetCanRename(PRBool *aCanRename);
|
||||
NS_IMETHOD GetCanCompact(PRBool *aCanCompact);
|
||||
|
|
|
@ -998,9 +998,8 @@ nsMsgIncomingServer::clearPrefEnum(const char *aPref, void *aClosure)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsMsgIncomingServer::GetFilterList(nsIMsgFilterList **aResult)
|
||||
nsMsgIncomingServer::GetFilterList(nsIMsgWindow *aMsgWindow, nsIMsgFilterList **aResult)
|
||||
{
|
||||
|
||||
nsresult rv;
|
||||
|
||||
if (!mFilterList) {
|
||||
|
@ -1024,7 +1023,7 @@ nsMsgIncomingServer::GetFilterList(nsIMsgFilterList **aResult)
|
|||
do_GetService(kMsgFilterServiceCID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = filterService->OpenFilterList(mFilterFile, msgFolder, getter_AddRefs(mFilterList));
|
||||
rv = filterService->OpenFilterList(mFilterFile, msgFolder, aMsgWindow, getter_AddRefs(mFilterList));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
|
||||
interface nsIMsgMailNewsUrl;
|
||||
interface nsIImapMockChannel;
|
||||
interface nsIMsgWindow;
|
||||
|
||||
typedef long ImapOnlineCopyState;
|
||||
|
||||
|
|
|
@ -86,6 +86,7 @@
|
|||
#include "nsImapUrl.h"
|
||||
#include "nsFileStream.h"
|
||||
#include "nsIMsgProtocolInfo.h"
|
||||
#include "nsIMsgMailSession.h"
|
||||
|
||||
#include "nsITimer.h"
|
||||
#include "nsMsgUtils.h"
|
||||
|
@ -902,15 +903,10 @@ nsImapIncomingServer::PerformExpand(nsIMsgWindow *aMsgWindow)
|
|||
NS_IMETHODIMP nsImapIncomingServer::PerformBiff()
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIFolder> rootFolder;
|
||||
rv = GetRootFolder(getter_AddRefs(rootFolder));
|
||||
if(NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr<nsIMsgFolder> rootMsgFolder = do_QueryInterface(rootFolder);
|
||||
if(rootMsgFolder)
|
||||
nsCOMPtr<nsIMsgFolder> rootMsgFolder;
|
||||
rv = GetRootMsgFolder(getter_AddRefs(rootMsgFolder));
|
||||
if(NS_SUCCEEDED(rv) && rootMsgFolder)
|
||||
rv = rootMsgFolder->GetNewMessages(nsnull, nsnull);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -3454,7 +3450,7 @@ nsImapIncomingServer::GetShouldDownloadArbitraryHeaders(PRBool *aResult)
|
|||
nsresult rv = NS_OK; //for now checking for filters is enough
|
||||
nsCOMPtr <nsIMsgFilterList> filterList; //later on we might have to check for MDN ;
|
||||
if (!mFilterList)
|
||||
GetFilterList(getter_AddRefs(filterList));
|
||||
GetFilterList(nsnull, getter_AddRefs(filterList));
|
||||
if (mFilterList)
|
||||
rv = mFilterList->GetShouldDownloadArbitraryHeaders(aResult);
|
||||
else
|
||||
|
|
|
@ -617,6 +617,11 @@ nsImapMailFolder::UpdateFolder(nsIMsgWindow *msgWindow)
|
|||
nsresult rv = NS_ERROR_NULL_POINTER;
|
||||
PRBool selectFolder = PR_FALSE;
|
||||
|
||||
if (mFlags & MSG_FOLDER_FLAG_INBOX && !m_filterList)
|
||||
{
|
||||
rv = GetFilterList(msgWindow, getter_AddRefs(m_filterList));
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIImapService> imapService(do_GetService(kCImapService, &rv));
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -2432,13 +2437,6 @@ NS_IMETHODIMP nsImapMailFolder::SetupHeaderParseStream(
|
|||
if (!mDatabase)
|
||||
GetDatabase(nsnull);
|
||||
|
||||
if (mFlags & MSG_FOLDER_FLAG_INBOX && !m_filterList)
|
||||
{
|
||||
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||
rv = GetServer(getter_AddRefs(server));
|
||||
if (NS_SUCCEEDED(rv) && server)
|
||||
server->GetFilterList(getter_AddRefs(m_filterList));
|
||||
}
|
||||
m_nextMessageByteLength = aSize;
|
||||
if (!m_msgParser)
|
||||
{
|
||||
|
|
|
@ -50,7 +50,7 @@ interface nsIPop3Sink : nsISupports {
|
|||
attribute string messageUri;
|
||||
attribute string baseMessageUri;
|
||||
|
||||
boolean BeginMailDelivery(in boolean uidlDownload);
|
||||
boolean BeginMailDelivery(in boolean uidlDownload, in nsIMsgWindow msgWindow);
|
||||
void EndMailDelivery();
|
||||
void AbortMailDelivery();
|
||||
|
||||
|
|
|
@ -192,7 +192,7 @@ nsShouldIgnoreFile(nsString& name)
|
|||
if (firstChar == '.' || firstChar == '#' || name.CharAt(name.Length() - 1) == '~')
|
||||
return PR_TRUE;
|
||||
|
||||
if (name.EqualsIgnoreCase("rules.dat"))
|
||||
if (name.EqualsIgnoreCase("rules.dat") || name.EqualsIgnoreCase("rulesbackup.dat"))
|
||||
return PR_TRUE;
|
||||
|
||||
|
||||
|
|
|
@ -440,7 +440,7 @@ nsMovemailService::GetNewMail(nsIMsgWindow *aMsgWindow,
|
|||
}
|
||||
}
|
||||
rv = newMailParser->Init(serverFolder, inbox,
|
||||
fileSpec, outFileStream);
|
||||
fileSpec, outFileStream, nsnull);
|
||||
if (NS_FAILED(rv))
|
||||
goto freebuff_and_unlock;
|
||||
|
||||
|
|
|
@ -240,7 +240,7 @@ NS_IMETHODIMP nsNoIncomingServer::GetNewMail(nsIMsgWindow *aMsgWindow, nsIUrlLis
|
|||
// the "none" server does not support filters, because
|
||||
// it doesn't support incoming messages!
|
||||
NS_IMETHODIMP
|
||||
nsNoIncomingServer::GetFilterList(nsIMsgFilterList **aResult)
|
||||
nsNoIncomingServer::GetFilterList(nsIMsgWindow *aMsgWindow, nsIMsgFilterList **aResult)
|
||||
{
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
|
|
@ -59,7 +59,7 @@ public:
|
|||
virtual ~nsNoIncomingServer();
|
||||
|
||||
NS_IMETHOD GetLocalStoreType(char * *type);
|
||||
NS_IMETHOD GetFilterList(nsIMsgFilterList **aResult);
|
||||
NS_IMETHOD GetFilterList(nsIMsgWindow *aMsgWindow, nsIMsgFilterList **aResult);
|
||||
NS_IMETHOD GetCanSearchMessages(PRBool *canSearchMessages);
|
||||
};
|
||||
|
||||
|
|
|
@ -1407,7 +1407,7 @@ nsParseNewMailState::nsParseNewMailState()
|
|||
NS_IMPL_ISUPPORTS_INHERITED1(nsParseNewMailState, nsMsgMailboxParser, nsIMsgFilterHitNotify)
|
||||
|
||||
nsresult
|
||||
nsParseNewMailState::Init(nsIFolder *rootFolder, nsIMsgFolder *downloadFolder, nsFileSpec &folder, nsIOFileStream *inboxFileStream)
|
||||
nsParseNewMailState::Init(nsIFolder *rootFolder, nsIMsgFolder *downloadFolder, nsFileSpec &folder, nsIOFileStream *inboxFileStream, nsIMsgWindow *aMsgWindow)
|
||||
{
|
||||
nsresult rv;
|
||||
m_position = folder.GetFileSize();
|
||||
|
@ -1434,8 +1434,7 @@ nsParseNewMailState::Init(nsIFolder *rootFolder, nsIMsgFolder *downloadFolder, n
|
|||
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||
rv = rootMsgFolder->GetServer(getter_AddRefs(server));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = server->GetFilterList(getter_AddRefs(m_filterList));
|
||||
|
||||
rv = server->GetFilterList(aMsgWindow, getter_AddRefs(m_filterList));
|
||||
m_logFile = nsnull;
|
||||
#ifdef DOING_MDN
|
||||
if (m_filterList)
|
||||
|
|
|
@ -231,7 +231,7 @@ public:
|
|||
nsParseNewMailState();
|
||||
virtual ~nsParseNewMailState();
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
nsresult Init(nsIFolder *rootFolder, nsIMsgFolder *downloadFolder, nsFileSpec &folder, nsIOFileStream *inboxFileStream);
|
||||
nsresult Init(nsIFolder *rootFolder, nsIMsgFolder *downloadFolder, nsFileSpec &folder, nsIOFileStream *inboxFileStream, nsIMsgWindow *aMsgWindow);
|
||||
|
||||
virtual void DoneParsingFolder(nsresult status);
|
||||
virtual void SetUsingTempDB(PRBool usingTempDB, char *tmpDBName);
|
||||
|
|
|
@ -1200,8 +1200,15 @@ nsPop3Protocol::GetStat()
|
|||
// write to somewhere we dont have write access error to (See bug 62480)
|
||||
// (Note: This is only a temp hack until the underlying XPCOM is fixed
|
||||
// to return errors)
|
||||
|
||||
nsresult rv;
|
||||
rv = m_nsIPop3Sink->BeginMailDelivery(m_pop3ConData->only_uidl != nsnull,
|
||||
nsCOMPtr <nsIMsgWindow> msgWindow;
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsUrl = do_QueryInterface(m_url);
|
||||
if (mailnewsUrl)
|
||||
rv = mailnewsUrl->GetMsgWindow(getter_AddRefs(msgWindow));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv) && msgWindow, "no msg window");
|
||||
|
||||
rv = m_nsIPop3Sink->BeginMailDelivery(m_pop3ConData->only_uidl != nsnull, msgWindow,
|
||||
&m_pop3ConData->msg_del_started);
|
||||
if (NS_FAILED(rv))
|
||||
if (rv == NS_MSG_FOLDER_BUSY)
|
||||
|
|
|
@ -130,7 +130,7 @@ nsPop3Sink::GetMailAccountURL(char* *urlString)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsPop3Sink::BeginMailDelivery(PRBool uidlDownload, PRBool* aBool)
|
||||
nsPop3Sink::BeginMailDelivery(PRBool uidlDownload, nsIMsgWindow *aMsgWindow, PRBool* aBool)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
m_fileCounter++;
|
||||
|
@ -190,7 +190,7 @@ nsPop3Sink::BeginMailDelivery(PRBool uidlDownload, PRBool* aBool)
|
|||
rv = GetServerFolder(getter_AddRefs(serverFolder));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = m_newMailParser->Init(serverFolder, m_folder, fileSpec, m_outFileStream);
|
||||
rv = m_newMailParser->Init(serverFolder, m_folder, fileSpec, m_outFileStream, aMsgWindow);
|
||||
// if we failed to initialize the parser, then just don't use it!!!
|
||||
// we can still continue without one...
|
||||
if (NS_FAILED(rv))
|
||||
|
|
|
@ -621,7 +621,7 @@ nsNntpIncomingServer::PerformExpand(nsIMsgWindow *aMsgWindow)
|
|||
|
||||
// remove this when news supports filters
|
||||
NS_IMETHODIMP
|
||||
nsNntpIncomingServer::GetFilterList(nsIMsgFilterList **aResult)
|
||||
nsNntpIncomingServer::GetFilterList(nsIMsgWindow *aMsgWindow, nsIMsgFilterList **aResult)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ public:
|
|||
NS_IMETHOD CloseCachedConnections();
|
||||
NS_IMETHOD PerformBiff();
|
||||
NS_IMETHOD PerformExpand(nsIMsgWindow *aMsgWindow);
|
||||
NS_IMETHOD GetFilterList(nsIMsgFilterList **aResult);
|
||||
NS_IMETHOD GetFilterList(nsIMsgWindow *aMsgWindow, nsIMsgFilterList **aResult);
|
||||
NS_IMETHOD OnUserOrHostNameChanged(const char *oldName, const char *newName);
|
||||
|
||||
// for nsMsgLineBuffer
|
||||
|
|
Загрузка…
Ссылка в новой задаче