зеркало из https://github.com/mozilla/pjs.git
Bug #290237 --> Add junk mail UI to honor server based spam headers. For now, export a spam assasin filter.
We'll add more later. sr=bienvenu a=chofmann
This commit is contained in:
Родитель
d2d71e0475
Коммит
4b4f2823fd
|
@ -1,294 +0,0 @@
|
|||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2002
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Seth Spitzer <sspitzer@netscape.com>
|
||||
# Dan Mosedale <dmose@netscape.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
var gSpamSettings = {};
|
||||
var gCurrentServer;
|
||||
var gMessengerBundle;
|
||||
|
||||
// pref service is global
|
||||
var gPrefService = null;
|
||||
|
||||
const kJunkOnLocalFolderURI = "mailbox://nobody@Local%20Folders/Junk";
|
||||
|
||||
function onJunkMailLoad()
|
||||
{
|
||||
gMessengerBundle = document.getElementById("bundle_messenger");
|
||||
if (window.arguments && window.arguments[0]) {
|
||||
setupForAccountFromFolder(window.arguments[0].folder ? window.arguments[0].folder.URI : null);
|
||||
}
|
||||
|
||||
// initialize prefs
|
||||
gPrefService = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
|
||||
|
||||
// initialize the sanitize junk mail html check box
|
||||
document.getElementById('renderWithSafeHtml').checked = gPrefService.getBoolPref('mailnews.display.sanitizeJunkMail');
|
||||
}
|
||||
|
||||
function onServerClick(event)
|
||||
{
|
||||
if (gCurrentServer.serverURI == event.target.id)
|
||||
return;
|
||||
|
||||
// before we set the UI for the new server,
|
||||
// save off the old one
|
||||
storeSettings(gSpamSettings[gCurrentServer.key].settings, gCurrentServer.spamSettings.loggingEnabled);
|
||||
|
||||
// set up the UI for the server
|
||||
setupForAccountFromFolder(event.target.id);
|
||||
}
|
||||
|
||||
function setupForAccountFromFolder(aURI)
|
||||
{
|
||||
try {
|
||||
if (!aURI)
|
||||
throw "this can happen if no folder is selected in the folder pane"
|
||||
var msgFolder = GetMsgFolderFromUri(aURI, false);
|
||||
gCurrentServer = msgFolder.server;
|
||||
|
||||
if (gCurrentServer.type == "nntp")
|
||||
throw "this can happen if the selected folder (or account) doesn't have junk controls (news)"
|
||||
}
|
||||
catch (ex) {
|
||||
// get server for default account
|
||||
// XXX TODO
|
||||
// edge cases to worry about later:
|
||||
// what if there is no default account?
|
||||
// what if default account is of a type where canGetIncomingMessages == true?
|
||||
// what if no accounts are of a type where canGetIncomingMessages == true?
|
||||
var accountManager = Components.classes["@mozilla.org/messenger/account-manager;1"]
|
||||
.getService(Components.interfaces.nsIMsgAccountManager);
|
||||
var account = accountManager.defaultAccount;
|
||||
gCurrentServer = account.incomingServer;
|
||||
}
|
||||
|
||||
var obj;
|
||||
var key = gCurrentServer.key;
|
||||
|
||||
if (key in gSpamSettings) {
|
||||
obj = gSpamSettings[key];
|
||||
}
|
||||
else {
|
||||
// get and clone spam settings for this server
|
||||
// we clone because if the users cancels we are going to throw away the changes
|
||||
var settings = Components.classes["@mozilla.org/messenger/spamsettings;1"].createInstance(Components.interfaces.nsISpamSettings);
|
||||
settings.clone(gCurrentServer.spamSettings);
|
||||
obj = {server: gCurrentServer, settings: settings};
|
||||
gSpamSettings[key] = obj;
|
||||
}
|
||||
|
||||
// select server in the menulist
|
||||
var serverList = document.getElementById("server");
|
||||
var menuitems = serverList.getElementsByAttribute("id", obj.server.serverURI);
|
||||
serverList.selectedItem = menuitems[0];
|
||||
|
||||
// set up the UI for this server
|
||||
// set up the level checkbox
|
||||
document.getElementById("level").checked = (obj.settings.level > 0);
|
||||
|
||||
// set up the junk mail folder picker
|
||||
document.getElementById("moveOnSpam").checked = obj.settings.moveOnSpam;
|
||||
document.getElementById("moveTargetMode").selectedItem = document.getElementById("moveTargetMode" + obj.settings.moveTargetMode);
|
||||
|
||||
// the default account should be the current account
|
||||
// unless you can't create a folder on that server
|
||||
// or search on that account (for purge)
|
||||
// in which case, use Local Folders
|
||||
var defaultAccountURI = obj.server.canCreateFoldersOnServer && obj.server.canSearchMessages ? obj.server.serverURI : "mailbox://nobody@Local%20Folders";
|
||||
// if there is a target account, use it, else use the default account
|
||||
SetFolderPicker(obj.settings.actionTargetAccount ? obj.settings.actionTargetAccount : defaultAccountURI, "actionTargetAccount");
|
||||
|
||||
// if there is a target account, use it, else use Junk on Local Folders
|
||||
if (obj.settings.actionTargetFolder)
|
||||
SetFolderPicker(obj.settings.actionTargetFolder, "actionTargetFolder");
|
||||
else {
|
||||
// note, this folder might not exist, but better this than ""
|
||||
// and, we'll create it if we try to use it.
|
||||
SetFolderPicker(kJunkOnLocalFolderURI, "actionTargetFolder");
|
||||
}
|
||||
|
||||
// set up the purge UI
|
||||
document.getElementById("purge").checked = obj.settings.purge;
|
||||
document.getElementById("purgeInterval").value = obj.settings.purgeInterval;
|
||||
|
||||
// set up the whitelist UI
|
||||
document.getElementById("useWhiteList").checked = obj.settings.useWhiteList;
|
||||
var abList = document.getElementById("whiteListAbURI");
|
||||
menuitems = abList.getElementsByAttribute("id", obj.settings.whiteListAbURI);
|
||||
abList.selectedItem = menuitems[0];
|
||||
|
||||
// set up the manual mark UI
|
||||
document.getElementById("manualMark").checked = obj.settings.manualMark;
|
||||
document.getElementById("manualMarkMode").selectedItem = document.getElementById("manualMarkMode" + obj.settings.manualMarkMode);
|
||||
|
||||
conditionallyEnableUI(null);
|
||||
}
|
||||
|
||||
function junkLog()
|
||||
{
|
||||
// pass in the "real" spam settings, as it's the one with the logStream
|
||||
var args = {spamSettings: gCurrentServer.spamSettings};
|
||||
window.openDialog("chrome://messenger/content/junkLog.xul", "junkLog", "chrome,modal,titlebar,resizable,centerscreen", args);
|
||||
}
|
||||
|
||||
function onAccept()
|
||||
{
|
||||
// store the current changes
|
||||
storeSettings(gSpamSettings[gCurrentServer.key].settings, gCurrentServer.spamSettings.loggingEnabled);
|
||||
|
||||
for (var key in gSpamSettings) {
|
||||
try {
|
||||
// if they hit ok, set the "real" server's spam settings.
|
||||
// this will set prefs.
|
||||
gSpamSettings[key].server.spamSettings = gSpamSettings[key].settings;
|
||||
}
|
||||
catch (ex) {
|
||||
dump("spam setting not saved: " + ex);
|
||||
}
|
||||
}
|
||||
|
||||
// now store off our non account specific settings
|
||||
gPrefService.setBoolPref('mailnews.display.sanitizeJunkMail', document.getElementById('renderWithSafeHtml').checked);
|
||||
return true;
|
||||
}
|
||||
|
||||
function storeSettings(aSettings, aLoggingEnabled)
|
||||
{
|
||||
aSettings.level = document.getElementById("level").checked ? 100 : 0;
|
||||
aSettings.moveOnSpam = document.getElementById("moveOnSpam").checked;
|
||||
aSettings.moveTargetMode = document.getElementById("moveTargetMode").value;
|
||||
aSettings.actionTargetAccount = document.getElementById("actionTargetAccount").getAttribute("uri");
|
||||
var targetFolderURI = document.getElementById("actionTargetFolder").getAttribute("uri");
|
||||
if (targetFolderURI)
|
||||
aSettings.actionTargetFolder = targetFolderURI;
|
||||
else {
|
||||
// note, this folder might not exist, but better this than ""
|
||||
// and, we'll create it if we try to use it.
|
||||
aSettings.actionTargetFolder = kJunkOnLocalFolderURI;
|
||||
}
|
||||
|
||||
aSettings.purge = document.getElementById("purge").checked;
|
||||
aSettings.purgeInterval = document.getElementById("purgeInterval").value;
|
||||
|
||||
aSettings.useWhiteList = document.getElementById("useWhiteList").checked;
|
||||
aSettings.whiteListAbURI = document.getElementById("whiteListAbURI").selectedItem.getAttribute("id");
|
||||
aSettings.loggingEnabled = aLoggingEnabled;
|
||||
|
||||
aSettings.manualMark = document.getElementById("manualMark").checked;
|
||||
aSettings.manualMarkMode = document.getElementById("manualMarkMode").value;
|
||||
}
|
||||
|
||||
function conditionallyEnableUI(id)
|
||||
{
|
||||
if (!document.getElementById("level").checked) {
|
||||
document.getElementById("useWhiteList").disabled = true;
|
||||
document.getElementById("whiteListAbURI").disabled = true;
|
||||
document.getElementById("moveOnSpam").disabled = true;
|
||||
|
||||
document.getElementById("moveTargetMode").disabled = true;
|
||||
document.getElementById("actionTargetAccount").disabled = true;
|
||||
document.getElementById("actionTargetFolder").disabled = true;
|
||||
|
||||
document.getElementById("purge").disabled = true;
|
||||
document.getElementById("purgeInterval").disabled = true;
|
||||
document.getElementById("purgeLabel").disabled = true;
|
||||
|
||||
document.getElementById("manualMark").disabled = true;
|
||||
document.getElementById("manualMarkMode").disabled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
document.getElementById("useWhiteList").disabled = false;
|
||||
document.getElementById("moveOnSpam").disabled = false;
|
||||
document.getElementById("manualMark").disabled = false;
|
||||
|
||||
var enabled;
|
||||
|
||||
if (!id || id == "manualMark") {
|
||||
enabled = document.getElementById("manualMark").checked;
|
||||
// need to enable manualMarkMode before we enable manualMarkMode0
|
||||
document.getElementById("manualMarkMode").disabled = !enabled;
|
||||
}
|
||||
|
||||
if (!id || id == "moveOnSpam") {
|
||||
enabled = document.getElementById("moveOnSpam").checked;
|
||||
var choice = document.getElementById("moveTargetMode").value;
|
||||
|
||||
document.getElementById("moveTargetMode").disabled = !enabled;
|
||||
document.getElementById("actionTargetAccount").disabled = !enabled || (choice == 1);
|
||||
document.getElementById("actionTargetFolder").disabled = !enabled || (choice == 0);
|
||||
|
||||
var checked = document.getElementById("purge").checked;
|
||||
document.getElementById("purge").disabled = !enabled;
|
||||
document.getElementById("purgeInterval").disabled = !enabled || !checked;
|
||||
document.getElementById("purgeLabel").disabled = !enabled;
|
||||
}
|
||||
|
||||
if (id == "purge") {
|
||||
enabled = document.getElementById("purge").checked;
|
||||
document.getElementById("purgeInterval").disabled = !enabled;
|
||||
}
|
||||
|
||||
if (!id || id == "useWhiteList") {
|
||||
enabled = document.getElementById("useWhiteList").checked;
|
||||
document.getElementById("whiteListAbURI").disabled = !enabled;
|
||||
}
|
||||
}
|
||||
|
||||
function doHelpButton()
|
||||
{
|
||||
openHelp("mail-junk-controls");
|
||||
}
|
||||
|
||||
function resetTrainingData()
|
||||
{
|
||||
// make sure the user really wants to do this
|
||||
promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService);
|
||||
var title = gMessengerBundle.getString("confirmResetJunkTrainingTitle");
|
||||
var text = gMessengerBundle.getString("confirmResetJunkTrainingText");
|
||||
|
||||
// if the user says no, then just fall out
|
||||
if (!promptService.confirm(window, title, text))
|
||||
return;
|
||||
|
||||
// otherwise go ahead and remove the training data
|
||||
var junkmailPlugin = Components.classes["@mozilla.org/messenger/filter-plugin;1?name=bayesianfilter"]
|
||||
.getService(Components.interfaces.nsIJunkMailPlugin);
|
||||
|
||||
if (junkmailPlugin)
|
||||
junkmailPlugin.resetTrainingData();
|
||||
}
|
|
@ -105,27 +105,44 @@
|
|||
<tabpanels id="junkMailTabsPanels" flex="1">
|
||||
|
||||
<!-- JunkMail Tab -->
|
||||
<vbox index="name" flex="1">
|
||||
<checkbox id="useWhiteList" oncommand="conditionallyEnableUI('useWhiteList')" accesskey="&whitelist.accesskey;" label="&whitelist.label;"/>
|
||||
<hbox>
|
||||
<spacer width="20px"/>
|
||||
<menulist id="whiteListAbURI">
|
||||
<menupopup id="abPopup-menupopup" ref="moz-abdirectory://"
|
||||
datasources="rdf:addressdirectory"
|
||||
sortActive="true"
|
||||
sortDirection="ascending"
|
||||
sortResource="http://home.netscape.com/NC-rdf#DirTreeNameSort">
|
||||
<template>
|
||||
<rule nc:IsWriteable="false"/>
|
||||
<rule nc:IsMailList="false">
|
||||
<menuitem uri="..."
|
||||
label="rdf:http://home.netscape.com/NC-rdf#DirName"
|
||||
value="rdf:http://home.netscape.com/NC-rdf#DirUri"/>
|
||||
</rule>
|
||||
</template>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</hbox>
|
||||
<vbox index="name" flex="1">
|
||||
<grid>
|
||||
<columns>
|
||||
<column flex ="1"/>
|
||||
<column/>
|
||||
</columns>
|
||||
|
||||
<rows>
|
||||
<row>
|
||||
<checkbox id="useWhiteList" oncommand="conditionallyEnableUI('useWhiteList')" accesskey="&whitelist.accesskey;" label="&whitelist.label;"/>
|
||||
<menulist id="whiteListAbURI">
|
||||
<menupopup id="abPopup-menupopup" ref="moz-abdirectory://"
|
||||
datasources="rdf:addressdirectory"
|
||||
sortActive="true"
|
||||
sortDirection="ascending"
|
||||
sortResource="http://home.netscape.com/NC-rdf#DirTreeNameSort">
|
||||
<template>
|
||||
<rule nc:IsWriteable="false"/>
|
||||
<rule nc:IsMailList="false">
|
||||
<menuitem uri="..."
|
||||
label="rdf:http://home.netscape.com/NC-rdf#DirName"
|
||||
value="rdf:http://home.netscape.com/NC-rdf#DirUri"/>
|
||||
</rule>
|
||||
</template>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<checkbox id="useServerFilter" oncommand="conditionallyEnableUI('useServerFilter');" label="&ispHeaders.label;"
|
||||
accesskey="&ispHeaders.accesskey;"/>
|
||||
<menulist id="useServerFilterList">
|
||||
<menupopup id="useServerFilter-menupopup">
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
|
||||
<separator class="thin"/>
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@ chrome/en-unix.jar
|
|||
defaults/pref/*
|
||||
greprefs/*
|
||||
defaults/messenger/mailViews.dat
|
||||
defaults/messenger/SpamAssassin.sfd
|
||||
defaults/profile/localstore.rdf
|
||||
defaults/profile/mimeTypes.rdf
|
||||
defaults/profile/US/localstore.rdf
|
||||
|
|
|
@ -62,6 +62,7 @@ bin\README.txt
|
|||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; Mail Specific Files
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
bin\defaults\messenger\SpamAssassin.sfd
|
||||
bin\defaults\profile\localstore.rdf
|
||||
bin\defaults\profile\prefs.js
|
||||
bin\defaults\profile\mimeTypes.rdf
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
<!ENTITY window.title "Junk Mail Controls">
|
||||
<!ENTITY mainDescription.label "&brandShortName; has several ways to detect junk mail. These controls evaluate incoming messages and identify those that are most likely to be junk mail.">
|
||||
|
||||
<!-- Tab titles -->
|
||||
<!ENTITY settingsTab.label "Settings">
|
||||
<!ENTITY adaptiveTab.label "Adaptive Filter">
|
||||
|
||||
<!-- Settings tab -->
|
||||
<!ENTITY move.label "Move incoming messages determined to be junk mail to:">
|
||||
<!ENTITY otherFolder.label "Other:">
|
||||
<!ENTITY junkFolderOn.label ""Junk" folder on:">
|
||||
<!ENTITY purge1.label "Automatically delete junk messages older than">
|
||||
<!ENTITY purge1.accesskey "u">
|
||||
<!ENTITY purge2.label "days from this folder">
|
||||
<!ENTITY manualMark.label "When I manually mark messages as Junk:">
|
||||
<!ENTITY manualMarkModeMove.label "Move them to the "Junk" folder">
|
||||
<!ENTITY manualMarkModeDelete.label "Delete them">
|
||||
<!ENTITY renderWithSafeHtml.label "When displaying HTML messages marked as junk, sanitize the HTML">
|
||||
<!ENTITY log.label "Logging">
|
||||
<!ENTITY handling.label "Handling">
|
||||
|
||||
<!ENTITY account.label "Configure Junk Settings for:">
|
||||
<!ENTITY account.accesskey "C">
|
||||
<!ENTITY viewLog.label "Junk Mail Log">
|
||||
<!ENTITY viewLog.accesskey "j">
|
||||
|
||||
<!ENTITY loggingDescription.label "View and configure junk mail logging.">
|
||||
|
||||
<!-- Adaptive Filter tab -->
|
||||
|
||||
<!ENTITY adaptiveCaption.label "Adaptive Filter">
|
||||
<!ENTITY trainingWarning.label "If enabled, you must first train &brandShortName; to identify junk mail by using the Junk toolbar button to mark messages as junk or not. You need to identify both junk and non junk messages.">
|
||||
<!ENTITY level.label "Enable adaptive junk mail detection">
|
||||
<!ENTITY level.accesskey "E">
|
||||
|
||||
<!ENTITY resetTrainingDescription.label "Resetting the training data used by the adaptive filter requires you to retrain the filter:">
|
||||
<!ENTITY resetTrainingData.label "Reset Training Data">
|
||||
<!ENTITY resetTrainingData.accesskey "R">
|
||||
|
||||
<!ENTITY whitelist.label "Do not mark messages as junk mail if the sender is in my address book:">
|
||||
<!ENTITY whitelist.accesskey "D">
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ interface nsIOutputStream;
|
|||
interface nsIMsgIncomingServer;
|
||||
interface nsIMsgDBHdr;
|
||||
|
||||
[scriptable, uuid(24ca5ee5-4b0b-4d7b-b53c-13fa2279ccf0)]
|
||||
[scriptable, uuid(3D6A6BCF-B374-4c97-B8C7-CDBBFC5E447B)]
|
||||
interface nsISpamSettings: nsISupports {
|
||||
attribute nsIMsgIncomingServer server;
|
||||
|
||||
|
@ -93,6 +93,7 @@ interface nsISpamSettings: nsISupports {
|
|||
/**
|
||||
* integrate with server-side spam detection programs
|
||||
*/
|
||||
attribute boolean useServerFilter;
|
||||
attribute ACString serverFilterName;
|
||||
const long TRUST_POSITIVES = 1;
|
||||
const long TRUST_NEGATIVES = 2;
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
version="8"
|
||||
logging="yes"
|
||||
name="HabeasNo"
|
||||
enabled="yes"
|
||||
type="1"
|
||||
action="JunkScore"
|
||||
actionValue="0"
|
||||
condition="OR (\"X-Habeas-SWE-3\",is,\"like Habeas SWE (tm)\")"
|
|
@ -47,6 +47,7 @@ XPIDL_MODULE = msgsearch
|
|||
LIBRARY_NAME = msgsearch_s
|
||||
META_COMPONENT = mail
|
||||
MOZILLA_INTERNAL_API = 1
|
||||
EXPORT_DIR = $(DIST)/bin/defaults/messenger
|
||||
|
||||
REQUIRES = xpcom \
|
||||
xpcom_obsolete \
|
||||
|
@ -65,8 +66,8 @@ REQUIRES = xpcom \
|
|||
msgnews \
|
||||
txmgr \
|
||||
import \
|
||||
addrbook \
|
||||
docshell \
|
||||
addrbook \
|
||||
docshell \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
|
@ -86,13 +87,24 @@ CPPSRCS = \
|
|||
$(NULL)
|
||||
|
||||
EXPORTS = nsMsgFilterService.h \
|
||||
nsMsgSearchSession.h \
|
||||
nsMsgFilterDataSource.h \
|
||||
nsMsgFilterDelegateFactory.h \
|
||||
$(NULL)
|
||||
nsMsgSearchSession.h \
|
||||
nsMsgFilterDataSource.h \
|
||||
nsMsgFilterDelegateFactory.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORT_RESOURCE_FILES = \
|
||||
SpamAssassin.sfd \
|
||||
$(NULL)
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
GARBAGE += $(addprefix $(EXPORT_DIR)/, $(EXPORT_RESOURCE_FILES))
|
||||
|
||||
libs:: $(EXPORT_RESOURCE_FILES)
|
||||
$(INSTALL) $^ $(EXPORT_DIR)
|
||||
|
||||
install:: $(EXPORT_RESOURCE_FILES)
|
||||
$(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(mozappdir)/defaults/messenger
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
version="8"
|
||||
logging="yes"
|
||||
name="SpamAssassinYes"
|
||||
enabled="yes"
|
||||
type="1"
|
||||
action="JunkScore"
|
||||
actionValue="100"
|
||||
condition="OR (\"X-Spam-Status\",begins with,Yes) OR (\"X-Spam-Flag\",begins with,YES) OR (subject,begins with,***SPAM***)"
|
||||
name="SpamAssassinNo"
|
||||
enabled="yes"
|
||||
type="1"
|
||||
action="JunkScore"
|
||||
actionValue="0"
|
||||
condition="OR (\"X-Spam-Status\",begins with,No)"
|
|
@ -0,0 +1,14 @@
|
|||
version="8"
|
||||
logging="yes"
|
||||
name="SpamCatcherNo"
|
||||
enabled="yes"
|
||||
type="1"
|
||||
action="JunkScore"
|
||||
actionValue="0"
|
||||
condition="OR (\"x-SpamCatcher\",begins with,No)"
|
||||
name="SpamCatcherYes"
|
||||
enabled="yes"
|
||||
type="1"
|
||||
action="JunkScore"
|
||||
actionValue="100"
|
||||
condition="OR (\"x-SpamCatcher\",begins with,Yes)"
|
|
@ -0,0 +1,14 @@
|
|||
version="8"
|
||||
logging="yes"
|
||||
name="SpamPalNo"
|
||||
enabled="yes"
|
||||
type="1"
|
||||
action="JunkScore"
|
||||
actionValue="0"
|
||||
condition="OR (\"x-SpamPal\",begins with,PASS)"
|
||||
name="SpamPalYes"
|
||||
enabled="yes"
|
||||
type="1"
|
||||
action="JunkScore"
|
||||
actionValue="100"
|
||||
condition="OR (\"x-SpamPal\",begins with,SPAM)"
|
|
@ -829,11 +829,9 @@ nsMsgFilterList::WriteWstrAttr(nsMsgFilterFileAttribValue attrib,
|
|||
nsresult nsMsgFilterList::SaveTextFilters(nsIOFileStream *aStream)
|
||||
{
|
||||
nsresult err = NS_OK;
|
||||
const char *attribStr;
|
||||
PRUint32 filterCount;
|
||||
m_filters->Count(&filterCount);
|
||||
|
||||
attribStr = GetStringForAttrib(nsIMsgFilterList::attribVersion);
|
||||
err = WriteIntAttr(nsIMsgFilterList::attribVersion, kFileVersion, aStream);
|
||||
err = WriteBoolAttr(nsIMsgFilterList::attribLogging, m_loggingEnabled, aStream);
|
||||
for (PRUint32 i = 0; i < filterCount; i ++)
|
||||
|
|
|
@ -68,6 +68,7 @@ nsSpamSettings::nsSpamSettings()
|
|||
mUseWhiteList = PR_FALSE;
|
||||
mLoggingEnabled = PR_FALSE;
|
||||
mManualMark = PR_FALSE;
|
||||
mUseServerFilter = PR_FALSE;
|
||||
mManualMarkMode = nsISpamSettings::MANUAL_MARK_MODE_MOVE;
|
||||
}
|
||||
|
||||
|
@ -127,6 +128,7 @@ NS_IMPL_GETSET(nsSpamSettings, MoveOnSpam, PRBool, mMoveOnSpam)
|
|||
NS_IMPL_GETSET(nsSpamSettings, MarkAsReadOnSpam, PRBool, mMarkAsReadOnSpam)
|
||||
NS_IMPL_GETSET(nsSpamSettings, Purge, PRBool, mPurge)
|
||||
NS_IMPL_GETSET(nsSpamSettings, UseWhiteList, PRBool, mUseWhiteList)
|
||||
NS_IMPL_GETSET(nsSpamSettings, UseServerFilter, PRBool, mUseServerFilter)
|
||||
NS_IMPL_GETSET(nsSpamSettings, ManualMark, PRBool, mManualMark)
|
||||
|
||||
NS_IMETHODIMP nsSpamSettings::GetWhiteListAbURI(char * *aWhiteListAbURI)
|
||||
|
@ -355,6 +357,7 @@ NS_IMETHODIMP nsSpamSettings::Clone(nsISpamSettings *aSpamSettings)
|
|||
(void)aSpamSettings->GetManualMark(&mManualMark);
|
||||
(void)aSpamSettings->GetManualMarkMode(&mManualMarkMode);
|
||||
(void)aSpamSettings->GetPurge(&mPurge);
|
||||
(void)aSpamSettings->GetUseServerFilter(&mUseServerFilter);
|
||||
|
||||
rv = aSpamSettings->GetPurgeInterval(&mPurgeInterval);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
|
|
@ -73,6 +73,7 @@ private:
|
|||
PRBool mUseWhiteList;
|
||||
PRBool mMoveOnSpam;
|
||||
PRBool mMarkAsReadOnSpam;
|
||||
PRBool mUseServerFilter;
|
||||
|
||||
nsCString mActionTargetAccount;
|
||||
nsCString mActionTargetFolder;
|
||||
|
|
|
@ -1896,6 +1896,15 @@ nsMsgIncomingServer::ConfigureTemporaryServerSpamFilters(nsIMsgFilterList *filte
|
|||
nsCOMPtr<nsISpamSettings> spamSettings;
|
||||
nsresult rv = GetSpamSettings(getter_AddRefs(spamSettings));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRBool useServerFilter;
|
||||
rv = spamSettings->GetUseServerFilter(&useServerFilter);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// if we aren't configured to use server filters, then return early.
|
||||
if (!useServerFilter)
|
||||
return NS_OK;
|
||||
|
||||
// For performance reasons, we'll handle clearing of filters if the user turns
|
||||
// off the server-side filters from the junk mail controls, in the junk mail controls.
|
||||
nsCAutoString serverFilterName;
|
||||
|
@ -2238,6 +2247,12 @@ nsMsgIncomingServer::SetSpamSettings(nsISpamSettings *aSpamSettings)
|
|||
rv = SetIntValue("purgeSpamInterval", purgeSpamInterval);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
PRBool useServerFilter;
|
||||
rv = mSpamSettings->GetUseServerFilter(&useServerFilter);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = SetBoolValue("useServerFilter", useServerFilter);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCAutoString serverFilterName;
|
||||
mSpamSettings->GetServerFilterName(serverFilterName);
|
||||
SetCharValue("serverFilterName", serverFilterName.get());
|
||||
|
@ -2342,6 +2357,12 @@ nsMsgIncomingServer::GetSpamSettings(nsISpamSettings **aSpamSettings)
|
|||
rv = mSpamSettings->SetPurgeInterval(purgeSpamInterval);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
PRBool useServerFilter;
|
||||
rv = GetBoolValue("useServerFilter", &useServerFilter);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = mSpamSettings->SetUseServerFilter(useServerFilter);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsXPIDLCString serverFilterName;
|
||||
rv = GetCharValue("serverFilterName", getter_Copies(serverFilterName));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
|
|
|
@ -445,6 +445,8 @@ pref("mail.server.default.spamActionTargetAccount","");
|
|||
pref("mail.server.default.spamActionTargetFolder","");
|
||||
pref("mail.server.default.useWhiteList",true);
|
||||
pref("mail.server.default.whiteListAbURI","moz-abmdbdirectory://abook.mab"); // the Personal addressbook.
|
||||
pref("mail.server.default.useServerFilter", false);
|
||||
pref("mail.server.default.serverFilterTrustFlags", 1); // 1 == trust positives, 2 == trust negatives, 3 == trust both
|
||||
pref("mail.server.default.purgeSpam",false);
|
||||
pref("mail.server.default.purgeSpamInterval",14); // 14 days
|
||||
pref("mail.server.default.spamLoggingEnabled",false);
|
||||
|
|
Загрузка…
Ссылка в новой задаче