diff --git a/mailnews/base/prefs/resources/content/am-junk.js b/mailnews/base/prefs/resources/content/am-junk.js
index d566dd268ba..5e8fd74f456 100644
--- a/mailnews/base/prefs/resources/content/am-junk.js
+++ b/mailnews/base/prefs/resources/content/am-junk.js
@@ -65,9 +65,17 @@ function onInit(aPageId, aServerId)
SetFolderPicker(spamActionTargetFolder, 'actionTargetFolder');
// set up the whitelist UI
- document.getElementById("whiteListAbURI").value =
- document.getElementById("server.whiteListAbURI").value;
-
+ var wList = document.getElementById("whiteListAbURI");
+ var currentArray = [];
+ if (document.getElementById("server.useWhiteList").checked)
+ currentArray = document.getElementById("server.whiteListAbURI").value.split(" ");
+
+ for (var i = 0; i < wList.getRowCount(); i++)
+ {
+ var wlNode = wList.getItemAtIndex(i);
+ wlNode.checked = (currentArray.indexOf(wlNode.id) > -1);
+ }
+
// set up trusted IP headers
var serverFilterList = document.getElementById("useServerFilterList");
serverFilterList.value =
@@ -105,12 +113,27 @@ function onServerFilterListChange()
document.getElementById("useServerFilterList").value;
}
+function onSave()
+{
+ onSaveWhiteList();
+}
+
// propagate changes to the whitelist menu list back to
// our hidden wsm element.
-function onWhiteListAbURIChange()
+function onSaveWhiteList()
{
- document.getElementById('server.whiteListAbURI').value =
- document.getElementById("whiteListAbURI").value;
+ var wList = document.getElementById("whiteListAbURI");
+ var wlArray = [];
+
+ for (var i = 0; i < wList.getRowCount(); i++)
+ {
+ var wlNode = wList.getItemAtIndex(i);
+ if (wlNode.checked)
+ wlArray.push(wlNode.id);
+ }
+ var wlValue = wlArray.join(" ");
+ document.getElementById("server.whiteListAbURI").setAttribute("value", wlValue);
+ document.getElementById("server.useWhiteList").checked = (wlValue != "");
}
function onActionTargetChange(aMenuList, aWSMElementId)
diff --git a/mailnews/base/prefs/resources/content/am-junk.xul b/mailnews/base/prefs/resources/content/am-junk.xul
index 5225c8ff50c..822374cbd6c 100644
--- a/mailnews/base/prefs/resources/content/am-junk.xul
+++ b/mailnews/base/prefs/resources/content/am-junk.xul
@@ -84,42 +84,34 @@
accesskey="&level.accesskey;" label="&level.label;"/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
server;
nsCOMPtr spamSettings;
- nsCOMPtr whiteListDirectory;
+ nsCOMArray whiteListDirArray;
nsCOMPtr headerParser;
PRBool useWhiteList = PR_FALSE;
PRInt32 spamLevel = 0;
@@ -1985,12 +1985,18 @@ nsMsgDBFolder::CallFilterPlugins(nsIMsgWindow *aMsgWindow, PRBool *aFiltersRun)
nsCOMPtr rdfService = do_GetService("@mozilla.org/rdf/rdf-service;1",&rv);
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr resource;
- rv = rdfService->GetResource(whiteListAbURI, getter_AddRefs(resource));
- NS_ENSURE_SUCCESS(rv, rv);
+ nsCStringArray whiteListArray;
+ whiteListArray.ParseString(whiteListAbURI.get(), " ");
- whiteListDirectory = do_QueryInterface(resource, &rv);
- NS_ENSURE_SUCCESS(rv, rv);
+ for (PRInt32 index = 0; index < whiteListArray.Count(); index++)
+ {
+ nsCOMPtr resource;
+ rv = rdfService->GetResource(*whiteListArray[index], getter_AddRefs(resource));
+
+ nsCOMPtr whiteListDirectory = do_QueryInterface(resource, &rv);
+ if (whiteListDirectory)
+ whiteListDirArray.AppendObject(whiteListDirectory);
+ }
}
// if we can't get the db, we probably want to continue firing spam filters.
}
@@ -2000,7 +2006,7 @@ nsMsgDBFolder::CallFilterPlugins(nsIMsgWindow *aMsgWindow, PRBool *aFiltersRun)
if (prefBranch)
prefBranch->GetCharPref("mail.trusteddomains", getter_Copies(trustedMailDomains));
- if (whiteListDirectory || !trustedMailDomains.IsEmpty())
+ if (whiteListDirArray.Count() != 0 || !trustedMailDomains.IsEmpty())
{
headerParser = do_GetService(NS_MAILNEWS_MIME_HEADER_PARSER_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
@@ -2022,7 +2028,7 @@ nsMsgDBFolder::CallFilterPlugins(nsIMsgWindow *aMsgWindow, PRBool *aFiltersRun)
continue;
nsXPIDLCString author;
nsXPIDLCString authorEmailAddress;
- if (whiteListDirectory || !trustedMailDomains.IsEmpty())
+ if (whiteListDirArray.Count() != 0 || !trustedMailDomains.IsEmpty())
{
msgHdr->GetAuthor(getter_Copies(author));
rv = headerParser->ExtractHeaderAddressMailboxes(nsnull, author.get(), getter_Copies(authorEmailAddress));
@@ -2046,15 +2052,20 @@ nsMsgDBFolder::CallFilterPlugins(nsIMsgWindow *aMsgWindow, PRBool *aFiltersRun)
if (!junkScore.IsEmpty()) // ignore already scored messages.
continue;
// check whitelist first:
- if (whiteListDirectory)
+ if (whiteListDirArray.Count() != 0)
{
if (NS_SUCCEEDED(rv))
{
PRBool cardExists = PR_FALSE;
// don't want to abort the rest of the scoring.
if (!authorEmailAddress.IsEmpty())
- rv = whiteListDirectory->HasCardForEmailAddress(authorEmailAddress, &cardExists);
- if (NS_SUCCEEDED(rv) && cardExists)
+ {
+ for (PRInt32 index = 0; index < whiteListDirArray.Count() && !cardExists; index++)
+ rv = whiteListDirArray[index]->HasCardForEmailAddress(authorEmailAddress, &cardExists);
+ if (NS_FAILED(rv))
+ cardExists = PR_FALSE;
+ }
+ if (cardExists)
{
// mark this msg as non-junk, because we whitelisted it.
mDatabase->SetStringProperty(msgKey, "junkscore", "0");