land spam UI: control panel UI, spam log UI, toolbar button, tools menu, thread pane UI.

currently, hidden by default.  more work to come.  r/sr=bienvenu.  bug #169638
This commit is contained in:
sspitzer%netscape.com 2002-09-20 00:04:01 +00:00
parent 88c476c398
commit 91c00f9cca
29 changed files with 339 additions and 26 deletions

View File

@ -438,6 +438,17 @@
0x9f4dd201, 0x3b1f, 0x11d5, \
{0x9d, 0xaa, 0xc3, 0x45, 0xc9, 0x45, 0x3d, 0x3c }}
//
// nsSpamSettings
//
#define NS_SPAMSETTINGS_CONTRACTID \
"@mozilla.org/messenger/spamsettings;1"
#define NS_SPAMSETTINGS_CID \
{ /* ce6038ae-e5e0-4372-9cff-2a6633333b2b */ \
0xce6038ae, 0xe5e0, 0x4372, \
{0x9c, 0xff, 0x2a, 0x66, 0x33, 0x33, 0x3b, 0x2b }}
//
// nsMessengerOSIntegration
//

View File

@ -21,6 +21,7 @@
*
* Contributor(s):
* Pierre Phaneuf <pp@ludusdesign.com>
* Seth Spitzer <sspitzer@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
@ -101,6 +102,7 @@
#include "nsMsgOfflineManager.h"
#include "nsMsgProgress.h"
#include "nsSpamSettings.h"
#ifdef XP_WIN
#include "nsMessengerWinIntegration.h"
@ -146,6 +148,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgSearchDBView);
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgQuickSearchDBView);
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgOfflineManager);
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgProgress);
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSpamSettings);
#ifdef XP_WIN
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMessengerWinIntegration, Init);
#endif
@ -320,6 +323,10 @@ static const nsModuleComponentInfo gComponents[] = {
NS_MSGPROGRESS_CONTRACTID,
nsMsgProgressConstructor,
},
{ "Spam Settings", NS_SPAMSETTINGS_CID,
NS_SPAMSETTINGS_CONTRACTID,
nsSpamSettingsConstructor,
},
#ifdef XP_WIN
{ "Windows OS Integration", NS_MESSENGERWININTEGRATION_CID,
NS_MESSENGEROSINTEGRATION_CONTRACTID,

View File

@ -79,6 +79,7 @@ XPIDLSRCS = \
nsIMsgProgress.idl \
nsIMessengerOSIntegration.idl \
nsIMsgMdnGenerator.idl \
nsISpamSettings.idl \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -95,6 +95,7 @@ interface nsMsgViewSortType
const nsMsgViewSortTypeValue byRecipient = 0x1c;
const nsMsgViewSortTypeValue byLocation = 0x1d;
const nsMsgViewSortTypeValue byLabel = 0x1e;
const nsMsgViewSortTypeValue byScore = 0x1f;
};
[scriptable, uuid(255d1c1e-fde7-11d4-a5be-0060b0fc04b7)]
@ -196,6 +197,8 @@ interface nsMsgViewCommandType
const nsMsgViewCommandTypeValue label5 = 26;
const nsMsgViewCommandTypeValue lastLabel = 26;
const nsMsgViewCommandTypeValue junk = 27;
const nsMsgViewCommandTypeValue unjunk = 28;
};
[scriptable, uuid(65903eb2-1dd2-11b2-ac45-c5b69c1618d7)]

View File

@ -104,7 +104,6 @@ interface nsIMsgIdentity : nsISupports {
attribute string draftFolder;
attribute string stationeryFolder;
attribute string junkMailFolder;
attribute boolean showSaveMsgDlg;
attribute string directoryServer;
attribute boolean overrideGlobalPref;

View File

@ -20,6 +20,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Seth Spitzer <sspitzer@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
@ -46,6 +47,7 @@ interface nsIMsgWindow;
interface nsIMsgFilterList;
interface nsIMsgRetentionSettings;
interface nsIMsgDownloadSettings;
interface nsISpamSettings;
/*
* Interface for incoming mail/news host
@ -148,7 +150,6 @@ interface nsIMsgIncomingServer : nsISupports {
/* the on-disk path to message storage for this server */
attribute nsIFileSpec localPath;
/* the RDF URI for the root mail folder */
readonly attribute string serverURI;
@ -308,7 +309,6 @@ interface nsIMsgIncomingServer : nsISupports {
*/
attribute boolean defaultCopiesAndFoldersPrefsToServer;
/* can this server allows sub folder creation */
attribute boolean canCreateFoldersOnServer;
@ -362,6 +362,11 @@ interface nsIMsgIncomingServer : nsISupports {
* the existing return receipts filter, if it exists.
*/
void configureTemporaryReturnReceiptsFilter(in nsIMsgFilterList filterList);
/**
* spam settings
*/
attribute nsISpamSettings spamSettings;
};
%{C++

View File

@ -478,6 +478,9 @@ function ConvertColumnIDToSortType(columnID)
case "labelCol":
sortKey = nsMsgViewSortType.byLabel;
break;
case "scoreCol":
sortKey = nsMsgViewSortType.byScore;
break;
default:
dump("unsupported sort column: " + columnID + "\n");
sortKey = 0;
@ -533,6 +536,9 @@ function ConvertSortTypeToColumnID(sortKey)
// there is no orderReceivedCol, so return null
columnID = null;
break;
case nsMsgViewSortType.byScore:
columnID = "scoreCol";
break;
default:
dump("unsupported sort key: " + sortKey + "\n");
columnID = null;

View File

@ -223,6 +223,7 @@ var DefaultController =
case "cmd_createFilterFromMenu":
case "cmd_delete":
case "button_delete":
case "button_junk":
case "cmd_shiftDelete":
case "cmd_nextMsg":
case "button_next":
@ -317,6 +318,10 @@ var DefaultController =
if (gDBView)
gDBView.getCommandStatus(nsMsgViewCommandType.deleteNoTrash, enabled, checkStatus);
return enabled.value;
case "button_junk":
if (gDBView)
gDBView.getCommandStatus(nsMsgViewCommandType.junk, enabled, checkStatus);
return enabled.value;
case "cmd_killThread":
return ((GetNumSelectedMessages() == 1) && MailAreaHasFocus() && IsViewNavigationItemEnabled());
case "cmd_watchThread":
@ -610,6 +615,9 @@ var DefaultController =
case "cmd_markAllRead":
gDBView.doCommand(nsMsgViewCommandType.markAllRead);
return;
case "button_junk":
MsgJunk();
return;
case "cmd_stop":
MsgStop();
return;

View File

@ -357,24 +357,19 @@ function SaveAsTemplate(uri, folder)
}
}
function JunkSelectedMessages(setAsJunk)
{
gDBView.doCommand(setAsJunk ? nsMsgViewCommandType.junk : nsMsgViewCommandType.unjunk);
}
function MarkSelectedMessagesRead(markRead)
{
if (markRead) {
gDBView.doCommand(nsMsgViewCommandType.markMessagesRead);
}
else {
gDBView.doCommand(nsMsgViewCommandType.markMessagesUnread);
}
gDBView.doCommand(markRead ? nsMsgViewCommandType.markMessagesRead : nsMsgViewCommandType.markMessagesUnread);
}
function MarkSelectedMessagesFlagged(markFlagged)
{
if (markFlagged) {
gDBView.doCommand(nsMsgViewCommandType.flagMessages);
}
else {
gDBView.doCommand(nsMsgViewCommandType.unflagMessages);
}
gDBView.doCommand(markFlagged ? nsMsgViewCommandType.flagMessages : nsMsgViewCommandType.unflagMessages);
}
function MarkAllMessagesRead(compositeDataSource, folder)

View File

@ -208,6 +208,7 @@ function InitViewSortByMenu()
setSortByMenuItemCheckState("sortByThreadMenuitem", (sortType == nsMsgViewSortType.byThread));
setSortByMenuItemCheckState("sortByUnreadMenuitem", (sortType == nsMsgViewSortType.byUnread));
setSortByMenuItemCheckState("sortByLabelMenuitem", (sortType == nsMsgViewSortType.byLabel));
setSortByMenuItemCheckState("sortByScoreMenuitem", (sortType == nsMsgViewSortType.byScore));
// the Sender / Recipient menu is dynamic
setSortByMenuItemCheckState("sortBySenderOrRecipientMenuitem", (sortType == nsMsgViewSortType.byAuthor) || (sortType == nsMsgViewSortType.byRecipient));
@ -543,6 +544,19 @@ function SelectedMessagesAreDeleted()
}
}
function SelectedMessagesAreJunk()
{
var isJunk;
try {
var score = gDBView.hdrForFirstSelectedMessage.getStringProperty("score");
isJunk = ((score != "") && (score != "0"));
}
catch (ex) {
isJunk = false;
}
return isJunk;
}
function SelectedMessagesAreRead()
{
var isRead;
@ -1118,6 +1132,11 @@ function CloseMailWindow()
window.close();
}
function MsgJunk()
{
JunkSelectedMessages(!SelectedMessagesAreJunk());
}
function MsgMarkMsgAsRead(markRead)
{
if (!markRead) {

View File

@ -228,6 +228,7 @@ Rights Reserved.
<command id="button_next"/>
<command id="button_file"/>
<command id="cmd_delete"/>
<command id="button_junk"/>
</commandset>
@ -1074,6 +1075,7 @@ Rights Reserved.
<menuitem id="sortByThreadMenuitem" type="radio" name="sortby" label="&sortByThreadCmd.label;" accesskey="&sortByThreadCmd.accesskey;" oncommand="MsgSortByThread()"/>
<menuitem id="sortByUnreadMenuitem" type="radio" name="sortby" label="&sortByUnreadCmd.label;" accesskey="&sortByUnreadCmd.accesskey;" oncommand="MsgSortByUnread()"/>
<menuitem id="sortByLabelMenuitem" type="radio" name="sortby" label="&sortByLabelCmd.label;" accesskey="&sortByLabelCmd.accesskey;" oncommand="MsgSortByLabel()"/>
<menuitem id="sortByScoreMenuitem" type="radio" name="sortby" label="&sortByScoreCmd.label;" accesskey="&sortByScoreCmd.accesskey;" oncommand="MsgSortByScore()"/>
<menuseparator/>
<menuitem id="sortAscending" type="radio" name="sortdirection" label="&sortAscending.label;" accesskey="&sortAscending.accesskey;" oncommand="MsgSortAscending()"/>
<menuitem id="sortDescending" type="radio" name="sortdirection" label="&sortDescending.label;" accesskey="&sortDescending.accesskey;" oncommand="MsgSortDescending()"/>
@ -1414,7 +1416,7 @@ Rights Reserved.
<menuitem label="&filtersCmd.label;"
accesskey="&filtersCmd.accesskey;"
oncommand="MsgFilters(null);"/>
<!-- not ready for prime time
<!-- not ready yet
<menuitem label="&junkMailCmd.label;"
accesskey="&junkMailCmd.accesskey;"
oncommand="MsgJunkMail()"/>
@ -1538,6 +1540,9 @@ Rights Reserved.
</toolbarbutton>
<toolbarbutton class="toolbarbutton-1" id="button-next" label="&nextButton.label;" oncommand="goDoCommand('button_next')" tooltiptext="&nextButton.tooltip;" observes="button_next"/>
<toolbarbutton class="toolbarbutton-1" id="button-delete" label="&deleteButton.label;" tooltiptext="&deleteButton.tooltip;" observes="button_delete" oncommand="goDoCommand('button_delete')"/>
<!-- not ready yet
<toolbarbutton class="toolbarbutton-1" id="button-junk" label="&junkButton.label;" tooltiptext="&junkButton.tooltip;" observes="button_junk" oncommand="goDoCommand('button_junk')"/>
-->
<toolbarbutton type="menu-button" id="button-mark" class="toolbarbutton-1" label="&markButton.label;" hidden="true" oncommand="goDoCommand('button_mark')"
observes="button_mark" tooltiptext="&markButton.tooltip;">
<menupopup onpopupshowing="InitMessageMark()">

View File

@ -557,6 +557,7 @@ var MessageWindowController =
case "cmd_killThread":
case "cmd_watchThread":
case "button_delete":
case "button_junk":
case "cmd_shiftDelete":
case "button_print":
case "cmd_print":
@ -620,6 +621,8 @@ var MessageWindowController =
case "cmd_shiftDelete":
var loadedFolder = GetLoadedMsgFolder();
return gCurrentMessageUri && loadedFolder && (loadedFolder.canDeleteMessages || isNewsURI(gCurrentFolderUri));
case "button_junk":
return (!isNewsURI(gCurrentFolderUri));
case "cmd_reply":
case "button_reply":
case "cmd_replySender":
@ -753,6 +756,9 @@ var MessageWindowController =
case "cmd_shiftDelete":
MsgDeleteMessageFromMessageWindow(true, false);
break;
case "button_junk":
MsgJunk();
break;
case "button_delete":
MsgDeleteMessageFromMessageWindow(false, true);
break;

View File

@ -169,6 +169,12 @@ function MsgSortByLabel()
MsgSortThreadPane(nsMsgViewSortType.byLabel);
}
function MsgSortByScore()
{
MsgSortThreadPane(nsMsgViewSortType.byScore);
}
function MsgSortBySubject()
{
MsgSortThreadPane(nsMsgViewSortType.bySubject);

View File

@ -48,6 +48,10 @@ Rights Reserved.
<splitter class="tree-splitter"/>
<treecol id="sizeCol" class="sortDirectionIndicator" persist="hidden ordinal width" flex="1" label="&sizeColumn.label;"/>
<splitter class="tree-splitter"/>
<!-- not ready yet
<treecol id="scoreCol" class="sortDirectionIndicator" persist="hidden ordinal width" flex="1" label="&scoreColumn.label;"/>
<splitter class="tree-splitter"/>
-->
<treecol id="flaggedCol" fixed="true" persist="hidden ordinal" class="treecol-image flagColumnHeader" display="&flagColumn.label;" cycler="true"/>
<splitter class="tree-splitter"/>
<treecol id="labelCol" class="sortDirectionIndicator" persist="hidden ordinal width" flex="1" label="&labelColumn.label;"/>

View File

@ -159,6 +159,8 @@ Rights Reserved.
<!ENTITY sortByStatusCmd.accesskey "u">
<!ENTITY sortByLabelCmd.label "Label">
<!ENTITY sortByLabelCmd.accesskey "L">
<!ENTITY sortByScoreCmd.label "Junk Score">
<!ENTITY sortByScoreCmd.accesskey "C">
<!ENTITY sortBySubjectCmd.label "Subject">
<!ENTITY sortBySubjectCmd.accesskey "S">
<!-- Sender / Recipient lives in messenger.properties, since that item is dynamic -->
@ -389,6 +391,7 @@ Rights Reserved.
<!ENTITY markButton.label "Mark">
<!ENTITY printButton.label "Print">
<!ENTITY stopButton.label "Stop">
<!ENTITY junkButton.label "Junk">
<!--Tooltips-->
<!ENTITY menuBar.tooltip "Menu Bar">
@ -407,6 +410,7 @@ Rights Reserved.
<!ENTITY printButton.tooltip "Print this message">
<!ENTITY stopButton.tooltip "Stop the current transfer">
<!ENTITY throbber.tooltip "Go to the &vendorShortName; home page">
<!ENTITY junkButton.tooltip "Mark the selected messages as junk (or not junk)">
<!-- Statusbar -->
<!ENTITY statusText.label "Done">

View File

@ -26,6 +26,7 @@ Rights Reserved.
<!ENTITY labelColumn.label "Label">
<!ENTITY statusColumn.label "Status">
<!ENTITY sizeColumn.label "Size">
<!ENTITY scoreColumn.label "Junk Score">
<!ENTITY linesColumn.label "Lines">
<!ENTITY unreadColumn.label "Unread">
<!ENTITY totalColumn.label "Total">

View File

@ -165,6 +165,8 @@ NS_IMETHODIMP nsMsgFilterList::ClearLog()
nsresult
nsMsgFilterList::GetLogFileSpec(nsIFileSpec **aFileSpec)
{
NS_ENSURE_ARG_POINTER(aFileSpec);
nsCOMPtr <nsIMsgFolder> folder;
nsresult rv = GetFolder(getter_AddRefs(folder));
NS_ENSURE_SUCCESS(rv,rv);
@ -184,6 +186,8 @@ nsMsgFilterList::GetLogFileSpec(nsIFileSpec **aFileSpec)
NS_IMETHODIMP
nsMsgFilterList::GetLogURL(char **aLogURL)
{
NS_ENSURE_ARG_POINTER(aLogURL);
nsCOMPtr <nsIFileSpec> file;
nsresult rv = GetLogFileSpec(getter_AddRefs(file));
NS_ENSURE_SUCCESS(rv,rv);
@ -1027,7 +1031,7 @@ NS_IMETHODIMP nsMsgFilterList::GetArbitraryHeaders(char **aResult)
NS_IMETHODIMP nsMsgFilterList::FlushLogIfNecessary()
{
// if we are logging, flush the log at the end of applying the filters
// only flush the log if we are logging
PRBool loggingEnabled = PR_FALSE;
nsresult rv = GetLoggingEnabled(&loggingEnabled);
NS_ENSURE_SUCCESS(rv,rv);

View File

@ -102,6 +102,7 @@ CPPSRCS = \
nsMsgSearchDBView.cpp \
nsMsgOfflineManager.cpp \
nsMsgProgress.cpp \
nsSpamSettings.cpp \
$(NULL)
ifeq ($(OS_ARCH),WINNT)

View File

@ -1416,8 +1416,16 @@ NS_IMETHODIMP nsMsgDBView::GetCellText(PRInt32 aRow, const PRUnichar * aColID, n
rv = FetchAuthor(msgHdr, getter_Copies(valueText));
else if (aColID[1] == 'i') // size
rv = FetchSize(msgHdr, getter_Copies(valueText));
else
else if (aColID[1] == 't') // status
rv = FetchStatus(m_flags[aRow], getter_Copies(valueText));
else if (aColID[1] == 'c') // score
{
nsXPIDLCString cStrScore;
msgHdr->GetStringProperty("score", getter_Copies(cStrScore));
CopyASCIItoUCS2(cStrScore, aValue);
break;
}
aValue.Assign(valueText);
break;
case 'd': // date
@ -1846,7 +1854,8 @@ NS_IMETHODIMP nsMsgDBView::DoCommand(nsMsgViewCommandTypeValue command)
case nsMsgViewCommandType::label3:
case nsMsgViewCommandType::label4:
case nsMsgViewCommandType::label5:
case nsMsgViewCommandType::junk:
case nsMsgViewCommandType::unjunk:
// since the FE could have constructed the list of indices in
// any order (e.g. order of discontiguous selection), we have to
// sort the indices in order to find out which nsMsgViewIndex will
@ -1941,6 +1950,8 @@ NS_IMETHODIMP nsMsgDBView::GetCommandStatus(nsMsgViewCommandTypeValue command, P
case nsMsgViewCommandType::label3:
case nsMsgViewCommandType::label4:
case nsMsgViewCommandType::label5:
case nsMsgViewCommandType::junk:
case nsMsgViewCommandType::unjunk:
*selectable_p = haveSelection;
break;
case nsMsgViewCommandType::cmdRequiringMsgBody:
@ -2062,6 +2073,12 @@ nsMsgDBView::ApplyCommandToIndices(nsMsgViewCommandTypeValue command, nsMsgViewI
case nsMsgViewCommandType::label5:
rv = SetLabelByIndex(indices[i], (command - nsMsgViewCommandType::label0));
break;
case nsMsgViewCommandType::junk:
rv = SetStringPropertyByIndex(indices[i], "score", "100");
break;
case nsMsgViewCommandType::unjunk:
rv = SetStringPropertyByIndex(indices[i], "score", "0");
break;
default:
NS_ASSERTION(PR_FALSE, "unhandled command");
break;
@ -2310,6 +2327,19 @@ nsresult nsMsgDBView::SetLabelByIndex(nsMsgViewIndex index, nsMsgLabelValue labe
return rv;
}
nsresult nsMsgDBView::SetStringPropertyByIndex(nsMsgViewIndex index, const char *aProperty, const char *aValue)
{
if (!IsValidIndex(index))
return NS_MSG_INVALID_DBVIEW_INDEX;
nsCOMPtr <nsIMsgDatabase> dbToUse;
nsresult rv = GetDBForViewIndex(index, getter_AddRefs(dbToUse));
NS_ENSURE_SUCCESS(rv, rv);
rv = dbToUse->SetStringProperty(m_keys[index], aProperty, aValue);
NoteChange(index, 1, nsMsgViewNotificationCode::changed);
return rv;
}
// reversing threads involves reversing the threads but leaving the
@ -2570,6 +2600,7 @@ nsresult nsMsgDBView::GetFieldTypeAndLenForSort(nsMsgViewSortTypeValue sortType,
case nsMsgViewSortType::byUnread:
case nsMsgViewSortType::byStatus:
case nsMsgViewSortType::byLabel:
case nsMsgViewSortType::byScore:
*pFieldType = kU32;
*pMaxLen = sizeof(PRUint32);
break;
@ -2690,6 +2721,13 @@ nsresult nsMsgDBView::GetLongField(nsIMsgHdr *msgHdr, nsMsgViewSortTypeValue sor
if (NS_SUCCEEDED(rv))
*result = !isRead;
break;
case nsMsgViewSortType::byScore:
{
nsXPIDLCString scoreStr;
rv = msgHdr->GetStringProperty("score", getter_Copies(scoreStr));
*result = (!scoreStr.IsEmpty()) ? atoi(scoreStr.get()) : 0;
}
break;
case nsMsgViewSortType::byId:
// handled by caller, since caller knows the key
default:

View File

@ -20,6 +20,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Seth Spitzer <sspitzer@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
@ -238,6 +239,7 @@ protected:
PRInt32 numIndices, nsIMsgFolder *destFolder);
virtual nsresult CopyMessages(nsIMsgWindow *window, nsMsgViewIndex *indices, PRInt32 numIndices, PRBool isMove, nsIMsgFolder *destFolder);
virtual nsresult DeleteMessages(nsIMsgWindow *window, nsMsgViewIndex *indices, PRInt32 numIndices, PRBool deleteStorage);
nsresult SetStringPropertyByIndex(nsMsgViewIndex index, const char *aProperty, const char *aValue);
nsresult ToggleReadByIndex(nsMsgViewIndex index);
nsresult SetReadByIndex(nsMsgViewIndex index, PRBool read);
nsresult SetThreadOfMsgReadByIndex(nsMsgViewIndex index, nsMsgKeyArray &keysMarkedRead, PRBool read);

View File

@ -451,7 +451,6 @@ NS_IMPL_IDPREF_STR (BccList, "bcc_other_list");
NS_IMPL_FOLDERPREF_STR (DraftFolder, "draft_folder");
NS_IMPL_FOLDERPREF_STR (StationeryFolder, "stationery_folder");
NS_IMPL_FOLDERPREF_STR (JunkMailFolder, "spam_folder");
NS_IMPL_IDPREF_BOOL(ShowSaveMsgDlg, "showSaveMsgDlg");
NS_IMPL_IDPREF_STR (DirectoryServer, "directoryServer");

View File

@ -1793,3 +1793,127 @@ nsMsgIncomingServer::ConfigureTemporaryReturnReceiptsFilter(nsIMsgFilterList *fi
}
return rv;
}
NS_IMETHODIMP
nsMsgIncomingServer::SetSpamSettings(nsISpamSettings *aSpamSettings)
{
NS_ENSURE_ARG_POINTER(aSpamSettings);
nsresult rv;
if (!mSpamSettings) {
mSpamSettings = do_CreateInstance(NS_SPAMSETTINGS_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv,rv);
rv = mSpamSettings->SetServer(this);
NS_ENSURE_SUCCESS(rv,rv);
}
rv = mSpamSettings->Clone(aSpamSettings);
NS_ENSURE_SUCCESS(rv,rv);
// set the server prefs from the spam settings
PRInt32 spamLevel;
rv = mSpamSettings->GetLevel(&spamLevel);
NS_ENSURE_SUCCESS(rv,rv);
rv = SetIntValue("spamLevel", spamLevel);
NS_ENSURE_SUCCESS(rv,rv);
PRBool moveOnSpam;
rv = mSpamSettings->GetMoveOnSpam(&moveOnSpam);
NS_ENSURE_SUCCESS(rv,rv);
rv = SetBoolValue("moveOnSpam", moveOnSpam);
NS_ENSURE_SUCCESS(rv,rv);
nsXPIDLCString spamActionTargetFolder;
rv = mSpamSettings->GetActionTargetFolder(getter_Copies(spamActionTargetFolder));
NS_ENSURE_SUCCESS(rv,rv);
rv = SetCharValue("spamActionTargetFolder", spamActionTargetFolder.get());
NS_ENSURE_SUCCESS(rv,rv);
PRBool useWhiteList;
rv = mSpamSettings->GetUseWhiteList(&useWhiteList);
NS_ENSURE_SUCCESS(rv,rv);
rv = SetBoolValue("useWhiteList", useWhiteList);
NS_ENSURE_SUCCESS(rv,rv);
nsXPIDLCString whiteListAbURI;
rv = mSpamSettings->GetWhiteListAbURI(getter_Copies(whiteListAbURI));
NS_ENSURE_SUCCESS(rv,rv);
rv = SetCharValue("whiteListAbURI", whiteListAbURI.get());
NS_ENSURE_SUCCESS(rv,rv);
PRBool purgeSpam;
rv = mSpamSettings->GetPurge(&purgeSpam);
NS_ENSURE_SUCCESS(rv,rv);
rv = SetBoolValue("purgeSpam", purgeSpam);
NS_ENSURE_SUCCESS(rv,rv);
PRInt32 purgeSpamInterval;
rv = mSpamSettings->GetPurgeInterval(&purgeSpamInterval);
NS_ENSURE_SUCCESS(rv,rv);
rv = SetIntValue("purgeSpamInterval", purgeSpamInterval);
NS_ENSURE_SUCCESS(rv,rv);
return NS_OK;
}
NS_IMETHODIMP
nsMsgIncomingServer::GetSpamSettings(nsISpamSettings **aSpamSettings)
{
NS_ENSURE_ARG_POINTER(aSpamSettings);
if (!mSpamSettings) {
nsresult rv;
mSpamSettings = do_CreateInstance(NS_SPAMSETTINGS_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv,rv);
rv = mSpamSettings->SetServer(this);
NS_ENSURE_SUCCESS(rv,rv);
// set spam settings from server prefs
PRInt32 spamLevel;
rv = GetIntValue("spamLevel", &spamLevel);
NS_ENSURE_SUCCESS(rv,rv);
rv = mSpamSettings->SetLevel(spamLevel);
NS_ENSURE_SUCCESS(rv,rv);
PRBool moveOnSpam;
rv = GetBoolValue("moveOnSpam", &moveOnSpam);
NS_ENSURE_SUCCESS(rv,rv);
rv = mSpamSettings->SetMoveOnSpam(moveOnSpam);
NS_ENSURE_SUCCESS(rv,rv);
nsXPIDLCString spamActionTargetFolder;
rv = GetCharValue("spamActionTargetFolder", getter_Copies(spamActionTargetFolder));
NS_ENSURE_SUCCESS(rv,rv);
rv = mSpamSettings->SetActionTargetFolder(spamActionTargetFolder);
NS_ENSURE_SUCCESS(rv,rv);
PRBool useWhiteList;
rv = GetBoolValue("useWhiteList", &useWhiteList);
NS_ENSURE_SUCCESS(rv,rv);
rv = mSpamSettings->SetUseWhiteList(useWhiteList);
NS_ENSURE_SUCCESS(rv,rv);
nsXPIDLCString whiteListAbURI;
rv = GetCharValue("whiteListAbURI", getter_Copies(whiteListAbURI));
NS_ENSURE_SUCCESS(rv,rv);
rv = mSpamSettings->SetWhiteListAbURI(whiteListAbURI);
NS_ENSURE_SUCCESS(rv,rv);
PRBool purgeSpam;
rv = GetBoolValue("purgeSpam", &purgeSpam);
NS_ENSURE_SUCCESS(rv,rv);
rv = mSpamSettings->SetPurge(purgeSpam);
NS_ENSURE_SUCCESS(rv,rv);
PRInt32 purgeSpamInterval;
rv = GetIntValue("purgeSpamInterval", &purgeSpamInterval);
NS_ENSURE_SUCCESS(rv,rv);
rv = mSpamSettings->SetPurgeInterval(purgeSpamInterval);
NS_ENSURE_SUCCESS(rv,rv);
}
NS_ADDREF(*aSpamSettings = mSpamSettings);
return NS_OK;
}

View File

@ -20,6 +20,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Seth Spitzer <sspitzer@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
@ -47,6 +48,7 @@
#include "nsWeakReference.h"
#include "nsIMsgDatabase.h"
#include "nsIFileSpec.h"
#include "nsISpamSettings.h"
class nsIMsgFolderCache;
class nsIMsgProtocolInfo;
@ -92,16 +94,18 @@ protected:
nsresult InternalSetHostName(const char *aHostname, const char *prefName);
nsresult getProtocolInfo(nsIMsgProtocolInfo **aResult);
nsCOMPtr<nsIFileSpec> mFilterFile;
nsCOMPtr<nsIMsgFilterList> mFilterList;
nsCOMPtr <nsIFileSpec> mFilterFile;
nsCOMPtr <nsIMsgFilterList> mFilterList;
// pref callback to clear the user prefs
static void clearPrefEnum(const char *aPref, void *aClosure);
private:
nsIPref *m_prefs;
nsCString m_password;
PRUint32 m_biffState;
PRUint32 m_biffState;
PRPackedBool m_serverBusy;
nsCOMPtr <nsISpamSettings> mSpamSettings;
protected:
// member variable for canHaveFilters
PRPackedBool m_canHaveFilters;

View File

@ -217,7 +217,7 @@ interface nsIMsgDatabase : nsIDBChangeAnnouncer {
void MarkOffline(in nsMsgKey key, in boolean offline,
in nsIDBChangeListener instigator);
void SetLabel(in nsMsgKey key, in nsMsgLabelValue label);
void setStringProperty(in nsMsgKey aKey, in string aProperty, in string aValue);
[noscript] void AllMsgKeysImapDeleted(in nsMsgKeyArrayPtr keys, out boolean allDeleted);
void MarkImapDeleted(in nsMsgKey key, in boolean deleted,

View File

@ -1875,6 +1875,19 @@ NS_IMETHODIMP nsMsgDatabase::MarkOffline(nsMsgKey key, PRBool offline,
return SetKeyFlag(key, offline, MSG_FLAG_OFFLINE, instigator);
}
NS_IMETHODIMP nsMsgDatabase::SetStringProperty(nsMsgKey aKey, const char *aProperty, const char *aValue)
{
nsCOMPtr <nsIMsgDBHdr> msgHdr;
nsresult rv = GetMsgHdrForKey(aKey, getter_AddRefs(msgHdr));
if (NS_FAILED(rv) || !msgHdr)
return NS_MSG_MESSAGE_NOT_FOUND; // XXX return rv?
rv = msgHdr->SetStringProperty(aProperty, aValue);
NS_ENSURE_SUCCESS(rv,rv);
return rv;
}
NS_IMETHODIMP nsMsgDatabase::SetLabel(nsMsgKey key, nsMsgLabelValue label)
{
nsresult rv;

View File

@ -293,7 +293,7 @@ pref("mail.collect_email_address_outgoing", true);
pref("mail.collect_email_address_newsgroup", false);
// by default, use the Personal Addressbook for collection
pref("mail.collect_addressbook","moz-abmdbdirectory://abook.mab");
pref("mail.collect_addressbook","moz-abmdbdirectory://abook.mab"); // the Personal addressbook.
pref("mail.default_sendlater_uri","mailbox://nobody@Local%20Folders/Unsent%20Messages");
@ -331,6 +331,15 @@ pref("mail.server.default.allows_specialfolders_usage", true);
pref("mail.server.default.canCreateFolders", true);
pref("mail.server.default.canFileMessages", true);
// for spam
pref("mail.server.default.spamLevel",60); // 0 - 100, 0 off, 20, lowest, 40 low, 60 medium, 80 high, 100 highest
pref("mail.server.default.moveOnSpam",false);
pref("mail.server.default.spamActionTargetFolder","mailbox://nobody@Local%20Folders/Junk%20Mail");
pref("mail.server.default.useWhiteList",true);
pref("mail.server.default.whiteListAbURI","moz-abmdbdirectory://abook.mab"); // the Personal addressbook.
pref("mail.server.default.purgeSpam",false);
pref("mail.server.default.purgeSpamInterval",14); // 14 days
pref("mail.smtpserver.default.auth_method", 1); // auth any
pref("mail.smtpserver.default.try_ssl", 0);

View File

@ -293,7 +293,7 @@ pref("mail.collect_email_address_outgoing", true);
pref("mail.collect_email_address_newsgroup", false);
// by default, use the Personal Addressbook for collection
pref("mail.collect_addressbook","moz-abmdbdirectory://abook.mab");
pref("mail.collect_addressbook","moz-abmdbdirectory://abook.mab"); // the Personal addressbook.
pref("mail.default_sendlater_uri","mailbox://nobody@Local%20Folders/Unsent%20Messages");
@ -331,6 +331,15 @@ pref("mail.server.default.allows_specialfolders_usage", true);
pref("mail.server.default.canCreateFolders", true);
pref("mail.server.default.canFileMessages", true);
// for spam
pref("mail.server.default.spamLevel",60); // 0 - 100, 0 off, 20, lowest, 40 low, 60 medium, 80 high, 100 highest
pref("mail.server.default.moveOnSpam",false);
pref("mail.server.default.spamActionTargetFolder","mailbox://nobody@Local%20Folders/Junk%20Mail");
pref("mail.server.default.useWhiteList",true);
pref("mail.server.default.whiteListAbURI","moz-abmdbdirectory://abook.mab"); // the Personal addressbook.
pref("mail.server.default.purgeSpam",false);
pref("mail.server.default.purgeSpamInterval",14); // 14 days
pref("mail.smtpserver.default.auth_method", 1); // auth any
pref("mail.smtpserver.default.try_ssl", 0);

View File

@ -212,3 +212,18 @@
-moz-image-region: rect(21px 88px 41px 66px) !important;
}
#button-junk {
-moz-image-region: rect(336px 23px 356px 0);
}
#button-junk[buttonover] {
-moz-image-region: rect(336px 46px 356px 23px);
}
#button-junk[buttondown] {
-moz-image-region: rect(336px 69px 356px 46px);
}
#button-junk[disabled] {
-moz-image-region: rect(336px 92px 356px 69px) !important;
}

View File

@ -232,3 +232,18 @@
-moz-image-region: rect(68px 199px 101px 150px) !important;
}
#button-junk {
-moz-image-region: rect(136px 49px 169px 0);
}
#button-junk[buttonover] {
-moz-image-region: rect(136px 99px 169px 50px);
}
#button-junk[buttondown] {
-moz-image-region: rect(136px 149px 169px 100px);
}
#button-junk[disabled] {
-moz-image-region: rect(136px 199px 169px 150px) !important;
}