spam spam spam egg sausage spam

This commit is contained in:
sspitzer%netscape.com 2002-09-19 08:31:12 +00:00
parent 34a06e50e3
commit 5691c82515
4 changed files with 103 additions and 24 deletions

View File

@ -1,20 +1,28 @@
#include "nsISupports.idl"
interface nsIOutputStream;
interface nsIMsgIncomingServer;
[scriptable, uuid(24ca5ee5-4b0b-4d7b-b53c-13fa2279ccf0)]
interface nsISpamSettings: nsISupports {
// 0 for nothing, 100 for highest
attribute nsIMsgIncomingServer server;
/**
* 0 for nothing, 100 for highest
*/
attribute long level;
attribute boolean moveOnSpam;
attribute string actionTargetFolder;
attribute boolean purge;
attribute boolean purgeInterval;
/**
* interval, in days
*/
attribute long purgeInterval;
attribute boolean useWhiteList;
attribute string whiteListAbURI;
attribute string whiteListAbURI;
// for logging
attribute boolean loggingEnabled;
@ -23,4 +31,6 @@ interface nsISpamSettings: nsISupports {
void clearLog();
void ensureLogFile();
void flushLogIfNecessary();
void clone(in nsISpamSettings aSpamSettings);
};

View File

@ -1,15 +1,13 @@
var gLogView;
var gLogJunk;
var gXXX;
var gSpamSettings;
function onLoad()
{
return;
gXXX = window.arguments[0].xxx;
gSpamSettings = window.arguments[0].spamSettings;
gLogJunk = document.getElementById("logJunk");
gLogJunk.checked = gXXX.loggingEnabled;
gLogJunk.checked = gSpamSettings.loggingEnabled;
gLogView = document.getElementById("logView");
@ -18,21 +16,21 @@ function onLoad()
// if log doesn't exist, this will create an empty file on disk
// otherwise, the user will get an error that the file doesn't exist
gXXX.ensureLogFile();
gSpamSettings.ensureLogFile();
gLogView.setAttribute("src", gXXX.logURL);
gLogView.setAttribute("src", gSpamSettings.logURL);
}
function toggleJunkLog()
{
gXXX.loggingEnabled = gLogJunk.checked;
gSpamSettings.loggingEnabled = gLogJunk.checked;
}
function clearLog()
{
gXXX.clearLog();
gSpamSettings.clearLog();
// reload the newly truncated file
gLogView.setAttribute("src", gXXX.logURL);
gLogView.setAttribute("src", gSpamSettings.logURL);
}

View File

@ -1,25 +1,67 @@
var gSpamSettings;
varg gServer;
function onJunkMailLoad()
{
if (window.arguments && window.arguments[0])
selectAccountFromFolder(window.arguments[0].folder);
setupForAccountFromFolder(window.arguments[0].folder);
}
function selectAccountFromFolder(folder)
function onServerClick()
{
if (folder) {
}
function setupForAccountFromFolder(folder)
{
// make sure we do the right thing for the stand alone msg window
try {
var msgFolder = GetMsgFolderFromUri(folder.URI, false);
gServer = msgFolder.server;
}
else {
catch (ex) {
// get server for default account
var accountManager = Components.classes["@mozilla.org/messenger/account-manager;1"]
.getService(Components.interfaces.nsIMsgAccountManager);
var account = accountManager.defaultAccount;
gServer = account.incomingServer;
}
// get and clone spam settings for this server
// we clone because if the users cancels we are going to throw away the changes
gSpamSettings = Components.classes["@mozilla.org/messenger/spamsettings;1"].createInstance(Components.interfaces.nsISpamSettings);
gSpamSettings.clone(gServer.spamSettings);
// select server in the menulist
var serverList = document.getElementById("server");
var menuitems = serverList.getElementsByAttribute("id", server.serverURI);
serverList.selectedItem = menuitems[0];
// set up the UI for this server
document.getElementById("level").value = gSpamSettings.level;
document.getElementById("moveOnSpam").checked = gSpamSettings.moveOnSpam;
// todo, use attribute string actionTargetFolder;
document.getElementById("purge").checked = gSpamSettings.purge;
document.getElementById("purgeInterval").value = gSpamSettings.purgeInterval;
document.getElementById("useWhiteList").checked = gSpamSettings.useWhiteList;
var abList = document.getElementById("whiteListAbURI");
menuitems = abList.getElementsByAttribute("id", gSpamSettings.whiteListAbURI);
abList.selectedItem = menuitems[0];
}
function junkLog()
{
var args = {foo: null};
// pass in the "real" spam settings, as it's the one with the logStream
var args = {spamSettings: gServer.spamSettings};
window.openDialog("chrome://messenger/content/junkLog.xul", "junkLog", "chrome,modal,titlebar,resizable,centerscreen", args);
}
function onAccept()
{
// if they hit ok, set the "real" server's spam settings. this will set prefs.
gServer.spamSettings = gSpamSettings;
}
function doHelpButton()

View File

@ -11,6 +11,7 @@
<dialog id="junkMail"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:nc="http://home.netscape.com/NC-rdf#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
windowtype="mailnews:junk"
title="&window.title;"
onload="onJunkMailLoad()"
@ -20,11 +21,27 @@
persist="screenX screenY width height">
<script type="application/x-javascript" src="chrome://messenger/content/junkMail.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/widgetglue.js"/>
<vbox>
<hbox align="center">
<label value="&account.label;" accesskey="&account.accesskey;"/>
<menulist id="server" />
<menulist oncommand="onServerClick(event);" id="server">
<menupopup datasources="rdf:msgaccountmanager rdf:mailnewsfolders"
containment="http://home.netscape.com/NC-rdf#child" ref="msgaccounts:/">
<template>
<rule nc:CanGetMessages="true">
<menuitem uri="..." value="..."
class="folderMenuItem menuitem-iconic"
IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType"
label="rdf:http://home.netscape.com/NC-rdf#Name"/>
</rule>
</template>
</menupopup>
</menulist>
<spacer flex="1"/>
<button label="&viewLog.label;" accesskey="&viewLog.accesskey;" oncommand="junkLog()"/>
</hbox>
@ -36,7 +53,7 @@
<separator/>
<hbox>
<radiogroup flex="1" id="junk_level" orient="horizontal">
<radiogroup flex="1" id="level" orient="horizontal">
<!-- using 0 - 100, in case we ever do a slider or add more levels.
this way, the exist pref value will migrate nice. -->
<radio flex="1" id="off" value="0" accesskey="&off.accesskey;" label="&off.label;"/>
@ -52,18 +69,30 @@
<hbox align="center">
<checkbox id="move" accesskey="&move.accesskey;" label="&move.label;"/>
<menulist id="move_folder_uri"/>
<menulist id="actionTargetFolder"/>
</hbox>
<hbox autostretch="never" align="center">
<checkbox id="purge" accesskey="&purge1.accesskey;" label="&purge1.label;"/>
<textbox id="purge_interval" />
<textbox id="purgeInterval" />
<label value="&purge2.label;"/>
</hbox>
<hbox align="center">
<checkbox id="whitelist" accesskey="&whitelist.accesskey;" label="&whitelist.label;"/>
<menulist id="whitelist_ab_uri" />
<checkbox id="whiteList" accesskey="&whitelist.accesskey;" label="&whitelist.label;"/>
<menulist id="whiteListAbURI">
<menupopup id="abPopup-menupopup" ref="moz-abdirectory://"
datasources="rdf:addressdirectory">
<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>