Bug 1802815 - remove support for hdr label (the pre tb 2.0 version "tags"). r=benc
This is just dead code, with no UI to trigger it. Thunderbird 2.0 and above use tags (keywords) instead. Differential Revision: https://phabricator.services.mozilla.com/D163294 --HG-- extra : rebase_source : a43171844838a4c62dfd41b3d4c66feeb3afe2c1 extra : amend_source : 955a5e21977458c325c473042b308dac19955d8b
This commit is contained in:
Родитель
9a57b5d399
Коммит
b4e6b2a311
|
@ -608,13 +608,6 @@ var mailContextMenu = {
|
|||
// and (un)tag takes a key argument.
|
||||
for (let i = 0; i < selectedMessages.length; ++i) {
|
||||
let msgHdr = selectedMessages[i];
|
||||
if (msgHdr.label) {
|
||||
// Since we touch all these messages anyway, migrate the label now.
|
||||
// If we don't, the thread tree won't always show the correct tag state,
|
||||
// because resetting a label doesn't update the tree anymore...
|
||||
msgHdr.folder.addKeywordsToMessages([msgHdr], "$label" + msgHdr.label);
|
||||
msgHdr.label = 0; // remove legacy label
|
||||
}
|
||||
if (prevHdrFolder != msgHdr.folder) {
|
||||
if (prevHdrFolder) {
|
||||
prevHdrFolder[toggler](messages, key);
|
||||
|
|
|
@ -1100,12 +1100,11 @@ function RemoveAllMessageTags() {
|
|||
// that spans folders, by coalescing consecutive messages in the selection
|
||||
// that happen to be in the same folder. nsMsgSearchDBView does this better,
|
||||
// but nsIMsgDBView doesn't handle commands with arguments, and untag takes a
|
||||
// key argument. Furthermore, we only delete legacy labels and known tags,
|
||||
// key argument. Furthermore, we only delete known tags,
|
||||
// keeping other keywords like (non)junk intact.
|
||||
|
||||
for (var i = 0; i < selectedMessages.length; ++i) {
|
||||
var msgHdr = selectedMessages[i];
|
||||
msgHdr.label = 0; // remove legacy label
|
||||
if (prevHdrFolder != msgHdr.folder) {
|
||||
if (prevHdrFolder) {
|
||||
prevHdrFolder.removeKeywordsFromMessages(messages, allKeys);
|
||||
|
@ -1140,9 +1139,6 @@ function ToggleMessageTagKey(keyNumber) {
|
|||
|
||||
let key = tagArray[keyNumber - 1].key;
|
||||
let curKeys = msgHdr.getStringProperty("keywords").split(" ");
|
||||
if (msgHdr.label) {
|
||||
curKeys.push("$label" + msgHdr.label);
|
||||
}
|
||||
let addKey = !curKeys.includes(key);
|
||||
|
||||
ToggleMessageTag(key, addKey);
|
||||
|
@ -1166,13 +1162,6 @@ function ToggleMessageTag(key, addKey) {
|
|||
// and (un)tag takes a key argument.
|
||||
for (var i = 0; i < selectedMessages.length; ++i) {
|
||||
var msgHdr = selectedMessages[i];
|
||||
if (msgHdr.label) {
|
||||
// Since we touch all these messages anyway, migrate the label now.
|
||||
// If we don't, the thread tree won't always show the correct tag state,
|
||||
// because resetting a label doesn't update the tree anymore...
|
||||
msgHdr.folder.addKeywordsToMessages([msgHdr], "$label" + msgHdr.label);
|
||||
msgHdr.label = 0; // remove legacy label
|
||||
}
|
||||
if (prevHdrFolder != msgHdr.folder) {
|
||||
if (prevHdrFolder) {
|
||||
prevHdrFolder[toggler](messages, key);
|
||||
|
@ -1273,8 +1262,7 @@ function InitMessageTags(parent, elementName = "menuitem", classes) {
|
|||
);
|
||||
|
||||
// Rebuild the list.
|
||||
const suffix = message.label ? " $label" + message.label : "";
|
||||
const curKeys = message.getStringProperty("keywords") + suffix;
|
||||
const curKeys = message.getStringProperty("keywords");
|
||||
|
||||
tagArray.forEach((tagInfo, index) => {
|
||||
const removeKey = ` ${curKeys} `.includes(` ${tagInfo.key} `);
|
||||
|
|
|
@ -3733,14 +3733,6 @@ const gMessageHeader = {
|
|||
|
||||
// Extract the tag keys from the message header.
|
||||
let msgKeyArray = msgHdr.getStringProperty("keywords").split(" ");
|
||||
// Attach legacy label to the front if not already there.
|
||||
let label = msgHdr.label;
|
||||
if (label) {
|
||||
let labelKey = `$label${label}`;
|
||||
if (!msgKeyArray.includes(labelKey)) {
|
||||
msgKeyArray.unshift(labelKey);
|
||||
}
|
||||
}
|
||||
|
||||
// Get the list of known tags.
|
||||
let tagsArray = MailServices.tags.getAllTags().filter(t => t.tag);
|
||||
|
|
|
@ -89,7 +89,6 @@ filterAction4=marked as read
|
|||
filterAction5=thread killed
|
||||
filterAction6=thread watched
|
||||
filterAction7=starred
|
||||
filterAction8=tagged
|
||||
filterAction9=replied
|
||||
filterAction10=forwarded
|
||||
filterAction11=execution stopped
|
||||
|
|
|
@ -87,8 +87,6 @@ interface nsMsgAuthMethod : nsISupports {
|
|||
const nsMsgAuthMethodValue OAuth2 = 10;
|
||||
};
|
||||
|
||||
typedef unsigned long nsMsgLabelValue;
|
||||
|
||||
typedef long nsMsgViewSortOrderValue;
|
||||
typedef long nsMsgViewSortTypeValue;
|
||||
typedef long nsMsgViewTypeValue;
|
||||
|
|
|
@ -535,7 +535,7 @@ interface nsIMsgFolder : nsISupports {
|
|||
void markAllMessagesRead(in nsIMsgWindow aMsgWindow);
|
||||
void markMessagesFlagged(in Array<nsIMsgDBHdr> messages, in boolean markFlagged);
|
||||
void markThreadRead(in nsIMsgThread thread);
|
||||
void setLabelForMessages(in Array<nsIMsgDBHdr> messages, in nsMsgLabelValue label);
|
||||
|
||||
/**
|
||||
* Gets the message database for the folder.
|
||||
*
|
||||
|
|
|
@ -100,7 +100,6 @@ interface nsIMsgDBHdr : nsISupports
|
|||
*/
|
||||
readonly attribute ACString effectiveCharset;
|
||||
|
||||
attribute nsMsgLabelValue label;
|
||||
attribute string accountKey;
|
||||
readonly attribute nsIMsgFolder folder;
|
||||
|
||||
|
|
|
@ -4374,21 +4374,6 @@ nsMsgDBFolder::MarkMessagesFlagged(
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgDBFolder::SetLabelForMessages(
|
||||
const nsTArray<RefPtr<nsIMsgDBHdr>>& aMessages, nsMsgLabelValue aLabel) {
|
||||
GetDatabase();
|
||||
if (mDatabase) {
|
||||
for (auto message : aMessages) {
|
||||
nsMsgKey msgKey;
|
||||
(void)message->GetMessageKey(&msgKey);
|
||||
nsresult rv = mDatabase->SetLabel(msgKey, aLabel);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgDBFolder::SetJunkScoreForMessages(
|
||||
const nsTArray<RefPtr<nsIMsgDBHdr>>& aMessages,
|
||||
|
@ -5366,17 +5351,6 @@ NS_IMETHODIMP nsMsgDBFolder::RemoveKeywordsFromMessages(
|
|||
rv = message->GetStringProperty("keywords", getter_Copies(keywords));
|
||||
uint32_t removeCount = 0;
|
||||
for (uint32_t j = 0; j < keywordArray.Length(); j++) {
|
||||
bool keywordIsLabel = (StringBeginsWith(keywordArray[j], "$label"_ns) &&
|
||||
keywordArray[j].CharAt(6) >= '1' &&
|
||||
keywordArray[j].CharAt(6) <= '5');
|
||||
if (keywordIsLabel) {
|
||||
nsMsgLabelValue labelValue;
|
||||
message->GetLabel(&labelValue);
|
||||
// if we're removing the keyword that corresponds to a pre 2.0 label,
|
||||
// we need to clear the old label attribute on the message.
|
||||
if (labelValue == (nsMsgLabelValue)(keywordArray[j].CharAt(6) - '0'))
|
||||
message->SetLabel((nsMsgLabelValue)0);
|
||||
}
|
||||
int32_t startOffset, length;
|
||||
if (MsgFindKeyword(keywordArray[j], keywords, &startOffset, &length)) {
|
||||
// delete any leading space delimiters
|
||||
|
|
|
@ -76,7 +76,6 @@ nsDateFormatSelectorComm nsMsgDBView::m_dateFormatToday = kDateFormatNone;
|
|||
|
||||
nsString nsMsgDBView::m_connectorPattern;
|
||||
nsCOMPtr<nsIStringBundle> nsMsgDBView::mMessengerStringBundle;
|
||||
nsString nsMsgDBView::mLabelPrefDescriptions[PREF_LABELS_MAX];
|
||||
|
||||
static const uint32_t kMaxNumSortColumns = 2;
|
||||
|
||||
|
@ -106,7 +105,6 @@ class viewSortInfo {
|
|||
NS_IMPL_ISUPPORTS(nsMsgDBViewService, nsIMsgDBViewService)
|
||||
NS_IMETHODIMP nsMsgDBViewService::InitializeDBViewStrings() {
|
||||
nsMsgDBView::InitializeLiterals();
|
||||
nsMsgDBView::InitLabelStrings();
|
||||
nsMsgDBView::m_connectorPattern.Truncate();
|
||||
nsMsgDBView::mMessengerStringBundle = nullptr;
|
||||
// Initialize date display format.
|
||||
|
@ -192,19 +190,6 @@ nsMsgDBView::~nsMsgDBView() {
|
|||
if (m_db) m_db->RemoveListener(this);
|
||||
}
|
||||
|
||||
nsresult nsMsgDBView::InitLabelStrings() {
|
||||
nsresult rv = NS_OK;
|
||||
nsCString prefString;
|
||||
|
||||
for (int32_t i = 0; i < PREF_LABELS_MAX; i++) {
|
||||
prefString.Assign(PREF_LABELS_DESCRIPTION);
|
||||
prefString.AppendInt(i + 1);
|
||||
rv = GetPrefLocalizedString(prefString.get(),
|
||||
nsMsgDBView::mLabelPrefDescriptions[i]);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Helper function used to fetch strings from the messenger string bundle
|
||||
void nsMsgDBView::GetString(const char16_t* aStringName, nsAString& aValue) {
|
||||
nsresult res = NS_ERROR_UNEXPECTED;
|
||||
|
@ -749,21 +734,8 @@ nsresult nsMsgDBView::FetchKeywords(nsIMsgDBHdr* aHdr,
|
|||
mTagService = do_GetService("@mozilla.org/messenger/tagservice;1", &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
nsMsgLabelValue label = 0;
|
||||
|
||||
rv = aHdr->GetLabel(&label);
|
||||
nsCString keywords;
|
||||
aHdr->GetStringProperty("keywords", getter_Copies(keywords));
|
||||
if (label > 0) {
|
||||
nsAutoCString labelStr("$label");
|
||||
labelStr.Append((char)(label + '0'));
|
||||
if (!FindInReadable(labelStr, keywords,
|
||||
nsCaseInsensitiveCStringComparator)) {
|
||||
if (!keywords.IsEmpty()) keywords.Append(' ');
|
||||
keywords.Append(labelStr);
|
||||
}
|
||||
}
|
||||
|
||||
keywordString = keywords;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -820,15 +792,6 @@ nsresult nsMsgDBView::FetchTags(nsIMsgDBHdr* aHdr, nsAString& aTagString) {
|
|||
nsCString keywords;
|
||||
aHdr->GetStringProperty("keywords", getter_Copies(keywords));
|
||||
|
||||
nsMsgLabelValue label = 0;
|
||||
rv = aHdr->GetLabel(&label);
|
||||
if (label > 0) {
|
||||
nsAutoCString labelStr("$label");
|
||||
labelStr.Append((char)(label + '0'));
|
||||
if (!FindInReadable(labelStr, keywords, nsCaseInsensitiveCStringComparator))
|
||||
FetchLabel(aHdr, tags);
|
||||
}
|
||||
|
||||
nsTArray<nsCString> keywordsArray;
|
||||
ParseString(keywords, ' ', keywordsArray);
|
||||
nsAutoString tag;
|
||||
|
@ -846,26 +809,6 @@ nsresult nsMsgDBView::FetchTags(nsIMsgDBHdr* aHdr, nsAString& aTagString) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsMsgDBView::FetchLabel(nsIMsgDBHdr* aHdr, nsAString& aLabelString) {
|
||||
nsresult rv = NS_OK;
|
||||
nsMsgLabelValue label = 0;
|
||||
|
||||
NS_ENSURE_ARG_POINTER(aHdr);
|
||||
|
||||
rv = aHdr->GetLabel(&label);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// We don't care if label is not between 1 and PREF_LABELS_MAX inclusive.
|
||||
if ((label < 1) || (label > PREF_LABELS_MAX)) {
|
||||
aLabelString.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// We need to subtract 1 because mLabelPrefDescriptions is 0 based.
|
||||
aLabelString = nsMsgDBView::mLabelPrefDescriptions[label - 1];
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lowercase the email and remove a possible plus addressing part.
|
||||
* E.g. John+test@example.com -> john@example.com.
|
||||
|
|
|
@ -64,11 +64,6 @@ class MsgViewSortColumnInfo {
|
|||
#define MSG_VIEW_FLAG_OUTGOING 0x2000000
|
||||
#define MSG_VIEW_FLAG_INCOMING 0x1000000
|
||||
|
||||
// There currently only 5 labels defined.
|
||||
#define PREF_LABELS_MAX 5
|
||||
#define PREF_LABELS_DESCRIPTION "mailnews.labels.description."
|
||||
#define PREF_LABELS_COLOR "mailnews.labels.color."
|
||||
|
||||
// Helper struct for sorting by numeric fields.
|
||||
// Associates a message with a key for ordering it in the view.
|
||||
struct IdUint32 {
|
||||
|
@ -340,7 +335,6 @@ class nsMsgDBView : public nsIMsgDBView,
|
|||
nsTArray<nsMsgKey>& keysMarkedRead,
|
||||
bool read);
|
||||
nsresult SetFlaggedByIndex(nsMsgViewIndex index, bool mark);
|
||||
nsresult SetLabelByIndex(nsMsgViewIndex index, nsMsgLabelValue label);
|
||||
nsresult OrExtraFlag(nsMsgViewIndex index, uint32_t orflag);
|
||||
nsresult AndExtraFlag(nsMsgViewIndex index, uint32_t andflag);
|
||||
nsresult SetExtraFlag(nsMsgViewIndex index, uint32_t extraflag);
|
||||
|
@ -495,10 +489,6 @@ class nsMsgDBView : public nsIMsgDBView,
|
|||
nsCOMPtr<nsIMsgDBViewCommandUpdater> mCommandUpdater;
|
||||
static nsCOMPtr<nsIStringBundle> mMessengerStringBundle;
|
||||
|
||||
// Used for the preference labels.
|
||||
static nsString mLabelPrefDescriptions[PREF_LABELS_MAX];
|
||||
nsString mLabelPrefColors[PREF_LABELS_MAX];
|
||||
|
||||
// Used to determine when to start and end junk plugin batches.
|
||||
uint32_t mNumMessagesRemainingInBatch;
|
||||
|
||||
|
|
|
@ -98,8 +98,7 @@ nsMsgTagService::nsMsgTagService() {
|
|||
do_GetService(NS_PREFSERVICE_CONTRACTID));
|
||||
if (prefService)
|
||||
prefService->GetBranch("mailnews.tags.", getter_AddRefs(m_tagPrefBranch));
|
||||
// need to figure out how to migrate the tags only once.
|
||||
MigrateLabelsToTags();
|
||||
SetupLabelTags();
|
||||
RefreshKeyCache();
|
||||
}
|
||||
|
||||
|
@ -399,54 +398,36 @@ nsresult nsMsgTagService::GetUnicharPref(const char* prefName,
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsMsgTagService::MigrateLabelsToTags() {
|
||||
nsresult nsMsgTagService::SetupLabelTags() {
|
||||
nsCString prefString;
|
||||
|
||||
int32_t prefVersion = 0;
|
||||
nsresult rv = m_tagPrefBranch->GetIntPref(TAG_PREF_VERSION, &prefVersion);
|
||||
if (NS_SUCCEEDED(rv) && prefVersion > 1)
|
||||
if (NS_SUCCEEDED(rv) && prefVersion > 1) {
|
||||
return rv;
|
||||
else if (prefVersion == 1) {
|
||||
gMigratingKeys = true;
|
||||
// need to convert the keys to lower case
|
||||
nsTArray<RefPtr<nsIMsgTag>> tagArray;
|
||||
GetAllTags(tagArray);
|
||||
for (auto& tag : tagArray) {
|
||||
nsAutoCString key, color, ordinal;
|
||||
nsAutoString tagStr;
|
||||
tag->GetKey(key);
|
||||
tag->GetTag(tagStr);
|
||||
tag->GetOrdinal(ordinal);
|
||||
tag->GetColor(color);
|
||||
DeleteKey(key);
|
||||
ToLowerCase(key);
|
||||
AddTagForKey(key, tagStr, color, ordinal);
|
||||
}
|
||||
gMigratingKeys = false;
|
||||
} else {
|
||||
nsCOMPtr<nsIPrefBranch> prefRoot(do_GetService(NS_PREFSERVICE_CONTRACTID));
|
||||
nsCOMPtr<nsIPrefLocalizedString> pls;
|
||||
nsString ucsval;
|
||||
nsAutoCString labelKey("$label1");
|
||||
for (int32_t i = 0; i < PREF_LABELS_MAX;) {
|
||||
prefString.Assign(PREF_LABELS_DESCRIPTION);
|
||||
prefString.AppendInt(i + 1);
|
||||
rv = prefRoot->GetComplexValue(prefString.get(),
|
||||
NS_GET_IID(nsIPrefLocalizedString),
|
||||
getter_AddRefs(pls));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
pls->ToString(getter_Copies(ucsval));
|
||||
}
|
||||
nsCOMPtr<nsIPrefBranch> prefRoot(do_GetService(NS_PREFSERVICE_CONTRACTID));
|
||||
nsCOMPtr<nsIPrefLocalizedString> pls;
|
||||
nsString ucsval;
|
||||
nsAutoCString labelKey("$label1");
|
||||
for (int32_t i = 0; i < 5;) {
|
||||
prefString.AssignLiteral("mailnews.labels.description.");
|
||||
prefString.AppendInt(i + 1);
|
||||
rv = prefRoot->GetComplexValue(prefString.get(),
|
||||
NS_GET_IID(nsIPrefLocalizedString),
|
||||
getter_AddRefs(pls));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
pls->ToString(getter_Copies(ucsval));
|
||||
|
||||
prefString.Assign(PREF_LABELS_COLOR);
|
||||
prefString.AppendInt(i + 1);
|
||||
nsCString csval;
|
||||
rv = prefRoot->GetCharPref(prefString.get(), csval);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
prefString.AssignLiteral("mailnews.labels.color.");
|
||||
prefString.AppendInt(i + 1);
|
||||
nsCString csval;
|
||||
rv = prefRoot->GetCharPref(prefString.get(), csval);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = AddTagForKey(labelKey, ucsval, csval, EmptyCString());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
labelKey.SetCharAt(++i + '1', 6);
|
||||
}
|
||||
rv = AddTagForKey(labelKey, ucsval, csval, EmptyCString());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
labelKey.SetCharAt(++i + '1', 6);
|
||||
}
|
||||
m_tagPrefBranch->SetIntPref(TAG_PREF_VERSION, 2);
|
||||
return rv;
|
||||
|
|
|
@ -380,7 +380,6 @@ interface nsIMsgDatabase : nsIDBChangeAnnouncer {
|
|||
in nsIDBChangeListener instigator);
|
||||
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);
|
||||
/**
|
||||
* Set the value of a string property in a message header
|
||||
|
|
|
@ -2233,25 +2233,6 @@ nsMsgDatabase::SetUint32PropertyByHdr(nsIMsgDBHdr* aMsgHdr,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgDatabase::SetLabel(nsMsgKey key, nsMsgLabelValue label) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIMsgDBHdr> msgHdr;
|
||||
|
||||
rv = GetMsgHdrForKey(key, getter_AddRefs(msgHdr));
|
||||
if (NS_FAILED(rv) || !msgHdr) return NS_MSG_MESSAGE_NOT_FOUND;
|
||||
nsMsgLabelValue oldLabel;
|
||||
msgHdr->GetLabel(&oldLabel);
|
||||
|
||||
msgHdr->SetLabel(label);
|
||||
// clear old label
|
||||
if (oldLabel != label) {
|
||||
if (oldLabel != 0) rv = SetKeyFlag(key, false, oldLabel << 25, nullptr);
|
||||
// set the flag in the x-mozilla-status2 line.
|
||||
rv = SetKeyFlag(key, true, label << 25, nullptr);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgDatabase::MarkImapDeleted(nsMsgKey key, bool deleted,
|
||||
nsIDBChangeListener* instigator) {
|
||||
return SetKeyFlag(key, deleted, nsMsgMessageFlags::IMAPDeleted, instigator);
|
||||
|
|
|
@ -377,17 +377,6 @@ NS_IMETHODIMP nsMsgHdr::GetPriority(nsMsgPriorityValue* result) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgHdr::SetLabel(nsMsgLabelValue label) {
|
||||
SetUInt32Column((uint32_t)label, m_mdb->m_labelColumnToken);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgHdr::GetLabel(nsMsgLabelValue* result) {
|
||||
NS_ENSURE_ARG_POINTER(result);
|
||||
|
||||
return GetUInt32Column(m_mdb->m_labelColumnToken, result);
|
||||
}
|
||||
|
||||
// I'd like to not store the account key, if the msg is in
|
||||
// the same account as it was received in, to save disk space and memory.
|
||||
// This might be problematic when a message gets moved...
|
||||
|
|
|
@ -51,7 +51,6 @@ typedef uint16_t imapMessageFlagsType;
|
|||
#define kImapMsgForwardedFlag 0x0040 /* Not always supported, check mailbox folder */
|
||||
#define kImapMsgMDNSentFlag 0x0080 /* Not always supported. check mailbox folder */
|
||||
#define kImapMsgCustomKeywordFlag 0x0100 /* this msg has a custom keyword */
|
||||
#define kImapMsgLabelFlags 0x0E00 /* supports 5 labels only supported if the folder supports keywords */
|
||||
#define kImapMsgSupportMDNSentFlag 0x2000
|
||||
#define kImapMsgSupportForwardedFlag 0x4000
|
||||
/**
|
||||
|
|
|
@ -1818,22 +1818,6 @@ nsImapMailFolder::MarkMessagesRead(
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMailFolder::SetLabelForMessages(
|
||||
const nsTArray<RefPtr<nsIMsgDBHdr>>& aMessages, nsMsgLabelValue aLabel) {
|
||||
nsresult rv = nsMsgDBFolder::SetLabelForMessages(aMessages, aLabel);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoCString messageIds;
|
||||
nsTArray<nsMsgKey> keysToLabel;
|
||||
nsresult rv = BuildIdsAndKeyArray(aMessages, messageIds, keysToLabel);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
StoreImapFlags((aLabel << 9), true, keysToLabel, nullptr);
|
||||
rv = GetDatabase();
|
||||
if (NS_SUCCEEDED(rv)) mDatabase->Commit(nsMsgDBCommitType::kLargeCommit);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMailFolder::MarkAllMessagesRead(nsIMsgWindow* aMsgWindow) {
|
||||
nsresult rv = GetDatabase();
|
||||
|
@ -3439,13 +3423,6 @@ NS_IMETHODIMP nsImapMailFolder::ApplyFilterHit(nsIMsgFilter* filter,
|
|||
rv = mDatabase->SetUint32PropertyByHdr(
|
||||
msgHdr, "priority", static_cast<uint32_t>(filterPriority));
|
||||
} break;
|
||||
case nsMsgFilterAction::Label: {
|
||||
nsMsgLabelValue filterLabel;
|
||||
filterAction->GetLabel(&filterLabel);
|
||||
mDatabase->SetUint32PropertyByHdr(msgHdr, "label",
|
||||
static_cast<uint32_t>(filterLabel));
|
||||
rv = StoreImapFlags((filterLabel << 9), true, {msgKey}, nullptr);
|
||||
} break;
|
||||
case nsMsgFilterAction::AddTag: {
|
||||
nsCString keyword;
|
||||
filterAction->GetStrValue(keyword);
|
||||
|
@ -4198,15 +4175,6 @@ void nsImapMailFolder::TweakHeaderFlags(nsIImapProtocol* aProtocol,
|
|||
newFlags |= nsMsgMessageFlags::IMAPDeleted;
|
||||
if (imap_flags & kImapMsgForwardedFlag)
|
||||
newFlags |= nsMsgMessageFlags::Forwarded;
|
||||
|
||||
// db label flags are 0x0E000000 and imap label flags are 0x0E00
|
||||
// so we need to shift 16 bits to the left to convert them.
|
||||
if (imap_flags & kImapMsgLabelFlags) {
|
||||
// we need to set label attribute on header because the dbview code
|
||||
// does msgHdr->GetLabel when asked to paint a row
|
||||
tweakMe->SetLabel((imap_flags & kImapMsgLabelFlags) >> 9);
|
||||
newFlags |= (imap_flags & kImapMsgLabelFlags) << 16;
|
||||
}
|
||||
if (newFlags) tweakMe->OrFlags(newFlags, &dbHdrFlags);
|
||||
if (!customFlags.IsEmpty())
|
||||
(void)HandleCustomFlags(m_curMsgUid, tweakMe, userFlags, customFlags);
|
||||
|
@ -4671,16 +4639,6 @@ nsresult nsImapMailFolder::NotifyMessageFlagsFromHdr(nsIMsgDBHdr* dbHdr,
|
|||
if (supportedFlags & kImapMsgSupportForwardedFlag)
|
||||
database->MarkForwarded(msgKey, (flags & kImapMsgForwardedFlag) != 0,
|
||||
nullptr);
|
||||
// this turns on labels, but it doesn't handle the case where the user
|
||||
// unlabels a message on one machine, and expects it to be unlabeled
|
||||
// on their other machines. If I turn that on, I'll be removing all the labels
|
||||
// that were assigned before we started storing them on the server, which will
|
||||
// make some people very unhappy.
|
||||
if (flags & kImapMsgLabelFlags)
|
||||
database->SetLabel(msgKey, (flags & kImapMsgLabelFlags) >> 9);
|
||||
else {
|
||||
if (supportedFlags & kImapMsgLabelFlags) database->SetLabel(msgKey, 0);
|
||||
}
|
||||
if (supportedFlags & kImapMsgSupportMDNSentFlag)
|
||||
database->MarkMDNSent(msgKey, (flags & kImapMsgMDNSentFlag) != 0, nullptr);
|
||||
|
||||
|
@ -4851,12 +4809,7 @@ nsImapMailFolder::GetCurMoveCopyMessageInfo(nsIImapUrl* runningUrl,
|
|||
mailCopyState->m_curIndex < mailCopyState->m_messages.Length()) {
|
||||
nsIMsgDBHdr* message =
|
||||
mailCopyState->m_messages[mailCopyState->m_curIndex];
|
||||
nsMsgLabelValue label;
|
||||
message->GetFlags(aResult);
|
||||
if (supportedFlags & (kImapMsgSupportUserFlag | kImapMsgLabelFlags)) {
|
||||
message->GetLabel(&label);
|
||||
if (label != 0) *aResult |= label << 25;
|
||||
}
|
||||
if (aDate) message->GetDate(aDate);
|
||||
if (supportedFlags & kImapMsgSupportUserFlag) {
|
||||
// setup the custom imap keywords, which includes the message keywords
|
||||
|
@ -6931,13 +6884,6 @@ void nsImapMailFolder::SetPendingAttributes(
|
|||
// that we need to set on the dest hdr
|
||||
for (auto msgDBHdr : messages) {
|
||||
if (!(supportedUserFlags & kImapMsgSupportUserFlag)) {
|
||||
nsMsgLabelValue label;
|
||||
msgDBHdr->GetLabel(&label);
|
||||
if (label != 0) {
|
||||
nsAutoCString labelStr;
|
||||
labelStr.AppendInt(label);
|
||||
mDatabase->SetAttributeOnPendingHdr(msgDBHdr, "label", labelStr.get());
|
||||
}
|
||||
nsCString keywords;
|
||||
msgDBHdr->GetStringProperty("keywords", getter_Copies(keywords));
|
||||
if (!keywords.IsEmpty())
|
||||
|
|
|
@ -271,8 +271,6 @@ class nsImapMailFolder : public nsMsgDBFolder,
|
|||
NS_IMETHOD MarkMessagesFlagged(const nsTArray<RefPtr<nsIMsgDBHdr>>& messages,
|
||||
bool markFlagged) override;
|
||||
NS_IMETHOD MarkThreadRead(nsIMsgThread* thread) override;
|
||||
NS_IMETHOD SetLabelForMessages(const nsTArray<RefPtr<nsIMsgDBHdr>>& aMessages,
|
||||
nsMsgLabelValue aLabel) override;
|
||||
NS_IMETHOD SetJunkScoreForMessages(
|
||||
const nsTArray<RefPtr<nsIMsgDBHdr>>& aMessages,
|
||||
const nsACString& aJunkScore) override;
|
||||
|
|
|
@ -1602,7 +1602,6 @@ void nsImapServerResponseParser::text_mime2() { skip_to_CRLF(); }
|
|||
void nsImapServerResponseParser::text() { skip_to_CRLF(); }
|
||||
|
||||
void nsImapServerResponseParser::parse_folder_flags(bool calledForFlags) {
|
||||
uint16_t labelFlags = 0;
|
||||
uint16_t junkNotJunkFlags = 0;
|
||||
|
||||
do {
|
||||
|
@ -1624,7 +1623,6 @@ void nsImapServerResponseParser::parse_folder_flags(bool calledForFlags) {
|
|||
fSupportsUserDefinedFlags |= kImapMsgSupportUserFlag;
|
||||
fSupportsUserDefinedFlags |= kImapMsgSupportForwardedFlag;
|
||||
fSupportsUserDefinedFlags |= kImapMsgSupportMDNSentFlag;
|
||||
fSupportsUserDefinedFlags |= kImapMsgLabelFlags;
|
||||
}
|
||||
// Treat special and built-in $LabelX's as user defined and include
|
||||
// $Junk/$NotJunk too.
|
||||
|
@ -1632,24 +1630,12 @@ void nsImapServerResponseParser::parse_folder_flags(bool calledForFlags) {
|
|||
fSupportsUserDefinedFlags |= kImapMsgSupportMDNSentFlag;
|
||||
else if (!PL_strncasecmp(fNextToken, "$Forwarded", 10))
|
||||
fSupportsUserDefinedFlags |= kImapMsgSupportForwardedFlag;
|
||||
else if (!PL_strncasecmp(fNextToken, "$Label1", 7))
|
||||
labelFlags |= 1;
|
||||
else if (!PL_strncasecmp(fNextToken, "$Label2", 7))
|
||||
labelFlags |= 2;
|
||||
else if (!PL_strncasecmp(fNextToken, "$Label3", 7))
|
||||
labelFlags |= 4;
|
||||
else if (!PL_strncasecmp(fNextToken, "$Label4", 7))
|
||||
labelFlags |= 8;
|
||||
else if (!PL_strncasecmp(fNextToken, "$Label5", 7))
|
||||
labelFlags |= 16;
|
||||
else if (!PL_strncasecmp(fNextToken, "$Junk", 5))
|
||||
junkNotJunkFlags |= 1;
|
||||
else if (!PL_strncasecmp(fNextToken, "$NotJunk", 8))
|
||||
junkNotJunkFlags |= 2;
|
||||
} while (!fAtEndOfLine && ContinueParse());
|
||||
|
||||
if (labelFlags == 31) fSupportsUserDefinedFlags |= kImapMsgLabelFlags;
|
||||
|
||||
if (fFlagState) fFlagState->OrSupportedUserFlags(fSupportsUserDefinedFlags);
|
||||
|
||||
if (calledForFlags) {
|
||||
|
|
|
@ -259,22 +259,6 @@ var gTestArray = [
|
|||
testCounts(true, 1, 1, 1);
|
||||
Assert.equal(Ci.nsMsgPriority.highest, gHeader.priority);
|
||||
},
|
||||
async function Label() {
|
||||
gAction.type = Ci.nsMsgFilterAction.Label;
|
||||
gAction.label = 2;
|
||||
await setupTest(gFilter, gAction);
|
||||
|
||||
testCounts(true, 1, 1, 1);
|
||||
Assert.equal(2, gHeader.label);
|
||||
},
|
||||
async function LabelBody() {
|
||||
gAction.type = Ci.nsMsgFilterAction.Label;
|
||||
gAction.label = 3;
|
||||
await setupTest(gBodyFilter, gAction);
|
||||
|
||||
testCounts(true, 1, 1, 1);
|
||||
Assert.equal(3, gHeader.label);
|
||||
},
|
||||
async function AddTag() {
|
||||
gAction.type = Ci.nsMsgFilterAction.AddTag;
|
||||
gAction.strValue = "TheTag";
|
||||
|
|
|
@ -120,13 +120,6 @@ var gTestArray = [
|
|||
testCounts(true, 1, 1, 1);
|
||||
Assert.equal(Ci.nsMsgPriority.highest, gHeader.priority);
|
||||
},
|
||||
async function Label() {
|
||||
gAction.type = Ci.nsMsgFilterAction.Label;
|
||||
gAction.label = 2;
|
||||
await setupTest(gFilter, gAction);
|
||||
testCounts(true, 1, 1, 1);
|
||||
Assert.equal(2, gHeader.label);
|
||||
},
|
||||
async function AddTag() {
|
||||
gAction.type = Ci.nsMsgFilterAction.AddTag;
|
||||
gAction.strValue = "TheTag";
|
||||
|
|
|
@ -2046,10 +2046,6 @@ void nsMsgLocalMailFolder::CopyHdrPropertiesWithSkipList(
|
|||
srcHdr->GetStringProperty(property.get(), getter_Copies(sourceString));
|
||||
destHdr->SetStringProperty(property.get(), sourceString.get());
|
||||
}
|
||||
|
||||
nsMsgLabelValue label = 0;
|
||||
srcHdr->GetLabel(&label);
|
||||
destHdr->SetLabel(label);
|
||||
}
|
||||
|
||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY NS_IMETHODIMP
|
||||
|
|
|
@ -1123,7 +1123,6 @@ nsresult nsParseMailMessageState::FinalizeHeaders() {
|
|||
|
||||
uint32_t flags = 0;
|
||||
nsMsgPriorityValue priorityFlags = nsMsgPriority::notSet;
|
||||
uint32_t labelFlags = 0;
|
||||
|
||||
if (!m_mailDB) // if we don't have a valid db, skip the header.
|
||||
return NS_OK;
|
||||
|
@ -1252,12 +1251,6 @@ nsresult nsParseMailMessageState::FinalizeHeaders() {
|
|||
if (replyTo && (!sender || replyTo->length != sender->length ||
|
||||
strncmp(replyTo->value, sender->value, sender->length)))
|
||||
m_newMsgHdr->SetStringProperty("replyTo", replyTo->value);
|
||||
// convert the flag values (0xE000000) to label values (0-5)
|
||||
if (mozstatus2) // only do this if we have a mozstatus2 header
|
||||
{
|
||||
labelFlags = ((flags & nsMsgMessageFlags::Labels) >> 25);
|
||||
m_newMsgHdr->SetLabel(labelFlags);
|
||||
}
|
||||
if (sender) m_newMsgHdr->SetAuthor(sender->value);
|
||||
if (recipient == &m_newsgroups) {
|
||||
/* In the case where the recipient is a newsgroup, truncate the string
|
||||
|
@ -1939,11 +1932,6 @@ NS_IMETHODIMP nsParseNewMailState::ApplyFilterHit(nsIMsgFilter* filter,
|
|||
rv = m_downloadFolder->AddKeywordsToMessages({&*msgHdr}, keyword);
|
||||
break;
|
||||
}
|
||||
case nsMsgFilterAction::Label: {
|
||||
nsMsgLabelValue filterLabel;
|
||||
filterAction->GetLabel(&filterLabel);
|
||||
rv = m_mailDB->SetLabel(msgKey, filterLabel);
|
||||
} break;
|
||||
case nsMsgFilterAction::JunkScore: {
|
||||
nsAutoCString junkScoreStr;
|
||||
int32_t junkScore;
|
||||
|
|
|
@ -352,12 +352,6 @@ class NntpNewsGroup {
|
|||
action.strValue
|
||||
);
|
||||
break;
|
||||
case Ci.nsMsgFilterAction.Label:
|
||||
this._filteringHdr.setLabel(
|
||||
this._filteringHdr.messageKey,
|
||||
action.label
|
||||
);
|
||||
break;
|
||||
case Ci.nsMsgFilterAction.StopExecution:
|
||||
applyMore = false;
|
||||
break;
|
||||
|
|
|
@ -1609,9 +1609,6 @@
|
|||
case nsMsgFilterAction.Forward:
|
||||
actionItem.children[0].value = aFilterAction.strValue;
|
||||
break;
|
||||
case nsMsgFilterAction.Label:
|
||||
actionItem.children[0].value = aFilterAction.label;
|
||||
break;
|
||||
case nsMsgFilterAction.ChangePriority:
|
||||
actionItem.children[0].value = aFilterAction.priority;
|
||||
break;
|
||||
|
@ -1708,9 +1705,6 @@
|
|||
let actionItem = actionTarget.ruleactiontargetElement;
|
||||
let nsMsgFilterAction = Ci.nsMsgFilterAction;
|
||||
switch (filterAction.type) {
|
||||
case nsMsgFilterAction.Label:
|
||||
filterAction.label = actionItem.children[0].getAttribute("value");
|
||||
break;
|
||||
case nsMsgFilterAction.ChangePriority:
|
||||
filterAction.priority = actionItem.children[0].getAttribute("value");
|
||||
break;
|
||||
|
|
|
@ -25,9 +25,6 @@ interface nsIMsgRuleAction : nsISupports {
|
|||
// target folder.. throws an exception if the action is not move to folder
|
||||
attribute AUTF8String targetFolderUri;
|
||||
|
||||
// target label. throws an exception if the action is not label
|
||||
attribute nsMsgLabelValue label;
|
||||
|
||||
attribute long junkScore;
|
||||
|
||||
attribute AUTF8String strValue;
|
||||
|
|
|
@ -51,7 +51,6 @@ interface nsIMsgSearchTerm : nsISupports {
|
|||
boolean matchPriority(in nsMsgPriorityValue priority);
|
||||
boolean matchAge(in PRTime days);
|
||||
boolean matchSize(in unsigned long size);
|
||||
boolean matchLabel(in nsMsgLabelValue aLabelValue);
|
||||
boolean matchJunkStatus(in string aJunkScore);
|
||||
/*
|
||||
* Test search term match for junkpercent
|
||||
|
|
|
@ -23,7 +23,6 @@ interface nsIMsgSearchValue : nsISupports {
|
|||
attribute nsMsgKey msgKey;
|
||||
attribute long age; // in days
|
||||
attribute nsIMsgFolder folder;
|
||||
attribute nsMsgLabelValue label;
|
||||
attribute nsMsgJunkStatus junkStatus;
|
||||
/*
|
||||
* junkPercent is set by the message filter plugin, and is approximately
|
||||
|
|
|
@ -48,7 +48,6 @@ interface nsMsgFilterAction : nsISupports {
|
|||
const long KillThread=5;
|
||||
const long WatchThread=6;
|
||||
const long MarkFlagged=7;
|
||||
const long Label=8;
|
||||
const long Reply=9;
|
||||
const long Forward=10;
|
||||
const long StopExecution=11;
|
||||
|
|
|
@ -92,7 +92,6 @@ interface nsMsgSearchAttrib : nsISupports {
|
|||
const nsMsgSearchAttribValue JunkStatus = 45;
|
||||
const nsMsgSearchAttribValue JunkPercent = 46;
|
||||
const nsMsgSearchAttribValue JunkScoreOrigin = 47;
|
||||
const nsMsgSearchAttribValue Label = 48; /* mail only...can search by label */
|
||||
const nsMsgSearchAttribValue HdrProperty = 49; // uses nsIMsgSearchTerm::hdrProperty
|
||||
const nsMsgSearchAttribValue FolderFlag = 50; // uses nsIMsgSearchTerm::status
|
||||
const nsMsgSearchAttribValue Uint32HdrProperty = 51; // uses nsIMsgSearchTerm::hdrProperty
|
||||
|
@ -180,7 +179,6 @@ typedef struct nsMsgSearchValue
|
|||
nsMsgKey key;
|
||||
int32_t age; /* in days */
|
||||
nsIMsgFolder *folder;
|
||||
nsMsgLabelValue label;
|
||||
uint32_t junkStatus;
|
||||
uint32_t junkPercent;
|
||||
} u;
|
||||
|
@ -200,7 +198,7 @@ typedef struct nsMsgSearchValue
|
|||
_a == nsMsgSearchAttrib::MsgStatus || _a == nsMsgSearchAttrib::MessageKey || \
|
||||
_a == nsMsgSearchAttrib::Size || _a == nsMsgSearchAttrib::AgeInDays || \
|
||||
_a == nsMsgSearchAttrib::FolderInfo || _a == nsMsgSearchAttrib::Location || \
|
||||
_a == nsMsgSearchAttrib::Label || _a == nsMsgSearchAttrib::JunkStatus || \
|
||||
_a == nsMsgSearchAttrib::JunkStatus || \
|
||||
_a == nsMsgSearchAttrib::FolderFlag || _a == nsMsgSearchAttrib::Uint32HdrProperty || \
|
||||
_a == nsMsgSearchAttrib::JunkPercent || _a == nsMsgSearchAttrib::HasAttachmentStatus))
|
||||
%}
|
||||
|
|
|
@ -34,7 +34,6 @@ static const char* kWhitespace = "\b\t\r\n ";
|
|||
nsMsgRuleAction::nsMsgRuleAction()
|
||||
: m_type(nsMsgFilterAction::None),
|
||||
m_priority(nsMsgPriority::notSet),
|
||||
m_label(0),
|
||||
m_junkScore(0) {}
|
||||
|
||||
nsMsgRuleAction::~nsMsgRuleAction() {}
|
||||
|
@ -59,21 +58,6 @@ nsMsgRuleAction::GetPriority(nsMsgPriorityValue* aResult) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgRuleAction::SetLabel(nsMsgLabelValue aLabel) {
|
||||
NS_ENSURE_TRUE(m_type == nsMsgFilterAction::Label, NS_ERROR_ILLEGAL_VALUE);
|
||||
m_label = aLabel;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgRuleAction::GetLabel(nsMsgLabelValue* aResult) {
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
NS_ENSURE_TRUE(m_type == nsMsgFilterAction::Label, NS_ERROR_ILLEGAL_VALUE);
|
||||
*aResult = m_label;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgRuleAction::SetTargetFolderUri(const nsACString& aUri) {
|
||||
NS_ENSURE_TRUE(m_type == nsMsgFilterAction::MoveToFolder ||
|
||||
|
@ -765,12 +749,6 @@ nsresult nsMsgFilter::SaveRule(nsIOutputStream* aStream) {
|
|||
err = filterList->WriteStrAttr(nsIMsgFilterList::attribActionValue,
|
||||
priority.get(), aStream);
|
||||
} break;
|
||||
case nsMsgFilterAction::Label: {
|
||||
nsMsgLabelValue label;
|
||||
action->GetLabel(&label);
|
||||
err = filterList->WriteIntAttr(nsIMsgFilterList::attribActionValue,
|
||||
label, aStream);
|
||||
} break;
|
||||
case nsMsgFilterAction::JunkScore: {
|
||||
int32_t junkScore;
|
||||
action->GetJunkScore(&junkScore);
|
||||
|
@ -829,7 +807,6 @@ static struct RuleActionsTableEntry ruleActionsTable[] = {
|
|||
{nsMsgFilterAction::KillSubthread, "Ignore subthread"},
|
||||
{nsMsgFilterAction::WatchThread, "Watch thread"},
|
||||
{nsMsgFilterAction::MarkFlagged, "Mark flagged"},
|
||||
{nsMsgFilterAction::Label, "Label"},
|
||||
{nsMsgFilterAction::Reply, "Reply"},
|
||||
{nsMsgFilterAction::Forward, "Forward"},
|
||||
{nsMsgFilterAction::StopExecution, "Stop execution"},
|
||||
|
|
|
@ -27,7 +27,6 @@ class nsMsgRuleAction : public nsIMsgRuleAction {
|
|||
nsMsgRuleActionType m_type;
|
||||
// this used to be a union - why bother?
|
||||
nsMsgPriorityValue m_priority; /* priority to set rule to */
|
||||
nsMsgLabelValue m_label; /* label to set rule to */
|
||||
nsCString m_folderUri;
|
||||
int32_t m_junkScore; /* junk score (or arbitrary int value?) */
|
||||
// arbitrary string value. Currently, email address to forward to
|
||||
|
|
|
@ -668,16 +668,6 @@ nsresult nsMsgFilterList::LoadTextFilters(
|
|||
currentFilterAction->SetPriority(outPriority);
|
||||
else
|
||||
NS_ASSERTION(false, "invalid priority in filter file");
|
||||
} else if (type == nsMsgFilterAction::Label) {
|
||||
// upgrade label to corresponding tag/keyword
|
||||
nsresult res;
|
||||
int32_t labelInt = value.ToInteger(&res);
|
||||
if (NS_SUCCEEDED(res)) {
|
||||
nsAutoCString keyword("$label");
|
||||
keyword.Append('0' + labelInt);
|
||||
currentFilterAction->SetType(nsMsgFilterAction::AddTag);
|
||||
currentFilterAction->SetStrValue(keyword);
|
||||
}
|
||||
} else if (type == nsMsgFilterAction::JunkScore) {
|
||||
nsresult res;
|
||||
int32_t junkScore = value.ToInteger(&res);
|
||||
|
|
|
@ -833,12 +833,6 @@ nsresult nsMsgFilterAfterTheFact::ApplyFilter() {
|
|||
BREAK_ACTION_IF_FAILURE(rv, "Setting message flags failed");
|
||||
}
|
||||
} break;
|
||||
case nsMsgFilterAction::Label: {
|
||||
nsMsgLabelValue filterLabel;
|
||||
filterAction->GetLabel(&filterLabel);
|
||||
rv = curFolder->SetLabelForMessages(m_searchHitHdrs, filterLabel);
|
||||
BREAK_ACTION_IF_FAILURE(rv, "Setting message flags failed");
|
||||
} break;
|
||||
case nsMsgFilterAction::AddTag: {
|
||||
nsCString keyword;
|
||||
filterAction->GetStrValue(keyword);
|
||||
|
|
|
@ -501,22 +501,9 @@ nsresult nsMsgSearchOfflineMail::ProcessSearchTerm(
|
|||
err = aTerm->MatchAge(date, &result);
|
||||
break;
|
||||
}
|
||||
case nsMsgSearchAttrib::Label: {
|
||||
nsMsgLabelValue label;
|
||||
msgToMatch->GetLabel(&label);
|
||||
err = aTerm->MatchLabel(label, &result);
|
||||
break;
|
||||
}
|
||||
case nsMsgSearchAttrib::Keywords: {
|
||||
nsCString keywords;
|
||||
nsMsgLabelValue label;
|
||||
msgToMatch->GetStringProperty("keywords", getter_Copies(keywords));
|
||||
msgToMatch->GetLabel(&label);
|
||||
if (label >= 1) {
|
||||
if (!keywords.IsEmpty()) keywords.Append(' ');
|
||||
keywords.AppendLiteral("$label");
|
||||
keywords.Append(label + '0');
|
||||
}
|
||||
err = aTerm->MatchKeyword(keywords, &result);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -912,7 +912,6 @@ static struct {
|
|||
{nsMsgSearchAttrib::JunkPercent, "JunkPercent"},
|
||||
{nsMsgSearchAttrib::HasAttachmentStatus, "AttachmentStatus"},
|
||||
{nsMsgSearchAttrib::JunkStatus, "JunkStatus"},
|
||||
{nsMsgSearchAttrib::Label, "Label"},
|
||||
{nsMsgSearchAttrib::OtherHeader, "Customize"},
|
||||
// the last id is -1 to denote end of table
|
||||
{-1, ""}};
|
||||
|
|
|
@ -70,7 +70,6 @@ nsMsgSearchAttribEntry SearchAttribEntryTable[] = {
|
|||
{nsMsgSearchAttrib::ToOrCC, "to or cc"},
|
||||
{nsMsgSearchAttrib::AllAddresses, "all addresses"},
|
||||
{nsMsgSearchAttrib::AgeInDays, "age in days"},
|
||||
{nsMsgSearchAttrib::Label, "label"},
|
||||
{nsMsgSearchAttrib::Keywords, "tag"},
|
||||
{nsMsgSearchAttrib::Size, "size"},
|
||||
// this used to be nsMsgSearchAttrib::SenderInAddressBook
|
||||
|
@ -420,10 +419,6 @@ nsresult nsMsgSearchTerm::OutputValue(nsCString& outputStr) {
|
|||
outputStr.AppendInt(m_value.u.age);
|
||||
break;
|
||||
}
|
||||
case nsMsgSearchAttrib::Label: {
|
||||
outputStr.AppendInt(m_value.u.label);
|
||||
break;
|
||||
}
|
||||
case nsMsgSearchAttrib::JunkStatus: {
|
||||
outputStr.AppendInt(
|
||||
m_value.u.junkStatus); // only if we write to disk, right?
|
||||
|
@ -538,9 +533,6 @@ nsresult nsMsgSearchTerm::ParseValue(char* inStream) {
|
|||
case nsMsgSearchAttrib::AgeInDays:
|
||||
m_value.u.age = atoi(inStream);
|
||||
break;
|
||||
case nsMsgSearchAttrib::Label:
|
||||
m_value.u.label = atoi(inStream);
|
||||
break;
|
||||
case nsMsgSearchAttrib::JunkStatus:
|
||||
m_value.u.junkStatus =
|
||||
atoi(inStream); // only if we read from disk, right?
|
||||
|
@ -632,13 +624,6 @@ nsresult nsMsgSearchTerm::DeStreamNew(char* inStream, int16_t /*length*/) {
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
// convert label filters and saved searches to keyword equivalents
|
||||
if (secondCommaSep) ParseValue(secondCommaSep + 1);
|
||||
if (m_attribute == nsMsgSearchAttrib::Label) {
|
||||
nsAutoCString keyword("$label");
|
||||
m_value.attribute = m_attribute = nsMsgSearchAttrib::Keywords;
|
||||
keyword.Append('0' + m_value.u.label);
|
||||
m_value.utf8String = keyword;
|
||||
CopyUTF8toUTF16(keyword, m_value.utf16String);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1312,28 +1297,6 @@ nsresult nsMsgSearchTerm::MatchJunkPercent(uint32_t aJunkPercent,
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsMsgSearchTerm::MatchLabel(nsMsgLabelValue aLabelValue,
|
||||
bool* pResult) {
|
||||
NS_ENSURE_ARG_POINTER(pResult);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
bool result = false;
|
||||
switch (m_operator) {
|
||||
case nsMsgSearchOp::Is:
|
||||
if (m_value.u.label == aLabelValue) result = true;
|
||||
break;
|
||||
case nsMsgSearchOp::Isnt:
|
||||
if (m_value.u.label != aLabelValue) result = true;
|
||||
break;
|
||||
default:
|
||||
rv = NS_ERROR_FAILURE;
|
||||
NS_ERROR("invalid compare op for label value");
|
||||
}
|
||||
|
||||
*pResult = result;
|
||||
return rv;
|
||||
}
|
||||
|
||||
// MatchStatus () is not only used for nsMsgMessageFlags but also for
|
||||
// nsMsgFolderFlags (both being 'unsigned long')
|
||||
nsresult nsMsgSearchTerm::MatchStatus(uint32_t statusToMatch, bool* pResult) {
|
||||
|
@ -1782,9 +1745,6 @@ nsresult nsMsgResultElement::AssignValues(nsIMsgSearchValue* src,
|
|||
case nsMsgSearchAttrib::AgeInDays:
|
||||
rv = src->GetAge(&dst->u.age);
|
||||
break;
|
||||
case nsMsgSearchAttrib::Label:
|
||||
rv = src->GetLabel(&dst->u.label);
|
||||
break;
|
||||
case nsMsgSearchAttrib::JunkStatus:
|
||||
rv = src->GetJunkStatus(&dst->u.junkStatus);
|
||||
break;
|
||||
|
|
|
@ -26,7 +26,6 @@ NS_IMPL_GETSET(nsMsgSearchValueImpl, Age, int32_t, mValue.u.age)
|
|||
NS_IMPL_GETSET(nsMsgSearchValueImpl, Date, PRTime, mValue.u.date)
|
||||
NS_IMPL_GETSET(nsMsgSearchValueImpl, Attrib, nsMsgSearchAttribValue,
|
||||
mValue.attribute)
|
||||
NS_IMPL_GETSET(nsMsgSearchValueImpl, Label, nsMsgLabelValue, mValue.u.label)
|
||||
NS_IMPL_GETSET(nsMsgSearchValueImpl, JunkStatus, uint32_t, mValue.u.junkStatus)
|
||||
NS_IMPL_GETSET(nsMsgSearchValueImpl, JunkPercent, uint32_t,
|
||||
mValue.u.junkPercent)
|
||||
|
@ -79,7 +78,6 @@ nsMsgSearchValueImpl::ToString(nsAString& aResult) {
|
|||
case nsMsgSearchAttrib::Size:
|
||||
case nsMsgSearchAttrib::AgeInDays:
|
||||
case nsMsgSearchAttrib::FolderInfo:
|
||||
case nsMsgSearchAttrib::Label:
|
||||
case nsMsgSearchAttrib::JunkStatus:
|
||||
case nsMsgSearchAttrib::JunkPercent: {
|
||||
nsAutoString tempInt;
|
||||
|
|
|
@ -182,8 +182,6 @@ function TestSearchx(aFolder, aValue, aAttrib, aOp, aHitCount, onDone) {
|
|||
value.size = aValue;
|
||||
} else if (aAttrib == Ci.nsMsgSearchAttrib.AgeInDays) {
|
||||
value.age = aValue;
|
||||
} else if (aAttrib == Ci.nsMsgSearchAttrib.Label) {
|
||||
value.label = aValue;
|
||||
} else if (aAttrib == Ci.nsMsgSearchAttrib.JunkStatus) {
|
||||
value.junkStatus = aValue;
|
||||
} else if (aAttrib == Ci.nsMsgSearchAttrib.HasAttachmentStatus) {
|
||||
|
|
|
@ -82,8 +82,6 @@ function TestSearch(
|
|||
value.size = aValue;
|
||||
} else if (aAttrib == Ci.nsMsgSearchAttrib.AgeInDays) {
|
||||
value.age = aValue;
|
||||
} else if (aAttrib == Ci.nsMsgSearchAttrib.Label) {
|
||||
value.label = aValue;
|
||||
} else if (aAttrib == Ci.nsMsgSearchAttrib.JunkStatus) {
|
||||
value.junkStatus = aValue;
|
||||
} else if (aAttrib == Ci.nsMsgSearchAttrib.HasAttachmentStatus) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче