Bug 1739903 - Change filter-related URI APIs to AUTF8String. r=mkmelin
This commit is contained in:
Родитель
d6c4953f09
Коммит
dbc4af4f95
|
@ -28,13 +28,14 @@ interface nsISpamSettings: nsISupports {
|
||||||
attribute long moveTargetMode;
|
attribute long moveTargetMode;
|
||||||
const long MOVE_TARGET_MODE_ACCOUNT = 0;
|
const long MOVE_TARGET_MODE_ACCOUNT = 0;
|
||||||
const long MOVE_TARGET_MODE_FOLDER = 1;
|
const long MOVE_TARGET_MODE_FOLDER = 1;
|
||||||
attribute string actionTargetAccount;
|
// Despite their name the following are URIs.
|
||||||
attribute string actionTargetFolder;
|
attribute AUTF8String actionTargetAccount;
|
||||||
|
attribute AUTF8String actionTargetFolder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* built from moveTargetMode, actionTargetAccount, actionTargetFolder
|
* built from moveTargetMode, actionTargetAccount, actionTargetFolder
|
||||||
*/
|
*/
|
||||||
readonly attribute string spamFolderURI;
|
readonly attribute AUTF8String spamFolderURI;
|
||||||
|
|
||||||
attribute boolean purge;
|
attribute boolean purge;
|
||||||
/**
|
/**
|
||||||
|
@ -43,7 +44,7 @@ interface nsISpamSettings: nsISupports {
|
||||||
attribute long purgeInterval;
|
attribute long purgeInterval;
|
||||||
|
|
||||||
attribute boolean useWhiteList;
|
attribute boolean useWhiteList;
|
||||||
attribute string whiteListAbURI;
|
attribute AUTF8String whiteListAbURI;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should we do something when the user manually marks a message as junk?
|
* Should we do something when the user manually marks a message as junk?
|
||||||
|
|
|
@ -2113,13 +2113,13 @@ nsMsgDBFolder::GetInheritedStringProperty(const char* aPropertyName,
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsMsgDBFolder::OnMessageClassified(const char* aMsgURI,
|
nsMsgDBFolder::OnMessageClassified(const nsACString& aMsgURI,
|
||||||
nsMsgJunkStatus aClassification,
|
nsMsgJunkStatus aClassification,
|
||||||
uint32_t aJunkPercent) {
|
uint32_t aJunkPercent) {
|
||||||
nsresult rv = GetDatabase();
|
nsresult rv = GetDatabase();
|
||||||
NS_ENSURE_SUCCESS(rv, NS_OK);
|
NS_ENSURE_SUCCESS(rv, NS_OK);
|
||||||
|
|
||||||
if (!aMsgURI) // This signifies end of batch.
|
if (aMsgURI.IsEmpty()) // This signifies end of batch.
|
||||||
{
|
{
|
||||||
// Apply filters if needed.
|
// Apply filters if needed.
|
||||||
if (!mPostBayesMessagesToFilter.IsEmpty()) {
|
if (!mPostBayesMessagesToFilter.IsEmpty()) {
|
||||||
|
@ -2159,7 +2159,7 @@ nsMsgDBFolder::OnMessageClassified(const char* aMsgURI,
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
nsCOMPtr<nsIMsgDBHdr> msgHdr;
|
nsCOMPtr<nsIMsgDBHdr> msgHdr;
|
||||||
rv = GetMsgDBHdrFromURI(nsDependentCString(aMsgURI), getter_AddRefs(msgHdr));
|
rv = GetMsgDBHdrFromURI(aMsgURI, getter_AddRefs(msgHdr));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
nsMsgKey msgKey;
|
nsMsgKey msgKey;
|
||||||
|
@ -2207,17 +2207,17 @@ nsMsgDBFolder::OnMessageClassified(const char* aMsgURI,
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsMsgDBFolder::OnMessageTraitsClassified(const char* aMsgURI,
|
nsMsgDBFolder::OnMessageTraitsClassified(const nsACString& aMsgURI,
|
||||||
const nsTArray<uint32_t>& aTraits,
|
const nsTArray<uint32_t>& aTraits,
|
||||||
const nsTArray<uint32_t>& aPercents) {
|
const nsTArray<uint32_t>& aPercents) {
|
||||||
if (!aMsgURI) // This signifies end of batch
|
if (aMsgURI.IsEmpty()) // This signifies end of batch
|
||||||
return NS_OK; // We are not handling batching
|
return NS_OK; // We are not handling batching
|
||||||
|
|
||||||
MOZ_ASSERT(aTraits.Length() == aPercents.Length());
|
MOZ_ASSERT(aTraits.Length() == aPercents.Length());
|
||||||
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCOMPtr<nsIMsgDBHdr> msgHdr;
|
nsCOMPtr<nsIMsgDBHdr> msgHdr;
|
||||||
rv = GetMsgDBHdrFromURI(nsDependentCString(aMsgURI), getter_AddRefs(msgHdr));
|
rv = GetMsgDBHdrFromURI(aMsgURI, getter_AddRefs(msgHdr));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
nsMsgKey msgKey;
|
nsMsgKey msgKey;
|
||||||
|
@ -2569,7 +2569,7 @@ nsMsgDBFolder::CallFilterPlugins(nsIMsgWindow* aMsgWindow, bool* aFiltersRun) {
|
||||||
// post analysis filters will run consistently on a folder, even if
|
// post analysis filters will run consistently on a folder, even if
|
||||||
// disabled junk processing, which could be dynamic through whitelisting,
|
// disabled junk processing, which could be dynamic through whitelisting,
|
||||||
// makes the bayes analysis unnecessary.
|
// makes the bayes analysis unnecessary.
|
||||||
OnMessageClassified(nullptr, nsIJunkMailPlugin::UNCLASSIFIED, 0);
|
OnMessageClassified(EmptyCString(), nsIJunkMailPlugin::UNCLASSIFIED, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
|
|
|
@ -3287,7 +3287,7 @@ nsresult nsMsgDBView::SetMsgHdrJunkStatus(nsIJunkMailPlugin* aJunkPlugin,
|
||||||
// adjust its database appropriately.
|
// adjust its database appropriately.
|
||||||
nsCOMPtr<nsIMsgWindow> msgWindow(do_QueryReferent(mMsgWindowWeak));
|
nsCOMPtr<nsIMsgWindow> msgWindow(do_QueryReferent(mMsgWindowWeak));
|
||||||
rv = aJunkPlugin->SetMessageClassification(
|
rv = aJunkPlugin->SetMessageClassification(
|
||||||
uri.get(), oldUserClassification, aNewClassification, msgWindow, this);
|
uri, oldUserClassification, aNewClassification, msgWindow, this);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
// This routine is only reached if the user someone touched the UI
|
// This routine is only reached if the user someone touched the UI
|
||||||
|
@ -3308,14 +3308,14 @@ nsresult nsMsgDBView::SetMsgHdrJunkStatus(nsIJunkMailPlugin* aJunkPlugin,
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsMsgDBView::GetFolderFromMsgURI(const char* aMsgURI,
|
nsresult nsMsgDBView::GetFolderFromMsgURI(const nsACString& aMsgURI,
|
||||||
nsIMsgFolder** aFolder) {
|
nsIMsgFolder** aFolder) {
|
||||||
NS_IF_ADDREF(*aFolder = m_folder);
|
NS_IF_ADDREF(*aFolder = m_folder);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsMsgDBView::OnMessageClassified(const char* aMsgURI,
|
nsMsgDBView::OnMessageClassified(const nsACString& aMsgURI,
|
||||||
nsMsgJunkStatus aClassification,
|
nsMsgJunkStatus aClassification,
|
||||||
uint32_t aJunkPercent)
|
uint32_t aJunkPercent)
|
||||||
|
|
||||||
|
@ -3527,7 +3527,7 @@ nsresult nsMsgDBView::DetermineActionsForJunkChange(
|
||||||
if (folderFlags & nsMsgFolderFlags::Junk) return NS_OK;
|
if (folderFlags & nsMsgFolderFlags::Junk) return NS_OK;
|
||||||
|
|
||||||
nsCString spamFolderURI;
|
nsCString spamFolderURI;
|
||||||
rv = spamSettings->GetSpamFolderURI(getter_Copies(spamFolderURI));
|
rv = spamSettings->GetSpamFolderURI(spamFolderURI);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
NS_ASSERTION(!spamFolderURI.IsEmpty(),
|
NS_ASSERTION(!spamFolderURI.IsEmpty(),
|
||||||
|
|
|
@ -283,7 +283,7 @@ class nsMsgDBView : public nsIMsgDBView,
|
||||||
virtual nsMsgViewIndex FindKey(nsMsgKey key, bool expand);
|
virtual nsMsgViewIndex FindKey(nsMsgKey key, bool expand);
|
||||||
virtual nsresult GetDBForViewIndex(nsMsgViewIndex index, nsIMsgDatabase** db);
|
virtual nsresult GetDBForViewIndex(nsMsgViewIndex index, nsIMsgDatabase** db);
|
||||||
virtual nsCOMArray<nsIMsgFolder>* GetFolders();
|
virtual nsCOMArray<nsIMsgFolder>* GetFolders();
|
||||||
virtual nsresult GetFolderFromMsgURI(const char* aMsgURI,
|
virtual nsresult GetFolderFromMsgURI(const nsACString& aMsgURI,
|
||||||
nsIMsgFolder** aFolder);
|
nsIMsgFolder** aFolder);
|
||||||
|
|
||||||
virtual nsresult ListIdsInThread(nsIMsgThread* threadHdr,
|
virtual nsresult ListIdsInThread(nsIMsgThread* threadHdr,
|
||||||
|
|
|
@ -1784,7 +1784,7 @@ nsresult nsMsgIncomingServer::ConfigureTemporaryServerSpamFilters(
|
||||||
spamSettings->GetMoveOnSpam(&moveOnSpam);
|
spamSettings->GetMoveOnSpam(&moveOnSpam);
|
||||||
if (moveOnSpam) {
|
if (moveOnSpam) {
|
||||||
nsCString spamFolderURI;
|
nsCString spamFolderURI;
|
||||||
rv = spamSettings->GetSpamFolderURI(getter_Copies(spamFolderURI));
|
rv = spamSettings->GetSpamFolderURI(spamFolderURI);
|
||||||
if (NS_SUCCEEDED(rv) && (!spamFolderURI.IsEmpty())) {
|
if (NS_SUCCEEDED(rv) && (!spamFolderURI.IsEmpty())) {
|
||||||
nsCOMPtr<nsIMsgRuleAction> moveAction;
|
nsCOMPtr<nsIMsgRuleAction> moveAction;
|
||||||
rv = newFilter->CreateAction(getter_AddRefs(moveAction));
|
rv = newFilter->CreateAction(getter_AddRefs(moveAction));
|
||||||
|
|
|
@ -237,7 +237,7 @@ nsresult nsMsgPurgeService::PerformPurge() {
|
||||||
// check if the spam folder uri is set for this server
|
// check if the spam folder uri is set for this server
|
||||||
// if not skip it.
|
// if not skip it.
|
||||||
nsCString junkFolderURI;
|
nsCString junkFolderURI;
|
||||||
rv = spamSettings->GetSpamFolderURI(getter_Copies(junkFolderURI));
|
rv = spamSettings->GetSpamFolderURI(junkFolderURI);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info,
|
MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info,
|
||||||
|
|
|
@ -1094,16 +1094,15 @@ nsMsgSearchDBView::OpenWithHdrs(nsIMsgEnumerator* aHeaders,
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsMsgSearchDBView::GetFolderFromMsgURI(const char* aMsgURI,
|
nsresult nsMsgSearchDBView::GetFolderFromMsgURI(const nsACString& aMsgURI,
|
||||||
nsIMsgFolder** aFolder) {
|
nsIMsgFolder** aFolder) {
|
||||||
nsCOMPtr<nsIMsgMessageService> msgMessageService;
|
nsCOMPtr<nsIMsgMessageService> msgMessageService;
|
||||||
nsresult rv = GetMessageServiceFromURI(nsDependentCString(aMsgURI),
|
nsresult rv =
|
||||||
getter_AddRefs(msgMessageService));
|
GetMessageServiceFromURI(aMsgURI, getter_AddRefs(msgMessageService));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
nsCOMPtr<nsIMsgDBHdr> msgHdr;
|
nsCOMPtr<nsIMsgDBHdr> msgHdr;
|
||||||
rv = msgMessageService->MessageURIToMsgHdr(nsDependentCString(aMsgURI),
|
rv = msgMessageService->MessageURIToMsgHdr(aMsgURI, getter_AddRefs(msgHdr));
|
||||||
getter_AddRefs(msgHdr));
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
return msgHdr->GetFolder(aFolder);
|
return msgHdr->GetFolder(aFolder);
|
||||||
|
|
|
@ -78,7 +78,7 @@ class nsMsgSearchDBView : public nsMsgGroupView,
|
||||||
NS_IMETHOD OnAnnouncerGoingAway(nsIDBChangeAnnouncer* instigator) override;
|
NS_IMETHOD OnAnnouncerGoingAway(nsIDBChangeAnnouncer* instigator) override;
|
||||||
|
|
||||||
virtual nsCOMArray<nsIMsgFolder>* GetFolders() override;
|
virtual nsCOMArray<nsIMsgFolder>* GetFolders() override;
|
||||||
virtual nsresult GetFolderFromMsgURI(const char* aMsgURI,
|
virtual nsresult GetFolderFromMsgURI(const nsACString& aMsgURI,
|
||||||
nsIMsgFolder** aFolder) override;
|
nsIMsgFolder** aFolder) override;
|
||||||
|
|
||||||
NS_IMETHOD GetThreadContainingMsgHdr(nsIMsgDBHdr* msgHdr,
|
NS_IMETHOD GetThreadContainingMsgHdr(nsIMsgDBHdr* msgHdr,
|
||||||
|
|
|
@ -123,38 +123,36 @@ NS_IMPL_GETSET(nsSpamSettings, Purge, bool, mPurge)
|
||||||
NS_IMPL_GETSET(nsSpamSettings, UseWhiteList, bool, mUseWhiteList)
|
NS_IMPL_GETSET(nsSpamSettings, UseWhiteList, bool, mUseWhiteList)
|
||||||
NS_IMPL_GETSET(nsSpamSettings, UseServerFilter, bool, mUseServerFilter)
|
NS_IMPL_GETSET(nsSpamSettings, UseServerFilter, bool, mUseServerFilter)
|
||||||
|
|
||||||
NS_IMETHODIMP nsSpamSettings::GetWhiteListAbURI(char** aWhiteListAbURI) {
|
NS_IMETHODIMP nsSpamSettings::GetWhiteListAbURI(nsACString& aWhiteListAbURI) {
|
||||||
NS_ENSURE_ARG_POINTER(aWhiteListAbURI);
|
aWhiteListAbURI = mWhiteListAbURI;
|
||||||
*aWhiteListAbURI = ToNewCString(mWhiteListAbURI);
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
NS_IMETHODIMP nsSpamSettings::SetWhiteListAbURI(const char* aWhiteListAbURI) {
|
NS_IMETHODIMP nsSpamSettings::SetWhiteListAbURI(
|
||||||
|
const nsACString& aWhiteListAbURI) {
|
||||||
mWhiteListAbURI = aWhiteListAbURI;
|
mWhiteListAbURI = aWhiteListAbURI;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsSpamSettings::GetActionTargetAccount(
|
NS_IMETHODIMP nsSpamSettings::GetActionTargetAccount(
|
||||||
char** aActionTargetAccount) {
|
nsACString& aActionTargetAccount) {
|
||||||
NS_ENSURE_ARG_POINTER(aActionTargetAccount);
|
aActionTargetAccount = mActionTargetAccount;
|
||||||
*aActionTargetAccount = ToNewCString(mActionTargetAccount);
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsSpamSettings::SetActionTargetAccount(
|
NS_IMETHODIMP nsSpamSettings::SetActionTargetAccount(
|
||||||
const char* aActionTargetAccount) {
|
const nsACString& aActionTargetAccount) {
|
||||||
mActionTargetAccount = aActionTargetAccount;
|
mActionTargetAccount = aActionTargetAccount;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsSpamSettings::GetActionTargetFolder(
|
NS_IMETHODIMP nsSpamSettings::GetActionTargetFolder(
|
||||||
char** aActionTargetFolder) {
|
nsACString& aActionTargetFolder) {
|
||||||
NS_ENSURE_ARG_POINTER(aActionTargetFolder);
|
aActionTargetFolder = mActionTargetFolder;
|
||||||
*aActionTargetFolder = ToNewCString(mActionTargetFolder);
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsSpamSettings::SetActionTargetFolder(
|
NS_IMETHODIMP nsSpamSettings::SetActionTargetFolder(
|
||||||
const char* aActionTargetFolder) {
|
const nsACString& aActionTargetFolder) {
|
||||||
mActionTargetFolder = aActionTargetFolder;
|
mActionTargetFolder = aActionTargetFolder;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -248,13 +246,13 @@ NS_IMETHODIMP nsSpamSettings::Initialize(nsIMsgIncomingServer* aServer) {
|
||||||
rv =
|
rv =
|
||||||
aServer->GetCharValue("spamActionTargetAccount", spamActionTargetAccount);
|
aServer->GetCharValue("spamActionTargetAccount", spamActionTargetAccount);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = SetActionTargetAccount(spamActionTargetAccount.get());
|
rv = SetActionTargetAccount(spamActionTargetAccount);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
nsCString spamActionTargetFolder;
|
nsCString spamActionTargetFolder;
|
||||||
rv = aServer->GetCharValue("spamActionTargetFolder", spamActionTargetFolder);
|
rv = aServer->GetCharValue("spamActionTargetFolder", spamActionTargetFolder);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = SetActionTargetFolder(spamActionTargetFolder.get());
|
rv = SetActionTargetFolder(spamActionTargetFolder);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
bool useWhiteList;
|
bool useWhiteList;
|
||||||
|
@ -266,7 +264,7 @@ NS_IMETHODIMP nsSpamSettings::Initialize(nsIMsgIncomingServer* aServer) {
|
||||||
nsCString whiteListAbURI;
|
nsCString whiteListAbURI;
|
||||||
rv = aServer->GetCharValue("whiteListAbURI", whiteListAbURI);
|
rv = aServer->GetCharValue("whiteListAbURI", whiteListAbURI);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = SetWhiteListAbURI(whiteListAbURI.get());
|
rv = SetWhiteListAbURI(whiteListAbURI);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
bool purgeSpam;
|
bool purgeSpam;
|
||||||
|
@ -394,7 +392,7 @@ nsresult nsSpamSettings::UpdateJunkFolderState() {
|
||||||
// if the spam folder uri changed on us, we need to unset the junk flag
|
// if the spam folder uri changed on us, we need to unset the junk flag
|
||||||
// on the old spam folder
|
// on the old spam folder
|
||||||
nsCString newJunkFolderURI;
|
nsCString newJunkFolderURI;
|
||||||
rv = GetSpamFolderURI(getter_Copies(newJunkFolderURI));
|
rv = GetSpamFolderURI(newJunkFolderURI);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
if (!mCurrentJunkFolderURI.IsEmpty() &&
|
if (!mCurrentJunkFolderURI.IsEmpty() &&
|
||||||
|
@ -447,18 +445,17 @@ NS_IMETHODIMP nsSpamSettings::Clone(nsISpamSettings* aSpamSettings) {
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
nsCString actionTargetAccount;
|
nsCString actionTargetAccount;
|
||||||
rv =
|
rv = aSpamSettings->GetActionTargetAccount(actionTargetAccount);
|
||||||
aSpamSettings->GetActionTargetAccount(getter_Copies(actionTargetAccount));
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
mActionTargetAccount = actionTargetAccount;
|
mActionTargetAccount = actionTargetAccount;
|
||||||
|
|
||||||
nsCString actionTargetFolder;
|
nsCString actionTargetFolder;
|
||||||
rv = aSpamSettings->GetActionTargetFolder(getter_Copies(actionTargetFolder));
|
rv = aSpamSettings->GetActionTargetFolder(actionTargetFolder);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
mActionTargetFolder = actionTargetFolder;
|
mActionTargetFolder = actionTargetFolder;
|
||||||
|
|
||||||
nsCString whiteListAbURI;
|
nsCString whiteListAbURI;
|
||||||
rv = aSpamSettings->GetWhiteListAbURI(getter_Copies(whiteListAbURI));
|
rv = aSpamSettings->GetWhiteListAbURI(whiteListAbURI);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
mWhiteListAbURI = whiteListAbURI;
|
mWhiteListAbURI = whiteListAbURI;
|
||||||
|
|
||||||
|
@ -468,16 +465,14 @@ NS_IMETHODIMP nsSpamSettings::Clone(nsISpamSettings* aSpamSettings) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsSpamSettings::GetSpamFolderURI(char** aSpamFolderURI) {
|
NS_IMETHODIMP nsSpamSettings::GetSpamFolderURI(nsACString& aSpamFolderURI) {
|
||||||
NS_ENSURE_ARG_POINTER(aSpamFolderURI);
|
|
||||||
|
|
||||||
if (mMoveTargetMode == nsISpamSettings::MOVE_TARGET_MODE_FOLDER)
|
if (mMoveTargetMode == nsISpamSettings::MOVE_TARGET_MODE_FOLDER)
|
||||||
return GetActionTargetFolder(aSpamFolderURI);
|
return GetActionTargetFolder(aSpamFolderURI);
|
||||||
|
|
||||||
// if the mode is nsISpamSettings::MOVE_TARGET_MODE_ACCOUNT
|
// if the mode is nsISpamSettings::MOVE_TARGET_MODE_ACCOUNT
|
||||||
// the spam folder URI = account uri + "/Junk"
|
// the spam folder URI = account uri + "/Junk"
|
||||||
nsCString folderURI;
|
nsCString folderURI;
|
||||||
nsresult rv = GetActionTargetAccount(getter_Copies(folderURI));
|
nsresult rv = GetActionTargetAccount(folderURI);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
// we might be trying to get the old spam folder uri
|
// we might be trying to get the old spam folder uri
|
||||||
|
@ -518,11 +513,8 @@ NS_IMETHODIMP nsSpamSettings::GetSpamFolderURI(char** aSpamFolderURI) {
|
||||||
if (!folderUriWithNamespace.IsEmpty()) folderURI = folderUriWithNamespace;
|
if (!folderUriWithNamespace.IsEmpty()) folderURI = folderUriWithNamespace;
|
||||||
}
|
}
|
||||||
|
|
||||||
*aSpamFolderURI = ToNewCString(folderURI);
|
aSpamFolderURI = folderURI;
|
||||||
if (!*aSpamFolderURI)
|
return NS_OK;
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
else
|
|
||||||
return rv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsSpamSettings::GetServerFilterName(nsACString& aFilterName) {
|
NS_IMETHODIMP nsSpamSettings::GetServerFilterName(nsACString& aFilterName) {
|
||||||
|
@ -643,7 +635,7 @@ NS_IMETHODIMP nsSpamSettings::LogJunkHit(nsIMsgDBHdr* aMsgHdr,
|
||||||
aMsgHdr->GetMessageId(getter_Copies(msgId));
|
aMsgHdr->GetMessageId(getter_Copies(msgId));
|
||||||
|
|
||||||
nsCString junkFolderURI;
|
nsCString junkFolderURI;
|
||||||
rv = GetSpamFolderURI(getter_Copies(junkFolderURI));
|
rv = GetSpamFolderURI(junkFolderURI);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
AutoTArray<nsString, 2> logMoveFormatStrings;
|
AutoTArray<nsString, 2> logMoveFormatStrings;
|
||||||
|
@ -725,7 +717,7 @@ NS_IMETHODIMP nsSpamSettings::OnStartRunningUrl(nsIURI* aURL) {
|
||||||
NS_IMETHODIMP nsSpamSettings::OnStopRunningUrl(nsIURI* aURL,
|
NS_IMETHODIMP nsSpamSettings::OnStopRunningUrl(nsIURI* aURL,
|
||||||
nsresult exitCode) {
|
nsresult exitCode) {
|
||||||
nsCString junkFolderURI;
|
nsCString junkFolderURI;
|
||||||
nsresult rv = GetSpamFolderURI(getter_Copies(junkFolderURI));
|
nsresult rv = GetSpamFolderURI(junkFolderURI);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
if (junkFolderURI.IsEmpty()) return NS_ERROR_UNEXPECTED;
|
if (junkFolderURI.IsEmpty()) return NS_ERROR_UNEXPECTED;
|
||||||
|
|
|
@ -955,7 +955,7 @@ class TokenAnalyzer {
|
||||||
mTokenListener = aTokenListener;
|
mTokenListener = aTokenListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setSource(const char* sourceURI) { mTokenSource = sourceURI; }
|
void setSource(const nsACString& sourceURI) { mTokenSource = sourceURI; }
|
||||||
|
|
||||||
nsCOMPtr<nsIStreamListener> mTokenListener;
|
nsCOMPtr<nsIStreamListener> mTokenListener;
|
||||||
nsCString mTokenSource;
|
nsCString mTokenSource;
|
||||||
|
@ -1312,9 +1312,8 @@ class MessageClassifier : public TokenAnalyzer {
|
||||||
|
|
||||||
virtual ~MessageClassifier() {}
|
virtual ~MessageClassifier() {}
|
||||||
virtual void analyzeTokens(Tokenizer& tokenizer) {
|
virtual void analyzeTokens(Tokenizer& tokenizer) {
|
||||||
mFilter->classifyMessage(tokenizer, mTokenSource.get(), mProTraits,
|
mFilter->classifyMessage(tokenizer, mTokenSource, mProTraits, mAntiTraits,
|
||||||
mAntiTraits, mJunkListener, mTraitListener,
|
mJunkListener, mTraitListener, mDetailListener);
|
||||||
mDetailListener);
|
|
||||||
tokenizer.clearTokens();
|
tokenizer.clearTokens();
|
||||||
classifyNextMessage();
|
classifyNextMessage();
|
||||||
}
|
}
|
||||||
|
@ -1324,17 +1323,17 @@ class MessageClassifier : public TokenAnalyzer {
|
||||||
MOZ_LOG(BayesianFilterLogModule, LogLevel::Warning,
|
MOZ_LOG(BayesianFilterLogModule, LogLevel::Warning,
|
||||||
("classifyNextMessage(%s)",
|
("classifyNextMessage(%s)",
|
||||||
mMessageURIs[mCurMessageToClassify].get()));
|
mMessageURIs[mCurMessageToClassify].get()));
|
||||||
mFilter->tokenizeMessage(mMessageURIs[mCurMessageToClassify].get(),
|
mFilter->tokenizeMessage(mMessageURIs[mCurMessageToClassify], mMsgWindow,
|
||||||
mMsgWindow, this);
|
this);
|
||||||
} else {
|
} else {
|
||||||
// call all listeners with null parameters to signify end of batch
|
// call all listeners with null parameters to signify end of batch
|
||||||
if (mJunkListener)
|
if (mJunkListener)
|
||||||
mJunkListener->OnMessageClassified(nullptr,
|
mJunkListener->OnMessageClassified(EmptyCString(),
|
||||||
nsIJunkMailPlugin::UNCLASSIFIED, 0);
|
nsIJunkMailPlugin::UNCLASSIFIED, 0);
|
||||||
if (mTraitListener) {
|
if (mTraitListener) {
|
||||||
nsTArray<uint32_t> nullTraits;
|
nsTArray<uint32_t> nullTraits;
|
||||||
nsTArray<uint32_t> nullPercents;
|
nsTArray<uint32_t> nullPercents;
|
||||||
mTraitListener->OnMessageTraitsClassified(nullptr, nullTraits,
|
mTraitListener->OnMessageTraitsClassified(EmptyCString(), nullTraits,
|
||||||
nullPercents);
|
nullPercents);
|
||||||
}
|
}
|
||||||
mTokenListener =
|
mTokenListener =
|
||||||
|
@ -1356,22 +1355,19 @@ class MessageClassifier : public TokenAnalyzer {
|
||||||
uint32_t mCurMessageToClassify; // 0-based index
|
uint32_t mCurMessageToClassify; // 0-based index
|
||||||
};
|
};
|
||||||
|
|
||||||
nsresult nsBayesianFilter::tokenizeMessage(const char* aMessageURI,
|
nsresult nsBayesianFilter::tokenizeMessage(const nsACString& aMessageURI,
|
||||||
nsIMsgWindow* aMsgWindow,
|
nsIMsgWindow* aMsgWindow,
|
||||||
TokenAnalyzer* aAnalyzer) {
|
TokenAnalyzer* aAnalyzer) {
|
||||||
NS_ENSURE_ARG_POINTER(aMessageURI);
|
|
||||||
|
|
||||||
nsCOMPtr<nsIMsgMessageService> msgService;
|
nsCOMPtr<nsIMsgMessageService> msgService;
|
||||||
nsresult rv = GetMessageServiceFromURI(nsDependentCString(aMessageURI),
|
nsresult rv =
|
||||||
getter_AddRefs(msgService));
|
GetMessageServiceFromURI(aMessageURI, getter_AddRefs(msgService));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
aAnalyzer->setSource(aMessageURI);
|
aAnalyzer->setSource(aMessageURI);
|
||||||
nsCOMPtr<nsIURI> dummyNull;
|
nsCOMPtr<nsIURI> dummyNull;
|
||||||
return msgService->StreamMessage(
|
return msgService->StreamMessage(
|
||||||
nsDependentCString(aMessageURI), aAnalyzer->mTokenListener, aMsgWindow,
|
aMessageURI, aAnalyzer->mTokenListener, aMsgWindow, nullptr,
|
||||||
nullptr, true /* convert data */, "filter"_ns, false,
|
true /* convert data */, "filter"_ns, false, getter_AddRefs(dummyNull));
|
||||||
getter_AddRefs(dummyNull));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// a TraitAnalysis is the per-token representation of the statistical
|
// a TraitAnalysis is the per-token representation of the statistical
|
||||||
|
@ -1420,7 +1416,7 @@ static inline double chi2P(double chi2, double nu, int32_t* error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsBayesianFilter::classifyMessage(
|
void nsBayesianFilter::classifyMessage(
|
||||||
Tokenizer& tokenizer, const char* messageURI,
|
Tokenizer& tokenizer, const nsACString& messageURI,
|
||||||
nsTArray<uint32_t>& aProTraits, nsTArray<uint32_t>& aAntiTraits,
|
nsTArray<uint32_t>& aProTraits, nsTArray<uint32_t>& aAntiTraits,
|
||||||
nsIJunkMailClassificationListener* listener,
|
nsIJunkMailClassificationListener* listener,
|
||||||
nsIMsgTraitClassificationListener* aTraitListener,
|
nsIMsgTraitClassificationListener* aTraitListener,
|
||||||
|
@ -1677,7 +1673,7 @@ void nsBayesianFilter::classifyMessage(
|
||||||
bool isJunk = (prob >= mJunkProbabilityThreshold);
|
bool isJunk = (prob >= mJunkProbabilityThreshold);
|
||||||
MOZ_LOG(BayesianFilterLogModule, LogLevel::Info,
|
MOZ_LOG(BayesianFilterLogModule, LogLevel::Info,
|
||||||
("%s is junk probability = (%f) HAM SCORE:%f SPAM SCORE:%f",
|
("%s is junk probability = (%f) HAM SCORE:%f SPAM SCORE:%f",
|
||||||
messageURI, prob, H, S));
|
PromiseFlatCString(messageURI).get(), prob, H, S));
|
||||||
|
|
||||||
// the algorithm in "A Plan For Spam" assumes that you have a large good
|
// the algorithm in "A Plan For Spam" assumes that you have a large good
|
||||||
// corpus and a large junk corpus.
|
// corpus and a large junk corpus.
|
||||||
|
@ -1724,7 +1720,7 @@ void nsBayesianFilter::classifyMessage(
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsBayesianFilter::classifyMessage(
|
void nsBayesianFilter::classifyMessage(
|
||||||
Tokenizer& tokens, const char* messageURI,
|
Tokenizer& tokens, const nsACString& messageURI,
|
||||||
nsIJunkMailClassificationListener* aJunkListener) {
|
nsIJunkMailClassificationListener* aJunkListener) {
|
||||||
AutoTArray<uint32_t, 1> proTraits;
|
AutoTArray<uint32_t, 1> proTraits;
|
||||||
AutoTArray<uint32_t, 1> antiTraits;
|
AutoTArray<uint32_t, 1> antiTraits;
|
||||||
|
@ -1760,9 +1756,9 @@ NS_IMETHODIMP nsBayesianFilter::GetShouldDownloadAllHeaders(
|
||||||
/* void classifyMessage (in string aMsgURL, in nsIJunkMailClassificationListener
|
/* void classifyMessage (in string aMsgURL, in nsIJunkMailClassificationListener
|
||||||
* aListener); */
|
* aListener); */
|
||||||
NS_IMETHODIMP nsBayesianFilter::ClassifyMessage(
|
NS_IMETHODIMP nsBayesianFilter::ClassifyMessage(
|
||||||
const char* aMessageURL, nsIMsgWindow* aMsgWindow,
|
const nsACString& aMessageURL, nsIMsgWindow* aMsgWindow,
|
||||||
nsIJunkMailClassificationListener* aListener) {
|
nsIJunkMailClassificationListener* aListener) {
|
||||||
AutoTArray<nsCString, 1> urls = {nsDependentCString(aMessageURL)};
|
AutoTArray<nsCString, 1> urls = {PromiseFlatCString(aMessageURL)};
|
||||||
MessageClassifier* analyzer =
|
MessageClassifier* analyzer =
|
||||||
new MessageClassifier(this, aListener, aMsgWindow, urls);
|
new MessageClassifier(this, aListener, aMsgWindow, urls);
|
||||||
NS_ENSURE_TRUE(analyzer, NS_ERROR_OUT_OF_MEMORY);
|
NS_ENSURE_TRUE(analyzer, NS_ERROR_OUT_OF_MEMORY);
|
||||||
|
@ -1784,7 +1780,7 @@ NS_IMETHODIMP nsBayesianFilter::ClassifyMessages(
|
||||||
TokenStreamListener* tokenListener = new TokenStreamListener(analyzer);
|
TokenStreamListener* tokenListener = new TokenStreamListener(analyzer);
|
||||||
NS_ENSURE_TRUE(tokenListener, NS_ERROR_OUT_OF_MEMORY);
|
NS_ENSURE_TRUE(tokenListener, NS_ERROR_OUT_OF_MEMORY);
|
||||||
analyzer->setTokenListener(tokenListener);
|
analyzer->setTokenListener(tokenListener);
|
||||||
return tokenizeMessage(aMsgURLs[0].get(), aMsgWindow, analyzer);
|
return tokenizeMessage(aMsgURLs[0], aMsgWindow, analyzer);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsBayesianFilter::setAnalysis(Token& token, uint32_t aTraitIndex,
|
nsresult nsBayesianFilter::setAnalysis(Token& token, uint32_t aTraitIndex,
|
||||||
|
@ -1867,7 +1863,7 @@ NS_IMETHODIMP nsBayesianFilter::ClassifyTraitsInMessages(
|
||||||
TokenStreamListener* tokenListener = new TokenStreamListener(analyzer);
|
TokenStreamListener* tokenListener = new TokenStreamListener(analyzer);
|
||||||
|
|
||||||
analyzer->setTokenListener(tokenListener);
|
analyzer->setTokenListener(tokenListener);
|
||||||
return tokenizeMessage(aMsgURIs[0].get(), aMsgWindow, analyzer);
|
return tokenizeMessage(aMsgURIs[0], aMsgWindow, analyzer);
|
||||||
}
|
}
|
||||||
|
|
||||||
class MessageObserver : public TokenAnalyzer {
|
class MessageObserver : public TokenAnalyzer {
|
||||||
|
@ -1885,7 +1881,7 @@ class MessageObserver : public TokenAnalyzer {
|
||||||
mNewClassifications(aNewClassifications.Clone()) {}
|
mNewClassifications(aNewClassifications.Clone()) {}
|
||||||
|
|
||||||
virtual void analyzeTokens(Tokenizer& tokenizer) {
|
virtual void analyzeTokens(Tokenizer& tokenizer) {
|
||||||
mFilter->observeMessage(tokenizer, mTokenSource.get(), mOldClassifications,
|
mFilter->observeMessage(tokenizer, mTokenSource, mOldClassifications,
|
||||||
mNewClassifications, mJunkListener, mTraitListener);
|
mNewClassifications, mJunkListener, mTraitListener);
|
||||||
// release reference to listener, which will allow us to go away as well.
|
// release reference to listener, which will allow us to go away as well.
|
||||||
mTokenListener = nullptr;
|
mTokenListener = nullptr;
|
||||||
|
@ -1901,7 +1897,7 @@ class MessageObserver : public TokenAnalyzer {
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_IMETHODIMP nsBayesianFilter::SetMsgTraitClassification(
|
NS_IMETHODIMP nsBayesianFilter::SetMsgTraitClassification(
|
||||||
const char* aMsgURI, const nsTArray<uint32_t>& aOldTraits,
|
const nsACString& aMsgURI, const nsTArray<uint32_t>& aOldTraits,
|
||||||
const nsTArray<uint32_t>& aNewTraits,
|
const nsTArray<uint32_t>& aNewTraits,
|
||||||
nsIMsgTraitClassificationListener* aTraitListener, nsIMsgWindow* aMsgWindow,
|
nsIMsgTraitClassificationListener* aTraitListener, nsIMsgWindow* aMsgWindow,
|
||||||
nsIJunkMailClassificationListener* aJunkListener) {
|
nsIJunkMailClassificationListener* aJunkListener) {
|
||||||
|
@ -1918,7 +1914,7 @@ NS_IMETHODIMP nsBayesianFilter::SetMsgTraitClassification(
|
||||||
|
|
||||||
// set new message classifications for a message
|
// set new message classifications for a message
|
||||||
void nsBayesianFilter::observeMessage(
|
void nsBayesianFilter::observeMessage(
|
||||||
Tokenizer& tokenizer, const char* messageURL,
|
Tokenizer& tokenizer, const nsACString& messageURL,
|
||||||
nsTArray<uint32_t>& oldClassifications,
|
nsTArray<uint32_t>& oldClassifications,
|
||||||
nsTArray<uint32_t>& newClassifications,
|
nsTArray<uint32_t>& newClassifications,
|
||||||
nsIJunkMailClassificationListener* aJunkListener,
|
nsIJunkMailClassificationListener* aJunkListener,
|
||||||
|
@ -2010,7 +2006,7 @@ NS_IMETHODIMP nsBayesianFilter::GetUserHasClassified(bool* aResult) {
|
||||||
|
|
||||||
// Set message classification (only allows junk and good)
|
// Set message classification (only allows junk and good)
|
||||||
NS_IMETHODIMP nsBayesianFilter::SetMessageClassification(
|
NS_IMETHODIMP nsBayesianFilter::SetMessageClassification(
|
||||||
const char* aMsgURL, nsMsgJunkStatus aOldClassification,
|
const nsACString& aMsgURL, nsMsgJunkStatus aOldClassification,
|
||||||
nsMsgJunkStatus aNewClassification, nsIMsgWindow* aMsgWindow,
|
nsMsgJunkStatus aNewClassification, nsIMsgWindow* aMsgWindow,
|
||||||
nsIJunkMailClassificationListener* aListener) {
|
nsIJunkMailClassificationListener* aListener) {
|
||||||
AutoTArray<uint32_t, 1> oldClassifications;
|
AutoTArray<uint32_t, 1> oldClassifications;
|
||||||
|
@ -2042,11 +2038,11 @@ NS_IMETHODIMP nsBayesianFilter::ResetTrainingData() {
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsBayesianFilter::DetailMessage(
|
NS_IMETHODIMP nsBayesianFilter::DetailMessage(
|
||||||
const char* aMsgURI, uint32_t aProTrait, uint32_t aAntiTrait,
|
const nsACString& aMsgURI, uint32_t aProTrait, uint32_t aAntiTrait,
|
||||||
nsIMsgTraitDetailListener* aDetailListener, nsIMsgWindow* aMsgWindow) {
|
nsIMsgTraitDetailListener* aDetailListener, nsIMsgWindow* aMsgWindow) {
|
||||||
AutoTArray<uint32_t, 1> proTraits = {aProTrait};
|
AutoTArray<uint32_t, 1> proTraits = {aProTrait};
|
||||||
AutoTArray<uint32_t, 1> antiTraits = {aAntiTrait};
|
AutoTArray<uint32_t, 1> antiTraits = {aAntiTrait};
|
||||||
AutoTArray<nsCString, 1> uris = {nsDependentCString(aMsgURI)};
|
AutoTArray<nsCString, 1> uris = {PromiseFlatCString(aMsgURI)};
|
||||||
|
|
||||||
MessageClassifier* analyzer =
|
MessageClassifier* analyzer =
|
||||||
new MessageClassifier(this, nullptr, nullptr, aDetailListener, proTraits,
|
new MessageClassifier(this, nullptr, nullptr, aDetailListener, proTraits,
|
||||||
|
|
|
@ -345,19 +345,19 @@ class nsBayesianFilter : public nsIJunkMailPlugin,
|
||||||
|
|
||||||
nsresult Init();
|
nsresult Init();
|
||||||
|
|
||||||
nsresult tokenizeMessage(const char* messageURI, nsIMsgWindow* aMsgWindow,
|
nsresult tokenizeMessage(const nsACString& messageURI,
|
||||||
TokenAnalyzer* analyzer);
|
nsIMsgWindow* aMsgWindow, TokenAnalyzer* analyzer);
|
||||||
void classifyMessage(Tokenizer& tokens, const char* messageURI,
|
void classifyMessage(Tokenizer& tokens, const nsACString& messageURI,
|
||||||
nsIJunkMailClassificationListener* listener);
|
nsIJunkMailClassificationListener* listener);
|
||||||
|
|
||||||
void classifyMessage(Tokenizer& tokenizer, const char* messageURI,
|
void classifyMessage(Tokenizer& tokenizer, const nsACString& messageURI,
|
||||||
nsTArray<uint32_t>& aProTraits,
|
nsTArray<uint32_t>& aProTraits,
|
||||||
nsTArray<uint32_t>& aAntiTraits,
|
nsTArray<uint32_t>& aAntiTraits,
|
||||||
nsIJunkMailClassificationListener* listener,
|
nsIJunkMailClassificationListener* listener,
|
||||||
nsIMsgTraitClassificationListener* aTraitListener,
|
nsIMsgTraitClassificationListener* aTraitListener,
|
||||||
nsIMsgTraitDetailListener* aDetailListener);
|
nsIMsgTraitDetailListener* aDetailListener);
|
||||||
|
|
||||||
void observeMessage(Tokenizer& tokens, const char* messageURI,
|
void observeMessage(Tokenizer& tokens, const nsACString& messageURI,
|
||||||
nsTArray<uint32_t>& oldClassifications,
|
nsTArray<uint32_t>& oldClassifications,
|
||||||
nsTArray<uint32_t>& newClassifications,
|
nsTArray<uint32_t>& newClassifications,
|
||||||
nsIJunkMailClassificationListener* listener,
|
nsIJunkMailClassificationListener* listener,
|
||||||
|
|
|
@ -1372,11 +1372,11 @@ NS_IMETHODIMP nsImapIncomingServer::DiscoveryDone() {
|
||||||
rv = GetSpamSettings(getter_AddRefs(spamSettings));
|
rv = GetSpamSettings(getter_AddRefs(spamSettings));
|
||||||
if (NS_SUCCEEDED(rv) && spamSettings) {
|
if (NS_SUCCEEDED(rv) && spamSettings) {
|
||||||
nsCString spamFolderUri, existingUri;
|
nsCString spamFolderUri, existingUri;
|
||||||
spamSettings->GetSpamFolderURI(getter_Copies(spamFolderUri));
|
spamSettings->GetSpamFolderURI(spamFolderUri);
|
||||||
if (CheckSpecialFolder(spamFolderUri, nsMsgFolderFlags::Junk,
|
if (CheckSpecialFolder(spamFolderUri, nsMsgFolderFlags::Junk,
|
||||||
existingUri)) {
|
existingUri)) {
|
||||||
// This only sets the cached values in the spam settings object.
|
// This only sets the cached values in the spam settings object.
|
||||||
spamSettings->SetActionTargetFolder(existingUri.get());
|
spamSettings->SetActionTargetFolder(existingUri);
|
||||||
spamSettings->SetMoveTargetMode(
|
spamSettings->SetMoveTargetMode(
|
||||||
nsISpamSettings::MOVE_TARGET_MODE_FOLDER);
|
nsISpamSettings::MOVE_TARGET_MODE_FOLDER);
|
||||||
// Set the preferences too so that the values persist.
|
// Set the preferences too so that the values persist.
|
||||||
|
|
|
@ -8242,18 +8242,17 @@ nsImapMailFolder::SetJunkScoreForMessages(
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsImapMailFolder::OnMessageClassified(const char* aMsgURI,
|
nsImapMailFolder::OnMessageClassified(const nsACString& aMsgURI,
|
||||||
nsMsgJunkStatus aClassification,
|
nsMsgJunkStatus aClassification,
|
||||||
uint32_t aJunkPercent) {
|
uint32_t aJunkPercent) {
|
||||||
nsCOMPtr<nsIMsgIncomingServer> server;
|
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||||
nsresult rv = GetServer(getter_AddRefs(server));
|
nsresult rv = GetServer(getter_AddRefs(server));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
if (aMsgURI) // not end of batch
|
if (!aMsgURI.IsEmpty()) // not end of batch
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIMsgDBHdr> msgHdr;
|
nsCOMPtr<nsIMsgDBHdr> msgHdr;
|
||||||
rv =
|
rv = GetMsgDBHdrFromURI(aMsgURI, getter_AddRefs(msgHdr));
|
||||||
GetMsgDBHdrFromURI(nsDependentCString(aMsgURI), getter_AddRefs(msgHdr));
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
nsMsgKey msgKey;
|
nsMsgKey msgKey;
|
||||||
|
@ -8298,7 +8297,7 @@ nsImapMailFolder::OnMessageClassified(const char* aMsgURI,
|
||||||
(void)spamSettings->GetMoveOnSpam(&moveOnSpam);
|
(void)spamSettings->GetMoveOnSpam(&moveOnSpam);
|
||||||
if (moveOnSpam) {
|
if (moveOnSpam) {
|
||||||
nsCString spamFolderURI;
|
nsCString spamFolderURI;
|
||||||
rv = spamSettings->GetSpamFolderURI(getter_Copies(spamFolderURI));
|
rv = spamSettings->GetSpamFolderURI(spamFolderURI);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
if (!spamFolderURI.IsEmpty()) {
|
if (!spamFolderURI.IsEmpty()) {
|
||||||
|
@ -8335,8 +8334,8 @@ nsImapMailFolder::OnMessageClassified(const char* aMsgURI,
|
||||||
else // end of batch
|
else // end of batch
|
||||||
{
|
{
|
||||||
// Parent will apply post bayes filters.
|
// Parent will apply post bayes filters.
|
||||||
nsMsgDBFolder::OnMessageClassified(nullptr, nsIJunkMailPlugin::UNCLASSIFIED,
|
nsMsgDBFolder::OnMessageClassified(EmptyCString(),
|
||||||
0);
|
nsIJunkMailPlugin::UNCLASSIFIED, 0);
|
||||||
|
|
||||||
if (!m_junkMessagesToMarkAsRead.IsEmpty()) {
|
if (!m_junkMessagesToMarkAsRead.IsEmpty()) {
|
||||||
rv = MarkMessagesRead(m_junkMessagesToMarkAsRead, true);
|
rv = MarkMessagesRead(m_junkMessagesToMarkAsRead, true);
|
||||||
|
|
|
@ -3062,7 +3062,7 @@ NS_IMETHODIMP nsMsgLocalMailFolder::Shutdown(bool shutdownChildren) {
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsMsgLocalMailFolder::OnMessageClassified(const char* aMsgURI,
|
nsMsgLocalMailFolder::OnMessageClassified(const nsACString& aMsgURI,
|
||||||
nsMsgJunkStatus aClassification,
|
nsMsgJunkStatus aClassification,
|
||||||
uint32_t aJunkPercent)
|
uint32_t aJunkPercent)
|
||||||
|
|
||||||
|
@ -3076,14 +3076,13 @@ nsMsgLocalMailFolder::OnMessageClassified(const char* aMsgURI,
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
nsCString spamFolderURI;
|
nsCString spamFolderURI;
|
||||||
rv = spamSettings->GetSpamFolderURI(getter_Copies(spamFolderURI));
|
rv = spamSettings->GetSpamFolderURI(spamFolderURI);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
if (aMsgURI) // not end of batch
|
if (!aMsgURI.IsEmpty()) // not end of batch
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIMsgDBHdr> msgHdr;
|
nsCOMPtr<nsIMsgDBHdr> msgHdr;
|
||||||
rv =
|
rv = GetMsgDBHdrFromURI(aMsgURI, getter_AddRefs(msgHdr));
|
||||||
GetMsgDBHdrFromURI(nsDependentCString(aMsgURI), getter_AddRefs(msgHdr));
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
nsMsgKey msgKey;
|
nsMsgKey msgKey;
|
||||||
|
@ -3141,8 +3140,8 @@ nsMsgLocalMailFolder::OnMessageClassified(const char* aMsgURI,
|
||||||
else // end of batch
|
else // end of batch
|
||||||
{
|
{
|
||||||
// Parent will apply post bayes filters.
|
// Parent will apply post bayes filters.
|
||||||
nsMsgDBFolder::OnMessageClassified(nullptr, nsIJunkMailPlugin::UNCLASSIFIED,
|
nsMsgDBFolder::OnMessageClassified(EmptyCString(),
|
||||||
0);
|
nsIJunkMailPlugin::UNCLASSIFIED, 0);
|
||||||
nsTArray<RefPtr<nsIMsgDBHdr>> messages;
|
nsTArray<RefPtr<nsIMsgDBHdr>> messages;
|
||||||
if (!mSpamKeysToMove.IsEmpty()) {
|
if (!mSpamKeysToMove.IsEmpty()) {
|
||||||
nsCOMPtr<nsIMsgFolder> folder;
|
nsCOMPtr<nsIMsgFolder> folder;
|
||||||
|
|
|
@ -82,7 +82,7 @@ interface nsIMsgFilterList : nsISupports {
|
||||||
void writeStrAttr(in nsMsgFilterFileAttribValue attrib, in string value, in nsIOutputStream stream);
|
void writeStrAttr(in nsMsgFilterFileAttribValue attrib, in string value, in nsIOutputStream stream);
|
||||||
void writeWstrAttr(in nsMsgFilterFileAttribValue attrib, in wstring value, in nsIOutputStream stream);
|
void writeWstrAttr(in nsMsgFilterFileAttribValue attrib, in wstring value, in nsIOutputStream stream);
|
||||||
void writeBoolAttr(in nsMsgFilterFileAttribValue attrib, in boolean value, in nsIOutputStream stream);
|
void writeBoolAttr(in nsMsgFilterFileAttribValue attrib, in boolean value, in nsIOutputStream stream);
|
||||||
boolean matchOrChangeFilterTarget(in ACString oldUri, in ACString newUri, in boolean caseInsensitive);
|
boolean matchOrChangeFilterTarget(in AUTF8String oldUri, in AUTF8String newUri, in boolean caseInsensitive);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Turn filter logging on or off. Turning logging off will close any
|
* Turn filter logging on or off. Turning logging off will close any
|
||||||
|
|
|
@ -53,7 +53,7 @@ interface nsIJunkMailClassificationListener : nsISupports
|
||||||
* @param aJunkPercent indicator of degree of uncertainty, with 100 being
|
* @param aJunkPercent indicator of degree of uncertainty, with 100 being
|
||||||
* probably junk, and 0 probably good
|
* probably junk, and 0 probably good
|
||||||
*/
|
*/
|
||||||
void onMessageClassified(in string aMsgURI,
|
void onMessageClassified(in AUTF8String aMsgURI,
|
||||||
in nsMsgJunkStatus aClassification,
|
in nsMsgJunkStatus aClassification,
|
||||||
in uint32_t aJunkPercent);
|
in uint32_t aJunkPercent);
|
||||||
};
|
};
|
||||||
|
@ -74,7 +74,7 @@ interface nsIMsgTraitClassificationListener : nsISupports
|
||||||
* matched) of the trait with the corresponding array
|
* matched) of the trait with the corresponding array
|
||||||
* index in aTraits
|
* index in aTraits
|
||||||
*/
|
*/
|
||||||
void onMessageTraitsClassified(in string aMsgURI,
|
void onMessageTraitsClassified(in AUTF8String aMsgURI,
|
||||||
in Array<unsigned long> aTraits,
|
in Array<unsigned long> aTraits,
|
||||||
in Array<unsigned long> aPercents);
|
in Array<unsigned long> aPercents);
|
||||||
};
|
};
|
||||||
|
@ -98,7 +98,7 @@ interface nsIMsgTraitDetailListener : nsISupports
|
||||||
* @param runningPercents calculated probability that the message matches the
|
* @param runningPercents calculated probability that the message matches the
|
||||||
* trait, accounting for this token and all stronger tokens.
|
* trait, accounting for this token and all stronger tokens.
|
||||||
*/
|
*/
|
||||||
void onMessageTraitDetails(in string aMsgUri,
|
void onMessageTraitDetails(in AUTF8String aMsgUri,
|
||||||
in unsigned long aProTrait,
|
in unsigned long aProTrait,
|
||||||
in Array<AString> tokenStrings,
|
in Array<AString> tokenStrings,
|
||||||
in Array<unsigned long> tokenPercents,
|
in Array<unsigned long> tokenPercents,
|
||||||
|
@ -135,10 +135,10 @@ interface nsIJunkMailPlugin : nsIMsgFilterPlugin
|
||||||
* Given a message URI, determine what its current classification is
|
* Given a message URI, determine what its current classification is
|
||||||
* according to the current training set.
|
* according to the current training set.
|
||||||
*/
|
*/
|
||||||
void classifyMessage(in string aMsgURI, in nsIMsgWindow aMsgWindow,
|
void classifyMessage(in AUTF8String aMsgURI, in nsIMsgWindow aMsgWindow,
|
||||||
in nsIJunkMailClassificationListener aListener);
|
in nsIJunkMailClassificationListener aListener);
|
||||||
|
|
||||||
void classifyMessages(in Array<ACString> aMsgURIs,
|
void classifyMessages(in Array<AUTF8String> aMsgURIs,
|
||||||
in nsIMsgWindow aMsgWindow,
|
in nsIMsgWindow aMsgWindow,
|
||||||
in nsIJunkMailClassificationListener aListener);
|
in nsIJunkMailClassificationListener aListener);
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ interface nsIJunkMailPlugin : nsIMsgFilterPlugin
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void classifyTraitsInMessage(
|
void classifyTraitsInMessage(
|
||||||
in ACString aMsgURI,
|
in AUTF8String aMsgURI,
|
||||||
in Array<unsigned long> aProTraits,
|
in Array<unsigned long> aProTraits,
|
||||||
in Array<unsigned long> aAntiTraits,
|
in Array<unsigned long> aAntiTraits,
|
||||||
in nsIMsgTraitClassificationListener aTraitListener,
|
in nsIMsgTraitClassificationListener aTraitListener,
|
||||||
|
@ -183,7 +183,7 @@ interface nsIJunkMailPlugin : nsIMsgFilterPlugin
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void classifyTraitsInMessages(
|
void classifyTraitsInMessages(
|
||||||
in Array<ACString> aMsgURIs,
|
in Array<AUTF8String> aMsgURIs,
|
||||||
in Array<unsigned long> aProTraits,
|
in Array<unsigned long> aProTraits,
|
||||||
in Array<unsigned long> aAntiTraits,
|
in Array<unsigned long> aAntiTraits,
|
||||||
in nsIMsgTraitClassificationListener aTraitListener,
|
in nsIMsgTraitClassificationListener aTraitListener,
|
||||||
|
@ -201,7 +201,7 @@ interface nsIJunkMailPlugin : nsIMsgFilterPlugin
|
||||||
* @arg aListener Callback (may be null)
|
* @arg aListener Callback (may be null)
|
||||||
*/
|
*/
|
||||||
void setMessageClassification(
|
void setMessageClassification(
|
||||||
in string aMsgURI, in nsMsgJunkStatus aOldUserClassification,
|
in AUTF8String aMsgURI, in nsMsgJunkStatus aOldUserClassification,
|
||||||
in nsMsgJunkStatus aNewClassification,
|
in nsMsgJunkStatus aNewClassification,
|
||||||
in nsIMsgWindow aMsgWindow,
|
in nsIMsgWindow aMsgWindow,
|
||||||
in nsIJunkMailClassificationListener aListener);
|
in nsIJunkMailClassificationListener aListener);
|
||||||
|
@ -220,7 +220,7 @@ interface nsIJunkMailPlugin : nsIMsgFilterPlugin
|
||||||
* @param aJunkListener junk-oriented listener (may be null)
|
* @param aJunkListener junk-oriented listener (may be null)
|
||||||
*/
|
*/
|
||||||
void setMsgTraitClassification(
|
void setMsgTraitClassification(
|
||||||
in string aMsgURI,
|
in AUTF8String aMsgURI,
|
||||||
in Array<unsigned long> aOldTraits,
|
in Array<unsigned long> aOldTraits,
|
||||||
in Array<unsigned long> aNewTraits,
|
in Array<unsigned long> aNewTraits,
|
||||||
[optional] in nsIMsgTraitClassificationListener aTraitListener,
|
[optional] in nsIMsgTraitClassificationListener aTraitListener,
|
||||||
|
@ -250,7 +250,7 @@ interface nsIJunkMailPlugin : nsIMsgFilterPlugin
|
||||||
* @param aMsgWindow current message window (may be null)
|
* @param aMsgWindow current message window (may be null)
|
||||||
*/
|
*/
|
||||||
void detailMessage(
|
void detailMessage(
|
||||||
in string aMsgURI,
|
in AUTF8String aMsgURI,
|
||||||
in unsigned long aProTrait,
|
in unsigned long aProTrait,
|
||||||
in unsigned long aAntiTrait,
|
in unsigned long aAntiTrait,
|
||||||
in nsIMsgTraitDetailListener aListener,
|
in nsIMsgTraitDetailListener aListener,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче