зеркало из https://github.com/mozilla/gecko-dev.git
94968 r=bienvenu sr=sspitzer. Add error messages in cases where filter disables itself because it cannot
find the folder or filtering fails due to some other reasons.
This commit is contained in:
Родитель
0e84f2c2c0
Коммит
d9dc0205f3
|
@ -384,6 +384,8 @@ const nsMsgBiffState nsMsgBiffState_Unknown = 2; // We dunno whether there is ne
|
||||||
boolean matchOrChangeFilterDestination(in nsIMsgFolder folder, in boolean caseInsensitive);
|
boolean matchOrChangeFilterDestination(in nsIMsgFolder folder, in boolean caseInsensitive);
|
||||||
boolean confirmFolderDeletionForFilter(in nsIMsgWindow msgWindow);
|
boolean confirmFolderDeletionForFilter(in nsIMsgWindow msgWindow);
|
||||||
void alertFilterChanged(in nsIMsgWindow msgWindow);
|
void alertFilterChanged(in nsIMsgWindow msgWindow);
|
||||||
|
void throwAlertMsg(in string msgName, in nsIMsgWindow msgWindow);
|
||||||
|
wstring getStringWithFolderNameFromBundle(in string msgName);
|
||||||
void notifyCompactCompleted();
|
void notifyCompactCompleted();
|
||||||
|
|
||||||
attribute nsIMsgRetentionSettings retentionSettings;
|
attribute nsIMsgRetentionSettings retentionSettings;
|
||||||
|
|
|
@ -66,9 +66,12 @@ compactingFolder=Compacting folder %S...
|
||||||
autoCompactAllFolders=Do you wish to compact all local and offline folders to save disk space?
|
autoCompactAllFolders=Do you wish to compact all local and offline folders to save disk space?
|
||||||
confirmFolderDeletionForFilter=Deleting the folder '%S' will disable its associated filter(s). Are you sure you want to delete the folder?
|
confirmFolderDeletionForFilter=Deleting the folder '%S' will disable its associated filter(s). Are you sure you want to delete the folder?
|
||||||
alertFilterChanged=Filters associated with this folder will be updated.
|
alertFilterChanged=Filters associated with this folder will be updated.
|
||||||
|
filterDisabled=The folder '%S' could not be found, so filter(s) associated with this folder will be disabled. Verify that the folder exists, and that filters point to a valid destination folder.
|
||||||
|
filterFolderDeniedLocked=The messages could not be filtered to folder '%S' because another operation is in progress.
|
||||||
alertFilterCheckbox=Do not warn me again.
|
alertFilterCheckbox=Do not warn me again.
|
||||||
compactFolderDeniedLock=The folder '%S' cannot be compacted because another operation is in progress. Please try again later.
|
compactFolderDeniedLock=The folder '%S' cannot be compacted because another operation is in progress. Please try again later.
|
||||||
compactFolderWriteFailed=The folder '%S' could not be compacted because writing to folder failed. Verify that you have enough disk space, and that you have write privileges to the file system, then try again.
|
compactFolderWriteFailed=The folder '%S' could not be compacted because writing to folder failed. Verify that you have enough disk space, and that you have write privileges to the file system, then try again.
|
||||||
|
filterFolderWriteFailed=The messages could not be filtered to folder '%S' because writing to folder failed. Verify that you have enough disk space, and that you have write privileges to the file system, then try again.
|
||||||
|
|
||||||
# LOCALIZATION NOTES(verboseFolderFormat): %1$S is folder name, %2$S is server name
|
# LOCALIZATION NOTES(verboseFolderFormat): %1$S is folder name, %2$S is server name
|
||||||
verboseFolderFormat=%1$S on %2$S
|
verboseFolderFormat=%1$S on %2$S
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include "nsISupports.idl"
|
#include "nsISupports.idl"
|
||||||
#include "nsMsgFilterCore.idl"
|
#include "nsMsgFilterCore.idl"
|
||||||
#include "nsIMsgFilter.idl"
|
#include "nsIMsgFilter.idl"
|
||||||
|
interface nsIMsgWindow;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// nsIMsgFilterHitNotify is an interface designed to make evaluating filters
|
// nsIMsgFilterHitNotify is an interface designed to make evaluating filters
|
||||||
|
@ -54,6 +55,6 @@
|
||||||
[scriptable, uuid(c9f15174-1f3f-11d3-a51b-0060b0fc04b7)]
|
[scriptable, uuid(c9f15174-1f3f-11d3-a51b-0060b0fc04b7)]
|
||||||
interface nsIMsgFilterHitNotify : nsISupports {
|
interface nsIMsgFilterHitNotify : nsISupports {
|
||||||
|
|
||||||
boolean ApplyFilterHit(in nsIMsgFilter filter);
|
boolean applyFilterHit(in nsIMsgFilter filter, in nsIMsgWindow msgWindow);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -166,7 +166,7 @@ nsMsgFilterList::ApplyFiltersToHdr(nsMsgFilterTypeType filterType,
|
||||||
{
|
{
|
||||||
PRBool applyMore;
|
PRBool applyMore;
|
||||||
|
|
||||||
ret = listener->ApplyFilterHit(filter, &applyMore);
|
ret = listener->ApplyFilterHit(filter, msgWindow, &applyMore);
|
||||||
if (!NS_SUCCEEDED(ret) || !applyMore)
|
if (!NS_SUCCEEDED(ret) || !applyMore)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -216,38 +216,6 @@ nsFolderCompactState::CompactHelper(nsIMsgFolder *folder)
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define MESSENGER_STRING_URL "chrome://messenger/locale/messenger.properties"
|
|
||||||
|
|
||||||
nsresult nsFolderCompactState::GetStringBundle(nsIStringBundle **aBundle)
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsIStringBundle> stringBundle;
|
|
||||||
nsresult res = NS_OK;
|
|
||||||
|
|
||||||
nsCOMPtr<nsIStringBundleService> sBundleService =
|
|
||||||
do_GetService(kStringBundleServiceCID, &res);
|
|
||||||
if (NS_SUCCEEDED(res) && (nsnull != sBundleService))
|
|
||||||
{
|
|
||||||
res = sBundleService->CreateBundle(MESSENGER_STRING_URL, getter_AddRefs(stringBundle));
|
|
||||||
}
|
|
||||||
*aBundle = stringBundle;
|
|
||||||
NS_IF_ADDREF(*aBundle);
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult nsFolderCompactState::GetStatusFromMsgName(const char *statusMsgName, PRUnichar ** retval)
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsIStringBundle> stringBundle;
|
|
||||||
nsresult res = NS_OK;
|
|
||||||
res = GetStringBundle(getter_AddRefs(stringBundle));
|
|
||||||
if (stringBundle && NS_SUCCEEDED(res))
|
|
||||||
{
|
|
||||||
res = stringBundle->GetStringFromName(NS_ConvertASCIItoUCS2(statusMsgName).get(), retval);
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult nsFolderCompactState::ShowStatusMsg(const PRUnichar *aMsg)
|
nsresult nsFolderCompactState::ShowStatusMsg(const PRUnichar *aMsg)
|
||||||
{
|
{
|
||||||
nsCOMPtr <nsIMsgStatusFeedback> statusFeedback;
|
nsCOMPtr <nsIMsgStatusFeedback> statusFeedback;
|
||||||
|
@ -299,50 +267,11 @@ nsFolderCompactState::Init(nsIMsgFolder *folder, const char *baseMsgUri, nsIMsgD
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsFolderCompactState::ShowCompactingStatusMsg()
|
void nsFolderCompactState::ShowCompactingStatusMsg()
|
||||||
{
|
|
||||||
nsXPIDLString formatString;
|
|
||||||
|
|
||||||
nsresult rv = GetStatusFromMsgName("compactingFolder", getter_Copies(formatString));
|
|
||||||
if (NS_SUCCEEDED(rv))
|
|
||||||
{
|
{
|
||||||
nsXPIDLString folderName;
|
nsXPIDLString statusString;
|
||||||
m_folder->GetName(getter_Copies(folderName));
|
nsresult rv = m_folder->GetStringWithFolderNameFromBundle("compactingFolder", getter_Copies(statusString));
|
||||||
PRUnichar *u = nsTextFormatter::smprintf((const PRUnichar *) formatString, (const PRUnichar *) folderName);
|
if (statusString && NS_SUCCEEDED(rv))
|
||||||
if (u)
|
ShowStatusMsg(statusString);
|
||||||
ShowStatusMsg(u);
|
|
||||||
PR_FREEIF(u);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void nsFolderCompactState::ThrowAlertMsg(const char *alertMsgName)
|
|
||||||
{
|
|
||||||
nsresult rv=NS_OK;
|
|
||||||
nsXPIDLString folderName;
|
|
||||||
m_folder->GetName(getter_Copies(folderName));
|
|
||||||
nsCOMPtr<nsIDocShell> docShell;
|
|
||||||
if (m_window)
|
|
||||||
m_window->GetRootDocShell(getter_AddRefs(docShell));
|
|
||||||
if (docShell)
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsIStringBundle> bundle;
|
|
||||||
rv = GetStringBundle(getter_AddRefs(bundle));
|
|
||||||
if (NS_SUCCEEDED(rv) && bundle)
|
|
||||||
{
|
|
||||||
const PRUnichar *formatStrings[] =
|
|
||||||
{
|
|
||||||
folderName
|
|
||||||
};
|
|
||||||
nsXPIDLString alertString;
|
|
||||||
nsAutoString alertTemplate;
|
|
||||||
alertTemplate.AssignWithConversion(alertMsgName);
|
|
||||||
rv = bundle->FormatStringFromName(alertTemplate.get(),
|
|
||||||
formatStrings, 1,
|
|
||||||
getter_Copies(alertString));
|
|
||||||
nsCOMPtr<nsIPrompt> dialog(do_GetInterface(docShell));
|
|
||||||
if (dialog && alertString)
|
|
||||||
dialog->Alert(nsnull, alertString);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsFolderCompactState::StartCompacting()
|
NS_IMETHODIMP nsFolderCompactState::StartCompacting()
|
||||||
|
@ -355,9 +284,8 @@ NS_IMETHODIMP nsFolderCompactState::StartCompacting()
|
||||||
m_folder->AcquireSemaphore(supports);
|
m_folder->AcquireSemaphore(supports);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NS_ASSERTION(0, "Some other operation is in progress on this folder");
|
|
||||||
m_folder->NotifyCompactCompleted();
|
m_folder->NotifyCompactCompleted();
|
||||||
ThrowAlertMsg("compactFolderDeniedLock");
|
m_folder->ThrowAlertMsg("compactFolderDeniedLock", m_window);
|
||||||
if (m_compactAll)
|
if (m_compactAll)
|
||||||
CompactNextFolder();
|
CompactNextFolder();
|
||||||
else
|
else
|
||||||
|
@ -579,11 +507,9 @@ nsFolderCompactState::OnDataAvailable(nsIRequest *request, nsISupports *ctxt,
|
||||||
{
|
{
|
||||||
writeCount = m_fileStream->write(m_dataBuffer, readCount);
|
writeCount = m_fileStream->write(m_dataBuffer, readCount);
|
||||||
count -= readCount;
|
count -= readCount;
|
||||||
NS_ASSERTION (writeCount == readCount,
|
|
||||||
"Oops, write fail, folder can be corrupted!\n");
|
|
||||||
if (writeCount != readCount)
|
if (writeCount != readCount)
|
||||||
{
|
{
|
||||||
ThrowAlertMsg("compactFolderWriteFailed");
|
m_folder->ThrowAlertMsg("compactFolderWriteFailed", m_window);
|
||||||
return NS_MSG_ERROR_WRITING_MAIL_FOLDER;
|
return NS_MSG_ERROR_WRITING_MAIL_FOLDER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,9 +70,6 @@ public:
|
||||||
|
|
||||||
nsresult GetMessage(nsIMsgDBHdr **message);
|
nsresult GetMessage(nsIMsgDBHdr **message);
|
||||||
nsresult BuildMessageURI(const char *baseURI, PRUint32 key, nsCString& uri);
|
nsresult BuildMessageURI(const char *baseURI, PRUint32 key, nsCString& uri);
|
||||||
nsresult GetStatusFromMsgName(const char *statusMsgName, PRUnichar ** retval);
|
|
||||||
nsresult GetStringBundle(nsIStringBundle **stringBundle);
|
|
||||||
void ThrowAlertMsg(const char* alertMsgName);
|
|
||||||
nsresult ShowStatusMsg(const PRUnichar *aMsg);
|
nsresult ShowStatusMsg(const PRUnichar *aMsg);
|
||||||
nsresult ReleaseFolderLock();
|
nsresult ReleaseFolderLock();
|
||||||
void ShowCompactingStatusMsg();
|
void ShowCompactingStatusMsg();
|
||||||
|
|
|
@ -2673,8 +2673,8 @@ nsMsgFolder::ThrowConfirmationPrompt(nsIMsgWindow *msgWindow, const PRUnichar *c
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
NS_IMETHODIMP nsMsgFolder::ConfirmFolderDeletionForFilter(nsIMsgWindow *msgWindow, PRBool *confirmed)
|
nsMsgFolder::GetStringWithFolderNameFromBundle(const char *msgName, PRUnichar **aResult)
|
||||||
{
|
{
|
||||||
nsCOMPtr <nsIStringBundle> bundle;
|
nsCOMPtr <nsIStringBundle> bundle;
|
||||||
nsresult rv = GetBaseStringBundle(getter_AddRefs(bundle));
|
nsresult rv = GetBaseStringBundle(getter_AddRefs(bundle));
|
||||||
|
@ -2686,18 +2686,41 @@ NS_IMETHODIMP nsMsgFolder::ConfirmFolderDeletionForFilter(nsIMsgWindow *msgWindo
|
||||||
{
|
{
|
||||||
folderName
|
folderName
|
||||||
};
|
};
|
||||||
nsXPIDLString confirmString;
|
rv = bundle->FormatStringFromName(NS_ConvertASCIItoUCS2(msgName).get(),
|
||||||
rv = bundle->FormatStringFromName(NS_ConvertASCIItoUCS2("confirmFolderDeletionForFilter").get(),
|
formatStrings, 1, aResult);
|
||||||
formatStrings, 1,
|
}
|
||||||
getter_Copies(confirmString));
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP nsMsgFolder::ConfirmFolderDeletionForFilter(nsIMsgWindow *msgWindow, PRBool *confirmed)
|
||||||
|
{
|
||||||
|
nsXPIDLString confirmString;
|
||||||
|
nsresult rv = GetStringWithFolderNameFromBundle("confirmFolderDeletionForFilter", getter_Copies(confirmString));
|
||||||
|
if (NS_SUCCEEDED(rv) && confirmString)
|
||||||
rv = ThrowConfirmationPrompt(msgWindow, confirmString.get(), confirmed);
|
rv = ThrowConfirmationPrompt(msgWindow, confirmString.get(), confirmed);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP nsMsgFolder::ThrowAlertMsg(const char*msgName, nsIMsgWindow *msgWindow)
|
||||||
|
{
|
||||||
|
nsXPIDLString alertString;
|
||||||
|
nsresult rv = GetStringWithFolderNameFromBundle(msgName, getter_Copies(alertString));
|
||||||
|
if (NS_SUCCEEDED(rv) && alertString && msgWindow)
|
||||||
|
{
|
||||||
|
nsCOMPtr <nsIDocShell> docShell;
|
||||||
|
msgWindow->GetRootDocShell(getter_AddRefs(docShell));
|
||||||
|
if (docShell)
|
||||||
|
{
|
||||||
|
nsCOMPtr<nsIPrompt> dialog(do_GetInterface(docShell));
|
||||||
|
if (dialog && alertString)
|
||||||
|
dialog->Alert(nsnull, alertString);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsMsgFolder::AlertFilterChanged(nsIMsgWindow *msgWindow)
|
NS_IMETHODIMP nsMsgFolder::AlertFilterChanged(nsIMsgWindow *msgWindow)
|
||||||
{
|
{ //this is a different alert i.e alert w/ checkbox.
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
PRBool checkBox=PR_FALSE;
|
PRBool checkBox=PR_FALSE;
|
||||||
GetWarnFilterChanged(&checkBox);
|
GetWarnFilterChanged(&checkBox);
|
||||||
|
|
|
@ -194,6 +194,8 @@ public:
|
||||||
NS_IMETHOD NotifyCompactCompleted();
|
NS_IMETHOD NotifyCompactCompleted();
|
||||||
NS_IMETHOD ConfirmFolderDeletionForFilter(nsIMsgWindow *msgWindow, PRBool *confirmed);
|
NS_IMETHOD ConfirmFolderDeletionForFilter(nsIMsgWindow *msgWindow, PRBool *confirmed);
|
||||||
NS_IMETHOD AlertFilterChanged(nsIMsgWindow *msgWindow);
|
NS_IMETHOD AlertFilterChanged(nsIMsgWindow *msgWindow);
|
||||||
|
NS_IMETHOD ThrowAlertMsg(const char* msgName, nsIMsgWindow *msgWindow);
|
||||||
|
NS_IMETHOD GetStringWithFolderNameFromBundle(const char* msgName, PRUnichar **aResult);
|
||||||
|
|
||||||
// end NS_DECL_NSIMSGFOLDER
|
// end NS_DECL_NSIMSGFOLDER
|
||||||
|
|
||||||
|
|
|
@ -2693,7 +2693,7 @@ NS_IMETHODIMP nsImapMailFolder::EndMessage(nsMsgKey key)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsImapMailFolder::ApplyFilterHit(nsIMsgFilter *filter, PRBool *applyMore)
|
NS_IMETHODIMP nsImapMailFolder::ApplyFilterHit(nsIMsgFilter *filter, nsIMsgWindow *msgWindow, PRBool *applyMore)
|
||||||
{
|
{
|
||||||
nsMsgRuleActionType actionType;
|
nsMsgRuleActionType actionType;
|
||||||
nsXPIDLCString actionTargetFolderUri;
|
nsXPIDLCString actionTargetFolderUri;
|
||||||
|
@ -2808,7 +2808,7 @@ NS_IMETHODIMP nsImapMailFolder::ApplyFilterHit(nsIMsgFilter *filter, PRBool *app
|
||||||
PR_FREEIF(tmp);
|
PR_FREEIF(tmp);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
nsresult err = MoveIncorporatedMessage(msgHdr, mDatabase, actionTargetFolderUri, filter);
|
nsresult err = MoveIncorporatedMessage(msgHdr, mDatabase, actionTargetFolderUri, filter, msgWindow);
|
||||||
if (NS_SUCCEEDED(err))
|
if (NS_SUCCEEDED(err))
|
||||||
m_msgMovedByFilter = PR_TRUE;
|
m_msgMovedByFilter = PR_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -2979,7 +2979,8 @@ NS_IMETHODIMP nsImapMailFolder::LiteSelect(nsIUrlListener *aUrlListener)
|
||||||
nsresult nsImapMailFolder::MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
|
nsresult nsImapMailFolder::MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
|
||||||
nsIMsgDatabase *sourceDB,
|
nsIMsgDatabase *sourceDB,
|
||||||
const char *destFolderUri,
|
const char *destFolderUri,
|
||||||
nsIMsgFilter *filter)
|
nsIMsgFilter *filter,
|
||||||
|
nsIMsgWindow *msgWindow)
|
||||||
{
|
{
|
||||||
nsresult err = NS_OK;
|
nsresult err = NS_OK;
|
||||||
|
|
||||||
|
@ -3008,6 +3009,7 @@ nsresult nsImapMailFolder::MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
|
||||||
if (!parentFolder || !canFileMessages)
|
if (!parentFolder || !canFileMessages)
|
||||||
{
|
{
|
||||||
filter->SetEnabled(PR_FALSE);
|
filter->SetEnabled(PR_FALSE);
|
||||||
|
destIFolder->ThrowAlertMsg("filterDisabled",msgWindow);
|
||||||
return NS_MSG_NOT_A_MAIL_FOLDER;
|
return NS_MSG_NOT_A_MAIL_FOLDER;
|
||||||
}
|
}
|
||||||
// put the header into the source db, since it needs to be there when we copy it
|
// put the header into the source db, since it needs to be there when we copy it
|
||||||
|
|
|
@ -274,13 +274,14 @@ public:
|
||||||
PRBool copySucceeded);
|
PRBool copySucceeded);
|
||||||
NS_IMETHOD MatchName(nsString *name, PRBool *matches);
|
NS_IMETHOD MatchName(nsString *name, PRBool *matches);
|
||||||
// nsIMsgFilterHitNotification method(s)
|
// nsIMsgFilterHitNotification method(s)
|
||||||
NS_IMETHOD ApplyFilterHit(nsIMsgFilter *filter, PRBool *applyMore);
|
NS_IMETHOD ApplyFilterHit(nsIMsgFilter *filter, nsIMsgWindow *msgWindow, PRBool *applyMore);
|
||||||
NS_IMETHOD IsCommandEnabled(const char *command, PRBool *result);
|
NS_IMETHOD IsCommandEnabled(const char *command, PRBool *result);
|
||||||
|
|
||||||
nsresult MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
|
nsresult MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
|
||||||
nsIMsgDatabase *sourceDB,
|
nsIMsgDatabase *sourceDB,
|
||||||
const char *destFolder,
|
const char *destFolder,
|
||||||
nsIMsgFilter *filter);
|
nsIMsgFilter *filter,
|
||||||
|
nsIMsgWindow *msgWindow);
|
||||||
static nsresult AllocateUidStringFromKeys(nsMsgKey *keys, PRInt32 numKeys, nsCString &msgIds);
|
static nsresult AllocateUidStringFromKeys(nsMsgKey *keys, PRInt32 numKeys, nsCString &msgIds);
|
||||||
protected:
|
protected:
|
||||||
// Helper methods
|
// Helper methods
|
||||||
|
|
|
@ -1648,7 +1648,7 @@ void nsParseNewMailState::ApplyFilters(PRBool *pMoved, nsIMsgWindow *msgWindow)
|
||||||
*pMoved = m_msgMovedByFilter;
|
*pMoved = m_msgMovedByFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsParseNewMailState::ApplyFilterHit(nsIMsgFilter *filter, PRBool *applyMore)
|
NS_IMETHODIMP nsParseNewMailState::ApplyFilterHit(nsIMsgFilter *filter, nsIMsgWindow *msgWindow, PRBool *applyMore)
|
||||||
{
|
{
|
||||||
nsMsgRuleActionType actionType;
|
nsMsgRuleActionType actionType;
|
||||||
nsXPIDLCString actionTargetFolderUri;
|
nsXPIDLCString actionTargetFolderUri;
|
||||||
|
@ -1739,7 +1739,7 @@ NS_IMETHODIMP nsParseNewMailState::ApplyFilterHit(nsIMsgFilter *filter, PRBool *
|
||||||
tmp = (char*) cc.value;
|
tmp = (char*) cc.value;
|
||||||
PR_FREEIF(tmp);
|
PR_FREEIF(tmp);
|
||||||
}
|
}
|
||||||
nsresult err = MoveIncorporatedMessage(msgHdr, m_mailDB, (const char *) actionTargetFolderUri, filter);
|
nsresult err = MoveIncorporatedMessage(msgHdr, m_mailDB, (const char *) actionTargetFolderUri, filter, msgWindow);
|
||||||
if (NS_SUCCEEDED(err))
|
if (NS_SUCCEEDED(err))
|
||||||
m_msgMovedByFilter = PR_TRUE;
|
m_msgMovedByFilter = PR_TRUE;
|
||||||
|
|
||||||
|
@ -1793,7 +1793,8 @@ int nsParseNewMailState::MarkFilteredMessageRead(nsIMsgDBHdr *msgHdr)
|
||||||
nsresult nsParseNewMailState::MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
|
nsresult nsParseNewMailState::MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
|
||||||
nsIMsgDatabase *sourceDB,
|
nsIMsgDatabase *sourceDB,
|
||||||
const char *destFolderUri,
|
const char *destFolderUri,
|
||||||
nsIMsgFilter *filter)
|
nsIMsgFilter *filter,
|
||||||
|
nsIMsgWindow *msgWindow)
|
||||||
{
|
{
|
||||||
nsresult err = 0;
|
nsresult err = 0;
|
||||||
nsIOFileStream *destFile;
|
nsIOFileStream *destFile;
|
||||||
|
@ -1818,6 +1819,7 @@ nsresult nsParseNewMailState::MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
|
||||||
if (!parentFolder || !canFileMessages)
|
if (!parentFolder || !canFileMessages)
|
||||||
{
|
{
|
||||||
filter->SetEnabled(PR_FALSE);
|
filter->SetEnabled(PR_FALSE);
|
||||||
|
destIFolder->ThrowAlertMsg("filterDisabled", msgWindow);
|
||||||
return NS_MSG_NOT_A_MAIL_FOLDER;
|
return NS_MSG_NOT_A_MAIL_FOLDER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1836,7 +1838,7 @@ nsresult nsParseNewMailState::MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
|
||||||
// Make sure no one else is writing into this folder
|
// Make sure no one else is writing into this folder
|
||||||
if (destIFolder && (err = destIFolder->AcquireSemaphore (myISupports)) != 0)
|
if (destIFolder && (err = destIFolder->AcquireSemaphore (myISupports)) != 0)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(PR_FALSE, "why is this folder busy?");
|
destIFolder->ThrowAlertMsg("filterFolderDeniedLocked", msgWindow);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1867,6 +1869,7 @@ nsresult nsParseNewMailState::MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
|
||||||
#endif
|
#endif
|
||||||
if (destIFolder)
|
if (destIFolder)
|
||||||
destIFolder->ReleaseSemaphore (myISupports);
|
destIFolder->ReleaseSemaphore (myISupports);
|
||||||
|
destIFolder->ThrowAlertMsg("filterFolderWriteFailed", msgWindow);
|
||||||
return NS_MSG_ERROR_WRITING_MAIL_FOLDER;
|
return NS_MSG_ERROR_WRITING_MAIL_FOLDER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1916,7 +1919,7 @@ nsresult nsParseNewMailState::MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
|
||||||
|
|
||||||
if (destMailDB)
|
if (destMailDB)
|
||||||
destMailDB->Close(PR_TRUE);
|
destMailDB->Close(PR_TRUE);
|
||||||
|
destIFolder->ThrowAlertMsg("filterFolderWriteFailed", msgWindow);
|
||||||
return NS_MSG_ERROR_WRITING_MAIL_FOLDER; // caller (ApplyFilters) currently ignores error conditions
|
return NS_MSG_ERROR_WRITING_MAIL_FOLDER; // caller (ApplyFilters) currently ignores error conditions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -251,7 +251,7 @@ public:
|
||||||
PRBool *pMoved);
|
PRBool *pMoved);
|
||||||
#endif
|
#endif
|
||||||
// nsIMsgFilterHitNotification method(s)
|
// nsIMsgFilterHitNotification method(s)
|
||||||
NS_IMETHOD ApplyFilterHit(nsIMsgFilter *filter, PRBool *applyMore);
|
NS_IMETHOD ApplyFilterHit(nsIMsgFilter *filter, nsIMsgWindow *msgWindow, PRBool *applyMore);
|
||||||
|
|
||||||
nsOutputFileStream *GetLogFile();
|
nsOutputFileStream *GetLogFile();
|
||||||
virtual PRInt32 PublishMsgHeader(nsIMsgWindow *msgWindow);
|
virtual PRInt32 PublishMsgHeader(nsIMsgWindow *msgWindow);
|
||||||
|
@ -263,7 +263,8 @@ protected:
|
||||||
virtual nsresult MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
|
virtual nsresult MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
|
||||||
nsIMsgDatabase *sourceDB,
|
nsIMsgDatabase *sourceDB,
|
||||||
const char *destFolder,
|
const char *destFolder,
|
||||||
nsIMsgFilter *filter);
|
nsIMsgFilter *filter,
|
||||||
|
nsIMsgWindow *msgWindow);
|
||||||
virtual int MarkFilteredMessageRead(nsIMsgDBHdr *msgHdr);
|
virtual int MarkFilteredMessageRead(nsIMsgDBHdr *msgHdr);
|
||||||
void LogRuleHit(nsIMsgFilter *filter, nsIMsgDBHdr *msgHdr);
|
void LogRuleHit(nsIMsgFilter *filter, nsIMsgDBHdr *msgHdr);
|
||||||
nsCOMPtr <nsIMsgFilterList> m_filterList;
|
nsCOMPtr <nsIMsgFilterList> m_filterList;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче