Bug 1683590 - Remove nsISupport use in nsIFolderListener.OnItemAdded/Removed callbacks. r=mkmelin

Breaks up OnItemAdded() and OnItemRemoved() into folder and message-specific
versions. Also tidies up naming of the callback functions in the .idl while
we're here e.g. OnItemEvent() becomes onFolderEvent().

Differential Revision: https://phabricator.services.mozilla.com/D126593

--HG--
extra : rebase_source : 09c95d139bc512626e7974b95b94fa91cead0ef6
This commit is contained in:
Ben Campbell 2021-10-01 12:46:34 +03:00
Родитель 12a249a80d
Коммит 19824555f1
41 изменённых файлов: 542 добавлений и 471 удалений

Просмотреть файл

@ -2745,12 +2745,9 @@ var gFolderTreeView = {
/**
* This is our implementation of nsIMsgFolderListener to watch for changes
*/
OnItemAdded(aParentItem, aItem) {
// Ignore this item if it's not a folder, or we knew about it.
if (
!(aItem instanceof Ci.nsIMsgFolder) ||
this.getIndexOfFolder(aItem) != null
) {
onFolderAdded(aParentItem, aItem) {
// Ignore this folder if we already know about it.
if (this.getIndexOfFolder(aItem) != null) {
return;
}
@ -2778,6 +2775,8 @@ var gFolderTreeView = {
}
},
onMessageAdded(parentFolder, msg) {},
addFolder(aParentItem, aItem) {
// This intentionally adds any new folder even if it would not pass the
// _filterFunction. The idea is that the user can add new folders even
@ -2825,11 +2824,7 @@ var gFolderTreeView = {
this._addChildToView(parent, parentIndex, newChild);
},
OnItemRemoved(aParentItem, aItem) {
if (!(aItem instanceof Ci.nsIMsgFolder)) {
return;
}
onFolderRemoved(aParentItem, aItem) {
let index = this.getIndexOfFolder(aItem);
if (index == null) {
return;
@ -2859,9 +2854,9 @@ var gFolderTreeView = {
gFolderDisplay.show();
}
},
OnItemPropertyChanged(aItem, aProperty, aOld, aNew) {},
OnItemIntPropertyChanged(aItem, aProperty, aOld, aNew) {
onMessageRemoved(parentFolder, msg) {},
onFolderPropertyChanged(aItem, aProperty, aOld, aNew) {},
onFolderIntPropertyChanged(aItem, aProperty, aOld, aNew) {
// First try mode specific handling of the changed property.
for (let mode of this.activeModes) {
if (
@ -2892,7 +2887,7 @@ var gFolderTreeView = {
}
},
OnItemBoolPropertyChanged(aItem, aProperty, aOld, aNew) {
onFolderBoolPropertyChanged(aItem, aProperty, aOld, aNew) {
let index = this.getIndexOfFolder(aItem);
if (index != null) {
this.clearFolderCacheProperty(aItem, "properties");
@ -2900,7 +2895,7 @@ var gFolderTreeView = {
}
},
OnItemUnicharPropertyChanged(aItem, aProperty, aOld, aNew) {
onFolderUnicharPropertyChanged(aItem, aProperty, aOld, aNew) {
let index = this.getIndexOfFolder(aItem);
if (index != null) {
this.clearFolderCacheProperty(aItem, "properties");
@ -2908,8 +2903,8 @@ var gFolderTreeView = {
}
},
OnItemPropertyFlagChanged(aItem, aProperty, aOld, aNew) {},
OnItemEvent(aFolder, aEvent) {
onFolderPropertyFlagChanged(aItem, aProperty, aOld, aNew) {},
onFolderEvent(aFolder, aEvent) {
let index = this.getIndexOfFolder(aFolder);
if (index != null) {
this.clearFolderCacheProperty(aFolder, "properties");

Просмотреть файл

@ -201,13 +201,14 @@ var gSummaryFrameManager;
// the folderListener object
var folderListener = {
OnItemAdded(parentItem, item) {},
onFolderAdded(parentFolder, child) {},
onMessageAdded(parentFolder, msg) {},
onFolderRemoved(parentFolder, child) {},
onMessageRemoved(parentFolder, msg) {},
OnItemRemoved(parentItem, item) {},
onFolderPropertyChanged(item, property, oldValue, newValue) {},
OnItemPropertyChanged(item, property, oldValue, newValue) {},
OnItemIntPropertyChanged(item, property, oldValue, newValue) {
onFolderIntPropertyChanged(item, property, oldValue, newValue) {
if (item == gFolderDisplay.displayedFolder) {
if (property == "TotalMessages" || property == "TotalUnreadMessages") {
UpdateStatusMessageCounts(gFolderDisplay.displayedFolder);
@ -215,12 +216,12 @@ var folderListener = {
}
},
OnItemBoolPropertyChanged(item, property, oldValue, newValue) {},
onFolderBoolPropertyChanged(item, property, oldValue, newValue) {},
OnItemUnicharPropertyChanged(item, property, oldValue, newValue) {},
OnItemPropertyFlagChanged(item, property, oldFlag, newFlag) {},
onFolderUnicharPropertyChanged(item, property, oldValue, newValue) {},
onFolderPropertyFlagChanged(item, property, oldFlag, newFlag) {},
OnItemEvent(folder, event) {
onFolderEvent(folder, event) {
if (event == "ImapHdrDownloaded") {
if (folder) {
var imapFolder = folder.QueryInterface(Ci.nsIMsgImapMailFolder);

Просмотреть файл

@ -71,7 +71,7 @@ var folderTracker = new (class extends EventEmitter {
// nsIFolderListener
OnItemIntPropertyChanged(item, property, oldValue, newValue) {
onFolderIntPropertyChanged(item, property, oldValue, newValue) {
if (!(item instanceof Ci.nsIMsgFolder)) {
return;
}

Просмотреть файл

@ -1843,7 +1843,7 @@ var messageTracker = new (class extends EventEmitter {
// nsIFolderListener
OnItemPropertyFlagChanged(item, property, oldFlag, newFlag) {
onFolderPropertyFlagChanged(item, property, oldFlag, newFlag) {
switch (property) {
case "Status":
if ((oldFlag ^ newFlag) & Ci.nsMsgMessageFlags.Read) {
@ -1865,7 +1865,7 @@ var messageTracker = new (class extends EventEmitter {
}
}
OnItemIntPropertyChanged(folder, property, oldValue, newValue) {
onFolderIntPropertyChanged(folder, property, oldValue, newValue) {
switch (property) {
case "BiffState":
if (newValue == Ci.nsIMsgFolder.nsMsgBiffState_NewMail) {

Просмотреть файл

@ -846,7 +846,7 @@ this.messages = class extends ExtensionAPI {
? Ci.nsIJunkMailPlugin.IS_SPAM_SCORE
: Ci.nsIJunkMailPlugin.IS_HAM_SCORE;
msgHdr.folder.setJunkScoreForMessages(msgs, score);
// nsIFolderListener::OnItemEvent is notified about changes through
// nsIFolderListener::OnFolderEvent is notified about changes through
// setJunkScoreForMessages(), but does not provide the actual message.
// nsIMsgFolderListener::msgsJunkStatusChanged is notified only by
// nsMsgDBView::ApplyCommandToIndices(). Since it only works on

Просмотреть файл

@ -201,7 +201,7 @@ var FolderNotificationHelper = {
}
},
OnItemEvent(aFolder, aEvent) {
onFolderEvent(aFolder, aEvent) {
if (aEvent == "FolderLoaded") {
let folderURI = aFolder.URI;
let widgets = this._pendingFolderUriToViewWrapperLists[folderURI];
@ -243,7 +243,7 @@ var FolderNotificationHelper = {
}
},
OnItemIntPropertyChanged(aFolder, aProperty, aOldValue, aNewValue) {
onFolderIntPropertyChanged(aFolder, aProperty, aOldValue, aNewValue) {
if (aProperty == "TotalMessages" || aProperty == "TotalUnreadMessages") {
this._notifyHelper(aFolder, "_messageCountsChanged");
}

Просмотреть файл

@ -2021,7 +2021,7 @@ var FolderListener = {
}
},
OnItemEvent(aFolder, aEvent) {
onFolderEvent(aFolder, aEvent) {
if (!this.watchingFor) {
return;
}
@ -2033,7 +2033,7 @@ var FolderListener = {
};
/**
* Plan to wait for an nsIFolderListener.OnItemEvent matching one of the
* Plan to wait for an nsIFolderListener.onFolderEvent matching one of the
* provided strings. Call this before you do the thing that triggers the
* event, then call |wait_for_folder_events| after the event. This ensures
* that we see the event, because it might be too late after you initiate

Просмотреть файл

@ -265,29 +265,28 @@
}
},
_itemAddedOrRemoved(item) {
if (!(item instanceof Ci.nsIMsgFolder)) {
return;
}
if (this._filterFunction && !this._filterFunction(item)) {
_folderAddedOrRemoved(folder) {
if (this._filterFunction && !this._filterFunction(folder)) {
return;
}
// xxx we can optimize this later
this._clearMenu(this._menu);
},
OnItemAdded(ParentItem, item) {
this._itemAddedOrRemoved(item);
onFolderAdded(parentFolder, child) {
this._folderAddedOrRemoved(child);
},
OnItemRemoved(ParentItem, item) {
this._itemAddedOrRemoved(item);
onMessageAdded(parentFolder, msg) {},
onFolderRemoved(parentFolder, child) {
this._folderAddedOrRemoved(child);
},
onMessageRemoved(parentFolder, msg) {},
// xxx I stole this listener list from nsMsgFolderDatasource.cpp, but
// someone should really document what events are fired when, so that
// we make sure we're updating at the right times.
OnItemPropertyChanged(item, property, old, newItem) {},
OnItemIntPropertyChanged(item, property, old, aNew) {
onFolderPropertyChanged(item, property, old, newItem) {},
onFolderIntPropertyChanged(item, property, old, aNew) {
if (item instanceof Ci.nsIMsgFolder) {
if (property == "FolderFlag") {
if (
@ -307,15 +306,15 @@
}
this._setCssSelectorsForItem(item);
},
OnItemBoolPropertyChanged(item, property, old, newItem) {
onFolderBoolPropertyChanged(item, property, old, newItem) {
this._setCssSelectorsForItem(item);
},
OnItemUnicharPropertyChanged(item, property, old, newItem) {
onFolderUnicharPropertyChanged(item, property, old, newItem) {
this._setCssSelectorsForItem(item);
},
OnItemPropertyFlagChanged(item, property, old, newItem) {},
onFolderPropertyFlagChanged(item, property, old, newItem) {},
OnItemEvent(folder, eventName) {
onFolderEvent(folder, eventName) {
if (eventName == "MRMTimeChanged") {
if (
this._menu.getAttribute("showRecent") != "true" ||

Просмотреть файл

@ -21,48 +21,50 @@ typedef unsigned long folderListenerNotifyFlagValue;
*/
[scriptable, uuid(f60ee1a2-6d81-422c-958f-d408b1b2daa7)]
interface nsIFolderListener : nsISupports {
// "added" flag covers adding both messages and child folders.
const folderListenerNotifyFlagValue added = 0x1;
void OnItemAdded(in nsIMsgFolder aParentItem,
in nsISupports aItem);
void onFolderAdded(in nsIMsgFolder parent, in nsIMsgFolder child);
void onMessageAdded(in nsIMsgFolder parent, in nsIMsgDBHdr msg);
// "removed" flag covers removing both messages and child folders.
const folderListenerNotifyFlagValue removed = 0x2;
void OnItemRemoved(in nsIMsgFolder aParentItem,
in nsISupports aItem);
void onFolderRemoved(in nsIMsgFolder parent, in nsIMsgFolder child);
void onMessageRemoved(in nsIMsgFolder parent, in nsIMsgDBHdr msg);
const folderListenerNotifyFlagValue propertyChanged = 0x4;
void OnItemPropertyChanged(in nsIMsgFolder aItem,
in ACString aProperty,
in AUTF8String aOldValue,
in AUTF8String aNewValue);
void onFolderPropertyChanged(in nsIMsgFolder folder,
in ACString property,
in AUTF8String oldValue,
in AUTF8String newValue);
const folderListenerNotifyFlagValue intPropertyChanged = 0x8;
// While this property handles long long (64bit wide) values,
// the Javascript engine will only pass values up to 2^53 to the consumers.
void OnItemIntPropertyChanged(in nsIMsgFolder aItem,
in ACString aProperty,
in long long aOldValue,
in long long aNewValue);
void onFolderIntPropertyChanged(in nsIMsgFolder folder,
in ACString property,
in long long oldValue,
in long long newValue);
const folderListenerNotifyFlagValue boolPropertyChanged = 0x10;
void OnItemBoolPropertyChanged(in nsIMsgFolder aItem,
in ACString aProperty,
in boolean aOldValue,
in boolean aNewValue);
void onFolderBoolPropertyChanged(in nsIMsgFolder folder,
in ACString property,
in boolean oldValue,
in boolean newValue);
const folderListenerNotifyFlagValue unicharPropertyChanged = 0x20;
void OnItemUnicharPropertyChanged(in nsIMsgFolder aItem,
in ACString aProperty,
in AString aOldValue,
in AString aNewValue);
void onFolderUnicharPropertyChanged(in nsIMsgFolder folder,
in ACString property,
in AString oldValue,
in AString newValue);
const folderListenerNotifyFlagValue propertyFlagChanged = 0x40;
void OnItemPropertyFlagChanged(in nsIMsgDBHdr aItem,
in ACString aProperty,
in unsigned long aOldFlag,
in unsigned long aNewFlag);
void onFolderPropertyFlagChanged(in nsIMsgDBHdr msg,
in ACString property,
in unsigned long oldFlag,
in unsigned long newFlag);
const folderListenerNotifyFlagValue event = 0x80;
void OnItemEvent(in nsIMsgFolder aItem, in ACString aEvent);
void onFolderEvent(in nsIMsgFolder folder, in ACString event);
const folderListenerNotifyFlagValue all = 0xFFFFFFFF;
};

Просмотреть файл

@ -218,7 +218,7 @@ interface nsIMsgFolderListener : nsISupports {
* Following this notification, the database will be closed, backed up
* (so that header properties can be propagated), and then rebuilt from the
* source. The rebuild is triggered by a call to updateFolder, so an
* nsIFolderListener OnItemEvent(folder, FolderLoaded atom) notification
* nsIFolderListener OnFolderEvent(folder, FolderLoaded atom) notification
* will be received if you want to know when this is all completed.
* Note: this event is only generated for Thunderbird because the event
* currently comes from Thunderbird-specific code.

Просмотреть файл

@ -120,31 +120,22 @@ class MailNotificationManager {
/**
* Following are nsIFolderListener interfaces. Do nothing about them.
*/
OnItemAdded() {}
OnItemRemoved() {}
OnItemPropertyChanged() {}
OnItemBoolPropertyChanged() {}
OnItemUnicharPropertyChanged() {}
OnItemPropertyFlagChanged() {}
OnItemEvent() {}
onFolderAdded() {}
onMessageAdded() {}
onFolderRemoved() {}
onMessageRemoved() {}
onFolderPropertyChanged() {}
/**
* The only nsIFolderListener interface we care about.
* @see nsIFolderListener
*/
OnItemIntPropertyChanged(folder, property, oldValue, newValue) {
onFolderIntPropertyChanged(folder, property, oldValue, newValue) {
if (!Services.prefs.getBoolPref("mail.biff.show_alert")) {
return;
}
this._logger.debug(
`OnItemIntPropertyChanged; property=${property}: ${oldValue} => ${newValue}, folder.URI=${folder.URI}`
`onFolderIntPropertyChanged; property=${property}: ${oldValue} => ${newValue}, folder.URI=${folder.URI}`
);
switch (property) {
@ -160,6 +151,10 @@ class MailNotificationManager {
break;
}
}
onFolderBoolPropertyChanged() {}
onFolderUnicharPropertyChanged() {}
onFolderPropertyFlagChanged() {}
onFolderEvent() {}
/**
* @see mozINewMailNotificationService

Просмотреть файл

@ -197,20 +197,13 @@ NewMailNotificationService.prototype = {
return shouldCount.data;
},
OnItemIntPropertyChanged(folder, property, oldValue, newValue) {
onFolderIntPropertyChanged(folder, property, oldValue, newValue) {
try {
if (property == "FolderSize") {
return;
}
this._log.trace(
"NMNS_OnItemIntPropertyChanged: folder " +
folder.URI +
" " +
property +
" " +
oldValue +
" " +
newValue
`Changed int ${property} of ${folder.folderURL}: ${oldValue} -> ${newValue}`
);
if (property == "BiffState") {
this._biffStateChanged(folder, oldValue, newValue);
@ -220,7 +213,7 @@ NewMailNotificationService.prototype = {
this._newMailReceived(folder, oldValue, newValue);
}
} catch (error) {
this._log.error("NMNS_OnItemIntPropertyChanged: exception " + error);
this._log.error("onFolderIntPropertyChanged: exception " + error);
}
},
@ -337,47 +330,43 @@ NewMailNotificationService.prototype = {
}
},
OnItemAdded(parentItem, item) {
if (item instanceof Ci.nsIMsgDBHdr) {
if (this.confirmShouldCount(item.folder)) {
this._log.trace(
"NMNS_OnItemAdded: item " +
item.folder.getUriForMsg(item) +
" added to " +
item.folder.folderURL
);
}
onFolderAdded(parentFolder, child) {
this._log.trace(
`Added child folder ${child.folderURL} to ${parentFolder.folderURL}`
);
},
onMessageAdded(parentFolder, msg) {
if (this.confirmShouldCount(msg.folder)) {
this._log.trace(`Added <${msg.messageId}> to ${msg.folder.folderURL}`);
}
},
OnItemPropertyFlagChanged(item, property, oldFlag, newFlag) {
if (item instanceof Ci.nsIMsgDBHdr) {
if (
oldFlag & Ci.nsMsgMessageFlags.New &&
!(newFlag & Ci.nsMsgMessageFlags.New)
) {
this._log.trace(
"NMNS_OnItemPropertyFlagChanged: item " +
item.folder.getUriForMsg(item) +
" marked read"
);
} else if (newFlag & Ci.nsMsgMessageFlags.New) {
this._log.trace(
"NMNS_OnItemPropertyFlagChanged: item " +
item.folder.getUriForMsg(item) +
" marked unread"
);
}
}
},
OnItemRemoved(parentItem, item) {
if (item instanceof Ci.nsIMsgDBHdr && !item.isRead) {
onFolderPropertyFlagChanged(msg, property, oldFlag, newFlag) {
if (
oldFlag & Ci.nsMsgMessageFlags.New &&
!(newFlag & Ci.nsMsgMessageFlags.New)
) {
this._log.trace(
"NMNS_OnItemRemoved: unread item " +
item.folder.getUriForMsg(item) +
" removed from " +
item.folder.folderURL
`<${msg.messageId}> marked read in ${msg.folder.folderURL}`
);
} else if (newFlag & Ci.nsMsgMessageFlags.New) {
this._log.trace(
`<${msg.messageId}> marked unread in ${msg.folder.folderURL}`
);
}
},
onFolderRemoved(parentFolder, child) {
this._log.trace(
`Removed child folder ${child.folderURL} from ${parentFolder.folderURL}`
);
},
onMessageRemoved(parentFolder, msg) {
if (!msg.isRead) {
this._log.trace(
`Removed unread <${msg.messageId}> from ${msg.folder.folderURL}`
);
}
},

Просмотреть файл

@ -2037,73 +2037,77 @@ nsMessenger::FormatFileSize(uint64_t aSize, bool aUseKB,
return ::FormatFileSize(aSize, aUseKB, aFormattedSize);
}
NS_IMETHODIMP nsMessenger::OnItemAdded(nsIMsgFolder* parentItem,
nsISupports* item) {
NS_IMETHODIMP nsMessenger::OnFolderAdded(nsIMsgFolder* parent,
nsIMsgFolder* child) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsMessenger::OnItemRemoved(nsIMsgFolder* parentItem,
nsISupports* item) {
NS_IMETHODIMP nsMessenger::OnMessageAdded(nsIMsgFolder* parent,
nsIMsgDBHdr* msg) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsMessenger::OnFolderRemoved(nsIMsgFolder* parent,
nsIMsgFolder* child) {
return NS_OK;
}
NS_IMETHODIMP nsMessenger::OnMessageRemoved(nsIMsgFolder* parent,
nsIMsgDBHdr* msgHdr) {
// check if this item is a message header that's in our history list. If so,
// remove it from the history list.
nsCOMPtr<nsIMsgDBHdr> msgHdr = do_QueryInterface(item);
if (msgHdr) {
nsCOMPtr<nsIMsgFolder> folder;
msgHdr->GetFolder(getter_AddRefs(folder));
if (folder) {
nsCString msgUri;
nsMsgKey msgKey;
msgHdr->GetMessageKey(&msgKey);
folder->GenerateMessageURI(msgKey, msgUri);
// need to remove the corresponding folder entry, and
// adjust the current history pos.
size_t uriPos = mLoadedMsgHistory.IndexOf(msgUri);
if (uriPos != mLoadedMsgHistory.NoIndex) {
mLoadedMsgHistory.RemoveElementAt(uriPos);
mLoadedMsgHistory.RemoveElementAt(uriPos); // and the folder uri entry
if (mCurHistoryPos >= (int32_t)uriPos) mCurHistoryPos -= 2;
}
nsCOMPtr<nsIMsgFolder> folder;
msgHdr->GetFolder(getter_AddRefs(folder));
if (folder) {
nsCString msgUri;
nsMsgKey msgKey;
msgHdr->GetMessageKey(&msgKey);
folder->GenerateMessageURI(msgKey, msgUri);
// need to remove the corresponding folder entry, and
// adjust the current history pos.
size_t uriPos = mLoadedMsgHistory.IndexOf(msgUri);
if (uriPos != mLoadedMsgHistory.NoIndex) {
mLoadedMsgHistory.RemoveElementAt(uriPos);
mLoadedMsgHistory.RemoveElementAt(uriPos); // and the folder uri entry
if (mCurHistoryPos >= (int32_t)uriPos) mCurHistoryPos -= 2;
}
}
return NS_OK;
}
NS_IMETHODIMP nsMessenger::OnItemPropertyChanged(nsIMsgFolder* item,
const nsACString& property,
const nsACString& oldValue,
const nsACString& newValue) {
NS_IMETHODIMP nsMessenger::OnFolderPropertyChanged(nsIMsgFolder* folder,
const nsACString& property,
const nsACString& oldValue,
const nsACString& newValue) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsMessenger::OnItemIntPropertyChanged(nsIMsgFolder* item,
const nsACString& property,
int64_t oldValue,
int64_t newValue) {
NS_IMETHODIMP nsMessenger::OnFolderIntPropertyChanged(
nsIMsgFolder* folder, const nsACString& property, int64_t oldValue,
int64_t newValue) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsMessenger::OnItemBoolPropertyChanged(nsIMsgFolder* item,
const nsACString& property,
bool oldValue,
bool newValue) {
NS_IMETHODIMP nsMessenger::OnFolderBoolPropertyChanged(
nsIMsgFolder* folder, const nsACString& property, bool oldValue,
bool newValue) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsMessenger::OnItemUnicharPropertyChanged(
nsIMsgFolder* item, const nsACString& property, const nsAString& oldValue,
NS_IMETHODIMP nsMessenger::OnFolderUnicharPropertyChanged(
nsIMsgFolder* folder, const nsACString& property, const nsAString& oldValue,
const nsAString& newValue) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsMessenger::OnItemPropertyFlagChanged(nsIMsgDBHdr* item,
const nsACString& property,
uint32_t oldFlag,
uint32_t newFlag) {
NS_IMETHODIMP nsMessenger::OnFolderPropertyFlagChanged(
nsIMsgDBHdr* msg, const nsACString& property, uint32_t oldFlag,
uint32_t newFlag) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsMessenger::OnItemEvent(nsIMsgFolder* item,
const nsACString& event) {
NS_IMETHODIMP nsMessenger::OnFolderEvent(nsIMsgFolder* folder,
const nsACString& event) {
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -128,7 +128,7 @@ nsMsgAccount::SetIncomingServer(nsIMsgIncomingServer* aIncomingServer) {
nsCOMPtr<nsIFolderListener> mailSession =
do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
mailSession->OnItemAdded(nullptr, rootFolder);
mailSession->OnFolderAdded(nullptr, rootFolder);
nsCOMPtr<nsIMsgFolderNotificationService> notifier(
do_GetService(NS_MSGNOTIFICATIONSERVICE_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
@ -145,7 +145,7 @@ nsMsgAccount::SetIncomingServer(nsIMsgIncomingServer* aIncomingServer) {
NS_ENSURE_SUCCESS(rv, rv);
for (nsIMsgFolder* msgFolder : subFolders) {
mailSession->OnItemAdded(rootFolder, msgFolder);
mailSession->OnFolderAdded(rootFolder, msgFolder);
notifier->NotifyFolderAdded(msgFolder);
}
}

Просмотреть файл

@ -505,11 +505,11 @@ nsMsgAccountManager::RemoveIncomingServer(nsIMsgIncomingServer* aServer,
if (mailSession) {
nsCOMPtr<nsIMsgFolder> parentFolder;
folder->GetParent(getter_AddRefs(parentFolder));
mailSession->OnItemRemoved(parentFolder, folder);
mailSession->OnFolderRemoved(parentFolder, folder);
}
}
if (notifier) notifier->NotifyFolderDeleted(rootFolder);
if (mailSession) mailSession->OnItemRemoved(nullptr, rootFolder);
if (mailSession) mailSession->OnFolderRemoved(nullptr, rootFolder);
removeListenersFromFolder(rootFolder);
NotifyServerUnloaded(aServer);
@ -2947,12 +2947,8 @@ NS_IMETHODIMP nsMsgAccountManager::GetAllFolders(
return NS_OK;
}
NS_IMETHODIMP nsMsgAccountManager::OnItemAdded(nsIMsgFolder* parentItem,
nsISupports* item) {
nsCOMPtr<nsIMsgFolder> folder = do_QueryInterface(item);
// just kick out with a success code if the item in question is not a folder
if (!folder) return NS_OK;
NS_IMETHODIMP nsMsgAccountManager::OnFolderAdded(nsIMsgFolder* parent,
nsIMsgFolder* folder) {
uint32_t folderFlags;
folder->GetFlags(&folderFlags);
bool addToSmartFolders = false;
@ -3028,10 +3024,10 @@ NS_IMETHODIMP nsMsgAccountManager::OnItemAdded(nsIMsgFolder* parentItem,
rv = folder->GetDescendants(allDescendants);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIMsgFolder> parent;
nsCOMPtr<nsIMsgFolder> parentFolder;
for (auto subFolder : allDescendants) {
subFolder->GetParent(getter_AddRefs(parent));
OnItemAdded(parent, subFolder);
subFolder->GetParent(getter_AddRefs(parentFolder));
OnFolderAdded(parentFolder, subFolder);
}
}
}
@ -3058,11 +3054,13 @@ NS_IMETHODIMP nsMsgAccountManager::OnItemAdded(nsIMsgFolder* parentItem,
return rv;
}
NS_IMETHODIMP nsMsgAccountManager::OnItemRemoved(nsIMsgFolder* parentItem,
nsISupports* item) {
nsCOMPtr<nsIMsgFolder> folder = do_QueryInterface(item);
// just kick out with a success code if the item in question is not a folder
if (!folder) return NS_OK;
NS_IMETHODIMP nsMsgAccountManager::OnMessageAdded(nsIMsgFolder* parent,
nsIMsgDBHdr* msg) {
return NS_OK;
}
NS_IMETHODIMP nsMsgAccountManager::OnFolderRemoved(nsIMsgFolder* parentFolder,
nsIMsgFolder* folder) {
nsresult rv = NS_OK;
uint32_t folderFlags;
folder->GetFlags(&folderFlags);
@ -3135,28 +3133,33 @@ NS_IMETHODIMP nsMsgAccountManager::OnItemRemoved(nsIMsgFolder* parentItem,
return rv;
}
NS_IMETHODIMP nsMsgAccountManager::OnItemPropertyChanged(
nsIMsgFolder* item, const nsACString& property, const nsACString& oldValue,
const nsACString& newValue) {
NS_IMETHODIMP nsMsgAccountManager::OnMessageRemoved(nsIMsgFolder* parent,
nsIMsgDBHdr* msg) {
return NS_OK;
}
NS_IMETHODIMP nsMsgAccountManager::OnFolderPropertyChanged(
nsIMsgFolder* folder, const nsACString& property,
const nsACString& oldValue, const nsACString& newValue) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsMsgAccountManager::OnItemIntPropertyChanged(nsIMsgFolder* aFolder,
const nsACString& aProperty,
int64_t oldValue,
int64_t newValue) {
nsMsgAccountManager::OnFolderIntPropertyChanged(nsIMsgFolder* aFolder,
const nsACString& aProperty,
int64_t oldValue,
int64_t newValue) {
if (aProperty.Equals(kFolderFlag)) {
uint32_t smartFlagsChanged =
(oldValue ^ newValue) &
(nsMsgFolderFlags::SpecialUse & ~nsMsgFolderFlags::Queue);
if (smartFlagsChanged) {
if (smartFlagsChanged & newValue) {
// if the smart folder flag was set, calling OnItemAdded will
// if the smart folder flag was set, calling OnFolderAdded will
// do the right thing.
nsCOMPtr<nsIMsgFolder> parent;
aFolder->GetParent(getter_AddRefs(parent));
return OnItemAdded(parent, aFolder);
return OnFolderAdded(parent, aFolder);
}
RemoveFolderFromSmartFolder(aFolder, smartFlagsChanged);
// sent|archive flag removed, remove sub-folders from smart folder.
@ -3224,26 +3227,26 @@ nsresult nsMsgAccountManager::RemoveFolderFromSmartFolder(
return NS_OK;
}
NS_IMETHODIMP nsMsgAccountManager::OnItemBoolPropertyChanged(
nsIMsgFolder* item, const nsACString& property, bool oldValue,
NS_IMETHODIMP nsMsgAccountManager::OnFolderBoolPropertyChanged(
nsIMsgFolder* folder, const nsACString& property, bool oldValue,
bool newValue) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsMsgAccountManager::OnItemUnicharPropertyChanged(
nsIMsgFolder* item, const nsACString& property, const nsAString& oldValue,
NS_IMETHODIMP nsMsgAccountManager::OnFolderUnicharPropertyChanged(
nsIMsgFolder* folder, const nsACString& property, const nsAString& oldValue,
const nsAString& newValue) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsMsgAccountManager::OnItemPropertyFlagChanged(
nsIMsgDBHdr* item, const nsACString& property, uint32_t oldFlag,
NS_IMETHODIMP nsMsgAccountManager::OnFolderPropertyFlagChanged(
nsIMsgDBHdr* msg, const nsACString& property, uint32_t oldFlag,
uint32_t newFlag) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsMsgAccountManager::OnItemEvent(nsIMsgFolder* aFolder,
const nsACString& aEvent) {
NS_IMETHODIMP nsMsgAccountManager::OnFolderEvent(nsIMsgFolder* aFolder,
const nsACString& aEvent) {
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -4438,7 +4438,7 @@ NS_IMETHODIMP
nsMsgDBFolder::NotifyPropertyChanged(const nsACString& aProperty,
const nsACString& aOldValue,
const nsACString& aNewValue) {
NOTIFY_LISTENERS(OnItemPropertyChanged,
NOTIFY_LISTENERS(OnFolderPropertyChanged,
(this, aProperty, aOldValue, aNewValue));
// Notify listeners who listen to every folder
@ -4446,15 +4446,15 @@ nsMsgDBFolder::NotifyPropertyChanged(const nsACString& aProperty,
nsCOMPtr<nsIFolderListener> folderListenerManager =
do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
return folderListenerManager->OnItemPropertyChanged(this, aProperty,
aOldValue, aNewValue);
return folderListenerManager->OnFolderPropertyChanged(this, aProperty,
aOldValue, aNewValue);
}
NS_IMETHODIMP
nsMsgDBFolder::NotifyUnicharPropertyChanged(const nsACString& aProperty,
const nsAString& aOldValue,
const nsAString& aNewValue) {
NOTIFY_LISTENERS(OnItemUnicharPropertyChanged,
NOTIFY_LISTENERS(OnFolderUnicharPropertyChanged,
(this, aProperty, aOldValue, aNewValue));
// Notify listeners who listen to every folder
@ -4462,7 +4462,7 @@ nsMsgDBFolder::NotifyUnicharPropertyChanged(const nsACString& aProperty,
nsCOMPtr<nsIFolderListener> folderListenerManager =
do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
return folderListenerManager->OnItemUnicharPropertyChanged(
return folderListenerManager->OnFolderUnicharPropertyChanged(
this, aProperty, aOldValue, aNewValue);
}
@ -4474,7 +4474,7 @@ nsMsgDBFolder::NotifyIntPropertyChanged(const nsACString& aProperty,
aProperty.Equals(kTotalUnreadMessages)))
return NS_OK;
NOTIFY_LISTENERS(OnItemIntPropertyChanged,
NOTIFY_LISTENERS(OnFolderIntPropertyChanged,
(this, aProperty, aOldValue, aNewValue));
// Notify listeners who listen to every folder
@ -4482,14 +4482,14 @@ nsMsgDBFolder::NotifyIntPropertyChanged(const nsACString& aProperty,
nsCOMPtr<nsIFolderListener> folderListenerManager =
do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
return folderListenerManager->OnItemIntPropertyChanged(this, aProperty,
aOldValue, aNewValue);
return folderListenerManager->OnFolderIntPropertyChanged(
this, aProperty, aOldValue, aNewValue);
}
NS_IMETHODIMP
nsMsgDBFolder::NotifyBoolPropertyChanged(const nsACString& aProperty,
bool aOldValue, bool aNewValue) {
NOTIFY_LISTENERS(OnItemBoolPropertyChanged,
NOTIFY_LISTENERS(OnFolderBoolPropertyChanged,
(this, aProperty, aOldValue, aNewValue));
// Notify listeners who listen to every folder
@ -4497,8 +4497,8 @@ nsMsgDBFolder::NotifyBoolPropertyChanged(const nsACString& aProperty,
nsCOMPtr<nsIFolderListener> folderListenerManager =
do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
return folderListenerManager->OnItemBoolPropertyChanged(this, aProperty,
aOldValue, aNewValue);
return folderListenerManager->OnFolderBoolPropertyChanged(
this, aProperty, aOldValue, aNewValue);
}
NS_IMETHODIMP
@ -4506,7 +4506,7 @@ nsMsgDBFolder::NotifyPropertyFlagChanged(nsIMsgDBHdr* aItem,
const nsACString& aProperty,
uint32_t aOldValue,
uint32_t aNewValue) {
NOTIFY_LISTENERS(OnItemPropertyFlagChanged,
NOTIFY_LISTENERS(OnFolderPropertyFlagChanged,
(aItem, aProperty, aOldValue, aNewValue));
// Notify listeners who listen to every folder
@ -4514,67 +4514,67 @@ nsMsgDBFolder::NotifyPropertyFlagChanged(nsIMsgDBHdr* aItem,
nsCOMPtr<nsIFolderListener> folderListenerManager =
do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
return folderListenerManager->OnItemPropertyFlagChanged(aItem, aProperty,
aOldValue, aNewValue);
return folderListenerManager->OnFolderPropertyFlagChanged(
aItem, aProperty, aOldValue, aNewValue);
}
NS_IMETHODIMP nsMsgDBFolder::NotifyMessageAdded(nsIMsgDBHdr* msg) {
// Notify our directly-registered listeners.
NOTIFY_LISTENERS(OnItemAdded, (this, msg));
NOTIFY_LISTENERS(OnMessageAdded, (this, msg));
// Notify listeners who listen to every folder
nsresult rv;
nsCOMPtr<nsIFolderListener> folderListenerManager =
do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
rv = folderListenerManager->OnItemAdded(this, msg);
rv = folderListenerManager->OnMessageAdded(this, msg);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
}
nsresult nsMsgDBFolder::NotifyMessageRemoved(nsIMsgDBHdr* msg) {
// Notify our directly-registered listeners.
NOTIFY_LISTENERS(OnItemRemoved, (this, msg));
NOTIFY_LISTENERS(OnMessageRemoved, (this, msg));
// Notify listeners who listen to every folder
nsresult rv;
nsCOMPtr<nsIFolderListener> folderListenerManager =
do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
rv = folderListenerManager->OnItemRemoved(this, msg);
rv = folderListenerManager->OnMessageRemoved(this, msg);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
}
NS_IMETHODIMP nsMsgDBFolder::NotifyFolderAdded(nsIMsgFolder* child) {
NOTIFY_LISTENERS(OnItemAdded, (this, child));
NOTIFY_LISTENERS(OnFolderAdded, (this, child));
// Notify listeners who listen to every folder
nsresult rv;
nsCOMPtr<nsIFolderListener> folderListenerManager =
do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
return folderListenerManager->OnItemAdded(this, child);
return folderListenerManager->OnFolderAdded(this, child);
}
nsresult nsMsgDBFolder::NotifyFolderRemoved(nsIMsgFolder* child) {
NOTIFY_LISTENERS(OnItemRemoved, (this, child));
NOTIFY_LISTENERS(OnFolderRemoved, (this, child));
// Notify listeners who listen to every folder
nsresult rv;
nsCOMPtr<nsIFolderListener> folderListenerManager =
do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
return folderListenerManager->OnItemRemoved(this, child);
return folderListenerManager->OnFolderRemoved(this, child);
}
nsresult nsMsgDBFolder::NotifyFolderEvent(const nsACString& aEvent) {
NOTIFY_LISTENERS(OnItemEvent, (this, aEvent));
NOTIFY_LISTENERS(OnFolderEvent, (this, aEvent));
// Notify listeners who listen to every folder
nsresult rv;
nsCOMPtr<nsIFolderListener> folderListenerManager =
do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
return folderListenerManager->OnItemEvent(this, aEvent);
return folderListenerManager->OnFolderEvent(this, aEvent);
}
NS_IMETHODIMP

Просмотреть файл

@ -83,69 +83,81 @@ NS_IMETHODIMP nsMsgMailSession::RemoveFolderListener(
PR_END_MACRO
NS_IMETHODIMP
nsMsgMailSession::OnItemPropertyChanged(nsIMsgFolder* aItem,
const nsACString& aProperty,
const nsACString& aOldValue,
const nsACString& aNewValue) {
NOTIFY_FOLDER_LISTENERS(propertyChanged, OnItemPropertyChanged,
nsMsgMailSession::OnFolderPropertyChanged(nsIMsgFolder* aItem,
const nsACString& aProperty,
const nsACString& aOldValue,
const nsACString& aNewValue) {
NOTIFY_FOLDER_LISTENERS(propertyChanged, OnFolderPropertyChanged,
(aItem, aProperty, aOldValue, aNewValue));
return NS_OK;
}
NS_IMETHODIMP
nsMsgMailSession::OnItemUnicharPropertyChanged(nsIMsgFolder* aItem,
const nsACString& aProperty,
const nsAString& aOldValue,
const nsAString& aNewValue) {
NOTIFY_FOLDER_LISTENERS(unicharPropertyChanged, OnItemUnicharPropertyChanged,
nsMsgMailSession::OnFolderUnicharPropertyChanged(nsIMsgFolder* aItem,
const nsACString& aProperty,
const nsAString& aOldValue,
const nsAString& aNewValue) {
NOTIFY_FOLDER_LISTENERS(unicharPropertyChanged,
OnFolderUnicharPropertyChanged,
(aItem, aProperty, aOldValue, aNewValue));
return NS_OK;
}
NS_IMETHODIMP
nsMsgMailSession::OnItemIntPropertyChanged(nsIMsgFolder* aItem,
const nsACString& aProperty,
int64_t aOldValue,
int64_t aNewValue) {
NOTIFY_FOLDER_LISTENERS(intPropertyChanged, OnItemIntPropertyChanged,
nsMsgMailSession::OnFolderIntPropertyChanged(nsIMsgFolder* aItem,
const nsACString& aProperty,
int64_t aOldValue,
int64_t aNewValue) {
NOTIFY_FOLDER_LISTENERS(intPropertyChanged, OnFolderIntPropertyChanged,
(aItem, aProperty, aOldValue, aNewValue));
return NS_OK;
}
NS_IMETHODIMP
nsMsgMailSession::OnItemBoolPropertyChanged(nsIMsgFolder* aItem,
const nsACString& aProperty,
bool aOldValue, bool aNewValue) {
NOTIFY_FOLDER_LISTENERS(boolPropertyChanged, OnItemBoolPropertyChanged,
nsMsgMailSession::OnFolderBoolPropertyChanged(nsIMsgFolder* aItem,
const nsACString& aProperty,
bool aOldValue, bool aNewValue) {
NOTIFY_FOLDER_LISTENERS(boolPropertyChanged, OnFolderBoolPropertyChanged,
(aItem, aProperty, aOldValue, aNewValue));
return NS_OK;
}
NS_IMETHODIMP
nsMsgMailSession::OnItemPropertyFlagChanged(nsIMsgDBHdr* aItem,
const nsACString& aProperty,
uint32_t aOldValue,
uint32_t aNewValue) {
NOTIFY_FOLDER_LISTENERS(propertyFlagChanged, OnItemPropertyFlagChanged,
nsMsgMailSession::OnFolderPropertyFlagChanged(nsIMsgDBHdr* aItem,
const nsACString& aProperty,
uint32_t aOldValue,
uint32_t aNewValue) {
NOTIFY_FOLDER_LISTENERS(propertyFlagChanged, OnFolderPropertyFlagChanged,
(aItem, aProperty, aOldValue, aNewValue));
return NS_OK;
}
NS_IMETHODIMP nsMsgMailSession::OnItemAdded(nsIMsgFolder* aParentItem,
nsISupports* aItem) {
NOTIFY_FOLDER_LISTENERS(added, OnItemAdded, (aParentItem, aItem));
NS_IMETHODIMP nsMsgMailSession::OnFolderAdded(nsIMsgFolder* parent,
nsIMsgFolder* child) {
NOTIFY_FOLDER_LISTENERS(added, OnFolderAdded, (parent, child));
return NS_OK;
}
NS_IMETHODIMP nsMsgMailSession::OnMessageAdded(nsIMsgFolder* parent,
nsIMsgDBHdr* msg) {
NOTIFY_FOLDER_LISTENERS(added, OnMessageAdded, (parent, msg));
return NS_OK;
}
NS_IMETHODIMP nsMsgMailSession::OnItemRemoved(nsIMsgFolder* aParentItem,
nsISupports* aItem) {
NOTIFY_FOLDER_LISTENERS(removed, OnItemRemoved, (aParentItem, aItem));
NS_IMETHODIMP nsMsgMailSession::OnFolderRemoved(nsIMsgFolder* parent,
nsIMsgFolder* child) {
NOTIFY_FOLDER_LISTENERS(removed, OnFolderRemoved, (parent, child));
return NS_OK;
}
NS_IMETHODIMP nsMsgMailSession::OnItemEvent(nsIMsgFolder* aFolder,
const nsACString& aEvent) {
NOTIFY_FOLDER_LISTENERS(event, OnItemEvent, (aFolder, aEvent));
NS_IMETHODIMP nsMsgMailSession::OnMessageRemoved(nsIMsgFolder* parent,
nsIMsgDBHdr* msg) {
NOTIFY_FOLDER_LISTENERS(removed, OnMessageRemoved, (parent, msg));
return NS_OK;
}
NS_IMETHODIMP nsMsgMailSession::OnFolderEvent(nsIMsgFolder* aFolder,
const nsACString& aEvent) {
NOTIFY_FOLDER_LISTENERS(event, OnFolderEvent, (aFolder, aEvent));
return NS_OK;
}
@ -174,7 +186,7 @@ NS_IMETHODIMP
nsMsgMailSession::AlertUser(const nsAString& aMessage,
nsIMsgMailNewsUrl* aUrl) {
bool listenersNotified = false;
nsTObserverArray<nsCOMPtr<nsIMsgUserFeedbackListener> >::ForwardIterator iter(
nsTObserverArray<nsCOMPtr<nsIMsgUserFeedbackListener>>::ForwardIterator iter(
mFeedbackListeners);
nsCOMPtr<nsIMsgUserFeedbackListener> listener;

Просмотреть файл

@ -142,30 +142,41 @@ nsresult nsStatusBarBiffManager::PlayBiffSound(const char* aPrefBranch) {
// nsIFolderListener methods....
NS_IMETHODIMP
nsStatusBarBiffManager::OnItemAdded(nsIMsgFolder* parentItem,
nsISupports* item) {
nsStatusBarBiffManager::OnFolderAdded(nsIMsgFolder* parent,
nsIMsgFolder* child) {
return NS_OK;
}
NS_IMETHODIMP
nsStatusBarBiffManager::OnItemRemoved(nsIMsgFolder* parentItem,
nsISupports* item) {
nsStatusBarBiffManager::OnMessageAdded(nsIMsgFolder* parent, nsIMsgDBHdr* msg) {
return NS_OK;
}
NS_IMETHODIMP
nsStatusBarBiffManager::OnItemPropertyChanged(nsIMsgFolder* item,
const nsACString& property,
const nsACString& oldValue,
const nsACString& newValue) {
nsStatusBarBiffManager::OnFolderRemoved(nsIMsgFolder* parent,
nsIMsgFolder* child) {
return NS_OK;
}
NS_IMETHODIMP
nsStatusBarBiffManager::OnItemIntPropertyChanged(nsIMsgFolder* item,
const nsACString& property,
int64_t oldValue,
int64_t newValue) {
nsStatusBarBiffManager::OnMessageRemoved(nsIMsgFolder* parent,
nsIMsgDBHdr* msg) {
return NS_OK;
}
NS_IMETHODIMP
nsStatusBarBiffManager::OnFolderPropertyChanged(nsIMsgFolder* folder,
const nsACString& property,
const nsACString& oldValue,
const nsACString& newValue) {
return NS_OK;
}
NS_IMETHODIMP
nsStatusBarBiffManager::OnFolderIntPropertyChanged(nsIMsgFolder* folder,
const nsACString& property,
int64_t oldValue,
int64_t newValue) {
if (property.Equals(kBiffState) && mCurrentBiffState != newValue) {
// if we got new mail, attempt to play a sound.
// if we fail along the way, don't return.
@ -173,7 +184,7 @@ nsStatusBarBiffManager::OnItemIntPropertyChanged(nsIMsgFolder* item,
if (newValue == nsIMsgFolder::nsMsgBiffState_NewMail) {
// Get the folder's server type.
nsCOMPtr<nsIMsgIncomingServer> server;
nsresult rv = item->GetServer(getter_AddRefs(server));
nsresult rv = folder->GetServer(getter_AddRefs(server));
if (NS_SUCCEEDED(rv) && server) server->GetType(mServerType);
// if we fail to play the biff sound, keep going.
@ -196,31 +207,31 @@ nsStatusBarBiffManager::OnItemIntPropertyChanged(nsIMsgFolder* item,
}
NS_IMETHODIMP
nsStatusBarBiffManager::OnItemBoolPropertyChanged(nsIMsgFolder* item,
const nsACString& property,
bool oldValue,
bool newValue) {
nsStatusBarBiffManager::OnFolderBoolPropertyChanged(nsIMsgFolder* folder,
const nsACString& property,
bool oldValue,
bool newValue) {
return NS_OK;
}
NS_IMETHODIMP
nsStatusBarBiffManager::OnItemUnicharPropertyChanged(
nsIMsgFolder* item, const nsACString& property, const nsAString& oldValue,
nsStatusBarBiffManager::OnFolderUnicharPropertyChanged(
nsIMsgFolder* folder, const nsACString& property, const nsAString& oldValue,
const nsAString& newValue) {
return NS_OK;
}
NS_IMETHODIMP
nsStatusBarBiffManager::OnItemPropertyFlagChanged(nsIMsgDBHdr* item,
const nsACString& property,
uint32_t oldFlag,
uint32_t newFlag) {
nsStatusBarBiffManager::OnFolderPropertyFlagChanged(nsIMsgDBHdr* msg,
const nsACString& property,
uint32_t oldFlag,
uint32_t newFlag) {
return NS_OK;
}
NS_IMETHODIMP
nsStatusBarBiffManager::OnItemEvent(nsIMsgFolder* item,
const nsACString& event) {
nsStatusBarBiffManager::OnFolderEvent(nsIMsgFolder* folder,
const nsACString& event) {
return NS_OK;
}

Просмотреть файл

@ -210,7 +210,7 @@ function CreateVirtualFolder(
// use acctMgr to setup the virtual folder listener
var acctMgr = MailServices.accounts.QueryInterface(Ci.nsIFolderListener);
// print(acctMgr);
acctMgr.OnItemAdded(null, newFolder);
acctMgr.onFolderAdded(parentFolder, newFolder);
return newFolder;
}

Просмотреть файл

@ -84,7 +84,7 @@ add_test(function testNotifyInbox() {
let notif = MailServices.newMailNotification.wrappedJSObject;
notif.addListener(mockListener, iNMNS.count);
notif.OnItemIntPropertyChanged(folder, "TotalUnreadMessages", 0, 2);
notif.onFolderIntPropertyChanged(folder, "TotalUnreadMessages", 0, 2);
Assert.ok(notified);
// Special folders should never count
@ -93,7 +93,7 @@ add_test(function testNotifyInbox() {
flags: Ci.nsMsgFolderFlags.Mail | Ci.nsMsgFolderFlags.Junk,
};
notified = false;
notif.OnItemIntPropertyChanged(special, "TotalUnreadMessages", 0, 2);
notif.onFolderIntPropertyChanged(special, "TotalUnreadMessages", 0, 2);
Assert.ok(!notified);
// by default, non-inbox should not count
@ -102,13 +102,13 @@ add_test(function testNotifyInbox() {
flags: Ci.nsMsgFolderFlags.Mail,
};
notified = false;
notif.OnItemIntPropertyChanged(nonInbox, "TotalUnreadMessages", 0, 2);
notif.onFolderIntPropertyChanged(nonInbox, "TotalUnreadMessages", 0, 2);
Assert.ok(!notified);
// Try setting the pref to count non-inboxes and notifying a non-inbox
Services.prefs.setBoolPref(countInboxesPref, false);
notified = false;
notif.OnItemIntPropertyChanged(nonInbox, "TotalUnreadMessages", 0, 2);
notif.onFolderIntPropertyChanged(nonInbox, "TotalUnreadMessages", 0, 2);
Assert.ok(notified);
run_next_test();

Просмотреть файл

@ -14,14 +14,16 @@ load("../../../resources/MessageGenerator.jsm");
load("../../../resources/messageInjection.js");
var folderListener = {
OnItemAdded() {},
OnItemRemoved() {},
OnItemPropertyChanged() {},
OnItemIntPropertyChanged() {},
OnItemBoolPropertyChanged() {},
OnItemUnicharPropertyChanged() {},
OnItemPropertyFlagChanged() {},
OnItemEvent() {},
onFolderAdded() {},
onMessageAdded() {},
onFolderRemoved() {},
onMessageRemoved() {},
onFolderPropertyChanged() {},
onFolderIntPropertyChanged() {},
onFolderBoolPropertyChanged() {},
onFolderUnicharPropertyChanged() {},
onFolderPropertyFlagChanged() {},
onFolderEvent() {},
};
var targetFolder;

Просмотреть файл

@ -24,49 +24,61 @@ fL.prototype = {
mReceived: 0,
mAutoRemoveItem: false,
OnItemAdded(parentItem, item) {
onFolderAdded(parentFolder, child) {
this.mReceived |= Ci.nsIFolderListener.added;
if (this.mAutoRemoveItem) {
MailServices.mailSession.RemoveFolderListener(this);
}
},
OnItemRemoved(parentItem, item) {
onMessageAdded(parentFolder, msg) {
this.mReceived |= Ci.nsIFolderListener.added;
if (this.mAutoRemoveItem) {
MailServices.mailSession.RemoveFolderListener(this);
}
},
onFolderRemoved(parentFolder, child) {
this.mReceived |= Ci.nsIFolderListener.removed;
if (this.mAutoRemoveItem) {
MailServices.mailSession.RemoveFolderListener(this);
}
},
OnItemPropertyChanged(item, property, oldValue, newValue) {
onMessageRemoved(parentFolder, msg) {
this.mReceived |= Ci.nsIFolderListener.removed;
if (this.mAutoRemoveItem) {
MailServices.mailSession.RemoveFolderListener(this);
}
},
onFolderPropertyChanged(item, property, oldValue, newValue) {
this.mReceived |= Ci.nsIFolderListener.propertyChanged;
if (this.mAutoRemoveItem) {
MailServices.mailSession.RemoveFolderListener(this);
}
},
OnItemIntPropertyChanged(item, property, oldValue, newValue) {
onFolderIntPropertyChanged(item, property, oldValue, newValue) {
this.mReceived |= Ci.nsIFolderListener.intPropertyChanged;
if (this.mAutoRemoveItem) {
MailServices.mailSession.RemoveFolderListener(this);
}
},
OnItemBoolPropertyChanged(item, property, oldValue, newValue) {
onFolderBoolPropertyChanged(item, property, oldValue, newValue) {
this.mReceived |= Ci.nsIFolderListener.boolPropertyChanged;
if (this.mAutoRemoveItem) {
MailServices.mailSession.RemoveFolderListener(this);
}
},
OnItemUnicharPropertyChanged(item, property, oldValue, newValue) {
onFolderUnicharPropertyChanged(item, property, oldValue, newValue) {
this.mReceived |= Ci.nsIFolderListener.unicharPropertyChanged;
if (this.mAutoRemoveItem) {
MailServices.mailSession.RemoveFolderListener(this);
}
},
OnItemPropertyFlagChanged(item, property, oldValue, newValue) {
onFolderPropertyFlagChanged(item, property, oldValue, newValue) {
this.mReceived |= Ci.nsIFolderListener.propertyFlagChanged;
if (this.mAutoRemoveItem) {
MailServices.mailSession.RemoveFolderListener(this);
}
},
OnItemEvent(parentItem, item) {
onFolderEvent(parentItem, item) {
this.mReceived |= Ci.nsIFolderListener.event;
if (this.mAutoRemoveItem) {
MailServices.mailSession.RemoveFolderListener(this);
@ -75,14 +87,16 @@ fL.prototype = {
};
function NotifyMailSession() {
gMailSessionNotifier.OnItemAdded(null, null);
gMailSessionNotifier.OnItemRemoved(null, null);
gMailSessionNotifier.OnItemPropertyChanged(null, null, null, null);
gMailSessionNotifier.OnItemIntPropertyChanged(null, null, null, null);
gMailSessionNotifier.OnItemBoolPropertyChanged(null, null, null, null);
gMailSessionNotifier.OnItemUnicharPropertyChanged(null, null, null, null);
gMailSessionNotifier.OnItemPropertyFlagChanged(null, null, null, null);
gMailSessionNotifier.OnItemEvent(null, null);
gMailSessionNotifier.onFolderAdded(null, null);
gMailSessionNotifier.onMessageAdded(null, null);
gMailSessionNotifier.onFolderRemoved(null, null);
gMailSessionNotifier.onMessageRemoved(null, null);
gMailSessionNotifier.onFolderPropertyChanged(null, null, null, null);
gMailSessionNotifier.onFolderIntPropertyChanged(null, null, null, null);
gMailSessionNotifier.onFolderBoolPropertyChanged(null, null, null, null);
gMailSessionNotifier.onFolderUnicharPropertyChanged(null, null, null, null);
gMailSessionNotifier.onFolderPropertyFlagChanged(null, null, null, null);
gMailSessionNotifier.onFolderEvent(null, null);
}
function run_test() {

Просмотреть файл

@ -1279,8 +1279,7 @@ nsresult nsMsgSendLater::GetIdentityFromKey(const char* aKey,
return rv;
}
NS_IMETHODIMP
nsMsgSendLater::OnItemAdded(nsIMsgFolder* aParentItem, nsISupports* aItem) {
nsresult nsMsgSendLater::StartTimer() {
// No need to trigger if timer is already set
if (mTimerSet) return NS_OK;
@ -1304,50 +1303,69 @@ nsMsgSendLater::OnItemAdded(nsIMsgFolder* aParentItem, nsISupports* aItem) {
}
NS_IMETHODIMP
nsMsgSendLater::OnItemRemoved(nsIMsgFolder* aParentItem, nsISupports* aItem) {
nsMsgSendLater::OnFolderAdded(nsIMsgFolder* /*parent*/,
nsIMsgFolder* /*child*/) {
return StartTimer();
}
NS_IMETHODIMP
nsMsgSendLater::OnMessageAdded(nsIMsgFolder* /*parent*/, nsIMsgDBHdr* /*msg*/) {
return StartTimer();
}
NS_IMETHODIMP
nsMsgSendLater::OnFolderRemoved(nsIMsgFolder* /*parent*/,
nsIMsgFolder* /*child*/) {
return NS_OK;
}
NS_IMETHODIMP
nsMsgSendLater::OnItemPropertyChanged(nsIMsgFolder* aItem,
const nsACString& aProperty,
const nsACString& aOldValue,
const nsACString& aNewValue) {
nsMsgSendLater::OnMessageRemoved(nsIMsgFolder* /*parent*/,
nsIMsgDBHdr* /*msg*/) {
return NS_OK;
}
NS_IMETHODIMP
nsMsgSendLater::OnItemIntPropertyChanged(nsIMsgFolder* aItem,
const nsACString& aProperty,
int64_t aOldValue, int64_t aNewValue) {
nsMsgSendLater::OnFolderPropertyChanged(nsIMsgFolder* aFolder,
const nsACString& aProperty,
const nsACString& aOldValue,
const nsACString& aNewValue) {
return NS_OK;
}
NS_IMETHODIMP
nsMsgSendLater::OnItemBoolPropertyChanged(nsIMsgFolder* aItem,
const nsACString& aProperty,
bool aOldValue, bool aNewValue) {
nsMsgSendLater::OnFolderIntPropertyChanged(nsIMsgFolder* aFolder,
const nsACString& aProperty,
int64_t aOldValue,
int64_t aNewValue) {
return NS_OK;
}
NS_IMETHODIMP
nsMsgSendLater::OnItemUnicharPropertyChanged(nsIMsgFolder* aItem,
const nsACString& aProperty,
const nsAString& aOldValue,
const nsAString& aNewValue) {
nsMsgSendLater::OnFolderBoolPropertyChanged(nsIMsgFolder* aFolder,
const nsACString& aProperty,
bool aOldValue, bool aNewValue) {
return NS_OK;
}
NS_IMETHODIMP
nsMsgSendLater::OnItemPropertyFlagChanged(nsIMsgDBHdr* aItem,
const nsACString& aProperty,
uint32_t aOldValue,
uint32_t aNewValue) {
nsMsgSendLater::OnFolderUnicharPropertyChanged(nsIMsgFolder* aFolder,
const nsACString& aProperty,
const nsAString& aOldValue,
const nsAString& aNewValue) {
return NS_OK;
}
NS_IMETHODIMP
nsMsgSendLater::OnItemEvent(nsIMsgFolder* aItem, const nsACString& aEvent) {
nsMsgSendLater::OnFolderPropertyFlagChanged(nsIMsgDBHdr* aMsg,
const nsACString& aProperty,
uint32_t aOldValue,
uint32_t aNewValue) {
return NS_OK;
}
NS_IMETHODIMP
nsMsgSendLater::OnFolderEvent(nsIMsgFolder* aFolder, const nsACString& aEvent) {
return NS_OK;
}

Просмотреть файл

@ -101,6 +101,7 @@ class nsMsgSendLater : public nsIMsgSendLater,
nsresult GetIdentityFromKey(const char* aKey, nsIMsgIdentity** aIdentity);
nsresult ReparseDBIfNeeded(nsIUrlListener* aListener);
nsresult InternalSendMessages(bool aUserInitiated, nsIMsgIdentity* aIdentity);
nsresult StartTimer();
nsTObserverArray<nsCOMPtr<nsIMsgSendLaterListener> > mListenerArray;
nsCOMPtr<nsIMsgDBHdr> mMessage;

Просмотреть файл

@ -2917,15 +2917,17 @@ var GlodaMsgIndexer = {
this.indexer = aIndexer;
},
OnItemAdded(aParentItem, aItem) {},
OnItemRemoved(aParentItem, aItem) {},
OnItemPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {},
onFolderAdded(parentFolder, child) {},
onMessageAdded(parentFolder, msg) {},
onFolderRemoved(parentFolder, child) {},
onMessageRemoved(parentFolder, msg) {},
onFolderPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {},
/**
* Detect changes to folder flags and reset our indexing priority. This
* is important because (all?) folders start out without any flags and
* then get their flags added to them.
*/
OnItemIntPropertyChanged(aFolderItem, aProperty, aOldValue, aNewValue) {
onFolderIntPropertyChanged(aFolderItem, aProperty, aOldValue, aNewValue) {
if (aProperty !== "FolderFlag") {
return;
}
@ -2941,13 +2943,13 @@ var GlodaMsgIndexer = {
}
GlodaMsgIndexer.resetFolderIndexingPriority(aFolderItem);
},
OnItemBoolPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {},
OnItemUnicharPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {},
onFolderBoolPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {},
onFolderUnicharPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {},
/**
* Notice when user activity adds/removes tags or changes a message's
* status.
*/
OnItemPropertyFlagChanged(aMsgHdr, aProperty, aOldValue, aNewValue) {
onFolderPropertyFlagChanged(aMsgHdr, aProperty, aOldValue, aNewValue) {
if (
aProperty == "Keywords" ||
// We could care less about the new flag changing.
@ -2966,7 +2968,7 @@ var GlodaMsgIndexer = {
* Get folder loaded notifications for folders that had to do some
* (asynchronous) processing before they could be opened.
*/
OnItemEvent(aFolder, aEvent) {
onFolderEvent(aFolder, aEvent) {
if (aEvent == "FolderLoaded") {
this.indexer._onFolderLoaded(aFolder);
}

Просмотреть файл

@ -131,7 +131,7 @@ function* endTest() {
}
var gFolderListener = {
OnItemBoolPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {
onFolderBoolPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {
// This means that the STAT on "folder 2" has finished.
if (aProperty == "NewMessages" && aNewValue) {
async_driver();

Просмотреть файл

@ -419,7 +419,7 @@ function endTest() {
// nsIFolderListener implementation
var FolderListener = {
OnItemEvent(aEventFolder, aEvent) {
onFolderEvent(aEventFolder, aEvent) {
dump(
"received folder event " + aEvent + " folder " + aEventFolder.name + "\n"
);

Просмотреть файл

@ -251,7 +251,7 @@ function endTest() {
// nsIFolderListener implementation
var FolderListener = {
OnItemEvent(aEventFolder, aEvent) {
onFolderEvent(aEventFolder, aEvent) {
dump(
"received folder event " + aEvent + " folder " + aEventFolder.name + "\n"
);

Просмотреть файл

@ -34,7 +34,7 @@ var dummyMsgWindow = {
var gFolderListener = {
_gotNewMailBiff: false,
OnItemIntPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {
onFolderIntPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {
if (
aProperty == "BiffState" &&
aNewValue == Ci.nsIMsgFolder.nsMsgBiffState_NewMail

Просмотреть файл

@ -359,69 +359,76 @@ nsLocalMoveCopyMsgTxn::RedoTransaction() {
return rv;
}
NS_IMETHODIMP nsLocalMoveCopyMsgTxn::OnItemAdded(nsIMsgFolder* parentItem,
nsISupports* item) {
nsCOMPtr<nsIMsgDBHdr> msgHdr(do_QueryInterface(item));
if (msgHdr) {
nsresult rv;
nsCOMPtr<nsIMsgFolder> folder =
do_QueryReferent(m_undoing ? m_srcFolder : m_dstFolder, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCString messageId;
msgHdr->GetMessageId(getter_Copies(messageId));
if (m_copiedMsgIds.Contains(messageId)) {
nsMsgKey msgKey;
msgHdr->GetMessageKey(&msgKey);
if (m_undoing)
m_srcKeyArray.AppendElement(msgKey);
else
m_dstKeyArray.AppendElement(msgKey);
if (++m_numHdrsCopied == m_copiedMsgIds.Length()) {
folder->RemoveFolderListener(this);
m_copiedMsgIds.Clear();
}
NS_IMETHODIMP nsLocalMoveCopyMsgTxn::OnFolderAdded(nsIMsgFolder* parent,
nsIMsgFolder* child) {
return NS_OK;
}
NS_IMETHODIMP nsLocalMoveCopyMsgTxn::OnMessageAdded(nsIMsgFolder* parent,
nsIMsgDBHdr* msgHdr) {
nsresult rv;
nsCOMPtr<nsIMsgFolder> folder =
do_QueryReferent(m_undoing ? m_srcFolder : m_dstFolder, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCString messageId;
msgHdr->GetMessageId(getter_Copies(messageId));
if (m_copiedMsgIds.Contains(messageId)) {
nsMsgKey msgKey;
msgHdr->GetMessageKey(&msgKey);
if (m_undoing)
m_srcKeyArray.AppendElement(msgKey);
else
m_dstKeyArray.AppendElement(msgKey);
if (++m_numHdrsCopied == m_copiedMsgIds.Length()) {
folder->RemoveFolderListener(this);
m_copiedMsgIds.Clear();
}
}
return NS_OK;
}
NS_IMETHODIMP nsLocalMoveCopyMsgTxn::OnItemRemoved(nsIMsgFolder* parentItem,
nsISupports* item) {
NS_IMETHODIMP nsLocalMoveCopyMsgTxn::OnFolderRemoved(nsIMsgFolder* parent,
nsIMsgFolder* child) {
return NS_OK;
}
NS_IMETHODIMP nsLocalMoveCopyMsgTxn::OnItemPropertyChanged(
NS_IMETHODIMP nsLocalMoveCopyMsgTxn::OnMessageRemoved(nsIMsgFolder* parent,
nsIMsgDBHdr* msg) {
return NS_OK;
}
NS_IMETHODIMP nsLocalMoveCopyMsgTxn::OnFolderPropertyChanged(
nsIMsgFolder* item, const nsACString& property, const nsACString& oldValue,
const nsACString& newValue) {
return NS_OK;
}
NS_IMETHODIMP nsLocalMoveCopyMsgTxn::OnItemIntPropertyChanged(
NS_IMETHODIMP nsLocalMoveCopyMsgTxn::OnFolderIntPropertyChanged(
nsIMsgFolder* item, const nsACString& property, int64_t oldValue,
int64_t newValue) {
return NS_OK;
}
NS_IMETHODIMP nsLocalMoveCopyMsgTxn::OnItemBoolPropertyChanged(
NS_IMETHODIMP nsLocalMoveCopyMsgTxn::OnFolderBoolPropertyChanged(
nsIMsgFolder* item, const nsACString& property, bool oldValue,
bool newValue) {
return NS_OK;
}
NS_IMETHODIMP nsLocalMoveCopyMsgTxn::OnItemUnicharPropertyChanged(
NS_IMETHODIMP nsLocalMoveCopyMsgTxn::OnFolderUnicharPropertyChanged(
nsIMsgFolder* item, const nsACString& property, const nsAString& oldValue,
const nsAString& newValue) {
return NS_OK;
}
NS_IMETHODIMP nsLocalMoveCopyMsgTxn::OnItemPropertyFlagChanged(
NS_IMETHODIMP nsLocalMoveCopyMsgTxn::OnFolderPropertyFlagChanged(
nsIMsgDBHdr* item, const nsACString& property, uint32_t oldFlag,
uint32_t newFlag) {
return NS_OK;
}
NS_IMETHODIMP nsLocalMoveCopyMsgTxn::OnItemEvent(nsIMsgFolder* aItem,
const nsACString& aEvent) {
NS_IMETHODIMP nsLocalMoveCopyMsgTxn::OnFolderEvent(nsIMsgFolder* aItem,
const nsACString& aEvent) {
return NS_OK;
}
@ -435,48 +442,58 @@ nsLocalUndoFolderListener::nsLocalUndoFolderListener(
nsLocalUndoFolderListener::~nsLocalUndoFolderListener() {}
NS_IMETHODIMP nsLocalUndoFolderListener::OnItemAdded(nsIMsgFolder* parentItem,
nsISupports* item) {
NS_IMETHODIMP nsLocalUndoFolderListener::OnFolderAdded(nsIMsgFolder* parent,
nsIMsgFolder* child) {
return NS_OK;
}
NS_IMETHODIMP nsLocalUndoFolderListener::OnItemRemoved(nsIMsgFolder* parentItem,
nsISupports* item) {
NS_IMETHODIMP nsLocalUndoFolderListener::OnMessageAdded(nsIMsgFolder* parent,
nsIMsgDBHdr* msg) {
return NS_OK;
}
NS_IMETHODIMP nsLocalUndoFolderListener::OnItemPropertyChanged(
NS_IMETHODIMP nsLocalUndoFolderListener::OnFolderRemoved(nsIMsgFolder* parent,
nsIMsgFolder* child) {
return NS_OK;
}
NS_IMETHODIMP nsLocalUndoFolderListener::OnMessageRemoved(nsIMsgFolder* parent,
nsIMsgDBHdr* msg) {
return NS_OK;
}
NS_IMETHODIMP nsLocalUndoFolderListener::OnFolderPropertyChanged(
nsIMsgFolder* item, const nsACString& property, const nsACString& oldValue,
const nsACString& newValue) {
return NS_OK;
}
NS_IMETHODIMP nsLocalUndoFolderListener::OnItemIntPropertyChanged(
NS_IMETHODIMP nsLocalUndoFolderListener::OnFolderIntPropertyChanged(
nsIMsgFolder* item, const nsACString& property, int64_t oldValue,
int64_t newValue) {
return NS_OK;
}
NS_IMETHODIMP nsLocalUndoFolderListener::OnItemBoolPropertyChanged(
NS_IMETHODIMP nsLocalUndoFolderListener::OnFolderBoolPropertyChanged(
nsIMsgFolder* item, const nsACString& property, bool oldValue,
bool newValue) {
return NS_OK;
}
NS_IMETHODIMP nsLocalUndoFolderListener::OnItemUnicharPropertyChanged(
NS_IMETHODIMP nsLocalUndoFolderListener::OnFolderUnicharPropertyChanged(
nsIMsgFolder* item, const nsACString& property, const nsAString& oldValue,
const nsAString& newValue) {
return NS_OK;
}
NS_IMETHODIMP nsLocalUndoFolderListener::OnItemPropertyFlagChanged(
NS_IMETHODIMP nsLocalUndoFolderListener::OnFolderPropertyFlagChanged(
nsIMsgDBHdr* item, const nsACString& property, uint32_t oldFlag,
uint32_t newFlag) {
return NS_OK;
}
NS_IMETHODIMP nsLocalUndoFolderListener::OnItemEvent(nsIMsgFolder* aItem,
const nsACString& aEvent) {
NS_IMETHODIMP nsLocalUndoFolderListener::OnFolderEvent(
nsIMsgFolder* aItem, const nsACString& aEvent) {
if (mTxn && mFolder && aItem == mFolder) {
if (aEvent.Equals(kFolderLoaded)) return mTxn->UndoTransactionInternal();
}

Просмотреть файл

@ -182,10 +182,10 @@ NS_IMETHODIMP nsPop3IncomingServer::SetDeferredToAccount(
if (rootFolder) {
// if isDeferred state has changed, send notification
if (aAccountKey.IsEmpty() != deferredToAccount.IsEmpty()) {
folderListenerManager->OnItemBoolPropertyChanged(
folderListenerManager->OnFolderBoolPropertyChanged(
rootFolder, kIsDeferred, !deferredToAccount.IsEmpty(),
deferredToAccount.IsEmpty());
folderListenerManager->OnItemBoolPropertyChanged(
folderListenerManager->OnFolderBoolPropertyChanged(
rootFolder, kCanFileMessages, deferredToAccount.IsEmpty(),
!deferredToAccount.IsEmpty());

Просмотреть файл

@ -79,10 +79,13 @@ var FListener = {
return this.totalMsgs[this.totalMsgs.length - 1 - aBack];
},
OnItemAdded: function act_add(aRDFParentItem, aItem) {},
OnItemRemoved: function act_remove(aRDFParentItem, aItem) {},
OnItemPropertyChanged(aItem, aProperty, aOld, aNew) {},
OnItemIntPropertyChanged(aItem, aProperty, aOld, aNew) {
onFolderAdded: function act_add(parentFolder, child) {},
onMessageAdded: function act_add(parentFolder, msg) {},
onFolderRemoved: function act_remove(parentFolder, child) {},
onMessageRemoved: function act_remove(parentFolder, msg) {},
onFolderPropertyChanged(aItem, aProperty, aOld, aNew) {},
onFolderIntPropertyChanged(aItem, aProperty, aOld, aNew) {
if (aItem === gInbox) {
dump(
"Property change on folder Inbox:" +
@ -100,10 +103,10 @@ var FListener = {
}
}
},
OnItemBoolPropertyChanged(aItem, aProperty, aOld, aNew) {},
OnItemUnicharPropertyChanged(aItem, aProperty, aOld, aNew) {},
OnItemPropertyFlagChanged(aItem, aProperty, aOld, aNew) {},
OnItemEvent(aFolder, aEvent) {},
onFolderBoolPropertyChanged(aItem, aProperty, aOld, aNew) {},
onFolderUnicharPropertyChanged(aItem, aProperty, aOld, aNew) {},
onFolderPropertyFlagChanged(aItem, aProperty, aOld, aNew) {},
onFolderEvent(aFolder, aEvent) {},
};
/**
@ -365,7 +368,7 @@ function downloadOver4GiB_success_check() {
Assert.equal(gInbox.sizeOnDisk, localInboxSize);
// Bug 813459
// Check if the OnItemIntPropertyChanged folder listener hook can return
// Check if the onFolderIntPropertyChanged folder listener hook can return
// values above 2^32 for properties where it is relevant.
Assert.equal(FListener.sizeHistory(0), gInbox.sizeOnDisk);
Assert.ok(FListener.sizeHistory(1) < FListener.sizeHistory(0));
@ -560,7 +563,7 @@ var ParseListener_run_test = {
Assert.notEqual(gInbox.msgDatabase, null);
Assert.ok(gInbox.msgDatabase.summaryValid);
// Bug 813459
// Check if the OnItemIntPropertyChanged folder listener hook can return
// Check if the onFolderIntPropertyChanged folder listener hook can return
// values below 2^32 for properties which are not 64 bits long.
Assert.equal(FListener.msgsHistory(0), gExpectedNewMessages);
Assert.equal(FListener.msgsHistory(0), gInbox.getTotalMessages(false));

Просмотреть файл

@ -82,7 +82,7 @@ add_task(async function trigger_bug() {
return new Promise((resolve, reject) => {
let folderListener = {
QueryInterface: ChromeUtils.generateQI(["nsIFolderListener"]),
OnItemEvent(aEventFolder, aEvent) {
onFolderEvent(aEventFolder, aEvent) {
if (
aEvent == "FolderLoaded" &&
aEventFolder.prettyName == "test.subscribe.simple"

Просмотреть файл

@ -79,7 +79,7 @@ function* test_cancel() {
let hdr = db.GetMsgHdrForKey(4);
let folderListener = {
OnItemEvent(aEventFolder, aEvent) {
onFolderEvent(aEventFolder, aEvent) {
if (aEvent == "DeleteOrMoveMsgCompleted") {
MailServices.mailSession.RemoveFolderListener(this);
}

Просмотреть файл

@ -519,7 +519,7 @@ var mailTestUtils = {
// register for the folder loaded notification ahead of time... even though
// we may not need it...
let folderListener = {
OnItemEvent(aEventFolder, aEvent) {
onFolderEvent(aEventFolder, aEvent) {
if (aEvent == "FolderLoaded" && aFolder.URI == aEventFolder.URI) {
MailServices.mailSession.RemoveFolderListener(this);
aCallback.apply(aCallbackThis, aCallbackArgs);

Просмотреть файл

@ -178,7 +178,7 @@ PromiseTestUtils.promiseFolderEvent = function(folder, event) {
return new Promise((resolve, reject) => {
let folderListener = {
QueryInterface: ChromeUtils.generateQI(["nsIFolderListener"]),
OnItemEvent(aEventFolder, aEvent) {
onFolderEvent(aEventFolder, aEvent) {
if (folder === aEventFolder && event == aEvent) {
MailServices.mailSession.RemoveFolderListener(folderListener);
resolve();

Просмотреть файл

@ -144,18 +144,20 @@ var _folderEventLogHelper_msgFolderListener = {
* nsIFolderListener implementation to logHelper stuff that gloda cares about.
*/
var _folderEventLogHelper_folderListener = {
OnItemAdded(aParentItem, aItem) {},
OnItemRemoved(aParentItem, aItem) {},
OnItemPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {},
OnItemIntPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {},
OnItemBoolPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {},
OnItemUnicharPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {},
onFolderAdded(parentFolder, child) {},
onMessageAdded(parentFolder, msg) {},
onFolderRemoved(parentFolder, child) {},
onMessageRemoved(parentFolder, msg) {},
onFolderPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {},
onFolderIntPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {},
onFolderBoolPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {},
onFolderUnicharPropertyChanged(aItem, aProperty, aOldValue, aNewValue) {},
/**
* Notice when user activity adds/removes tags or changes a message's
* status.
*/
OnItemPropertyFlagChanged(aMsgHdr, aProperty, aOldValue, aNewValue) {
mark_action("msgEvent", "OnItemPropertyFlagChanged", [
onFolderPropertyFlagChanged(aMsgHdr, aProperty, aOldValue, aNewValue) {
mark_action("msgEvent", "onFolderPropertyFlagChanged", [
"Header",
aMsgHdr,
"had property " +
@ -170,7 +172,7 @@ var _folderEventLogHelper_folderListener = {
* Get folder loaded notifications for folders that had to do some
* (asynchronous) processing before they could be opened.
*/
OnItemEvent(aFolder, aEvent) {
mark_action("msgEvent", "OnItemEvent", [aFolder, aEvent]);
onFolderEvent(aFolder, aEvent) {
mark_action("msgEvent", "onFolderEvent", [aFolder, aEvent]);
},
};

Просмотреть файл

@ -190,20 +190,21 @@ var gSearchNotificationListener =
// the folderListener object
var gFolderListener = {
OnItemAdded: function(parentItem, item) {},
onFolderAdded: function(parentFolder, child) {},
onMessageAdded: function(parentFolder, msg) {},
onFolderRemoved: function(parentFolder, child) {},
onMessageRemoved: function(parentFolder, msg) {},
OnItemRemoved: function(parentItem, item){},
onFolderPropertyChanged: function(item, property, oldValue, newValue) {},
OnItemPropertyChanged: function(item, property, oldValue, newValue) {},
onFolderIntPropertyChanged: function(item, property, oldValue, newValue) {},
OnItemIntPropertyChanged: function(item, property, oldValue, newValue) {},
onFolderBoolPropertyChanged: function(item, property, oldValue, newValue) {},
OnItemBoolPropertyChanged: function(item, property, oldValue, newValue) {},
onFolderUnicharPropertyChanged: function(item, property, oldValue, newValue){},
onFolderPropertyFlagChanged: function(item, property, oldFlag, newFlag) {},
OnItemUnicharPropertyChanged: function(item, property, oldValue, newValue){},
OnItemPropertyFlagChanged: function(item, property, oldFlag, newFlag) {},
OnItemEvent: function(folder, event) {
onFolderEvent: function(folder, event) {
if (event == "DeleteOrMoveMsgCompleted") {
HandleDeleteOrMoveMessageCompleted(folder);
}

Просмотреть файл

@ -1391,10 +1391,9 @@ let gFolderTreeView = {
/**
* This is our implementation of nsIMsgFolderListener to watch for changes
*/
OnItemAdded: function ftl_add(aParentItem, aItem) {
onFolderAdded: function ftl_add(aParentItem, aItem) {
// Ignore this item if it's not a folder, or we knew about it.
if (!(aItem instanceof Ci.nsIMsgFolder) ||
this.getIndexOfFolder(aItem) != null)
if (this.getIndexOfFolder(aItem) != null)
return;
// If no parent, this is an account, so let's rebuild.
@ -1406,6 +1405,7 @@ let gFolderTreeView = {
this._modes[this._mode].onFolderAdded(
aParentItem.QueryInterface(Ci.nsIMsgFolder), aItem);
},
onMessageAdded: function(parentFolder, msg) {},
addFolder: function ftl_add_folder(aParentItem, aItem) {
// This intentionally adds any new folder even if it would not pass the
@ -1452,10 +1452,7 @@ let gFolderTreeView = {
this._addChildToView(parent, parentIndex, newChild);
},
OnItemRemoved: function ftl_remove(aRDFParentItem, aItem) {
if (!(aItem instanceof Ci.nsIMsgFolder))
return;
onFolderRemoved: function ftl_remove(aRDFParentItem, aItem) {
this._persistItemClosed(aItem.URI);
let index = this.getIndexOfFolder(aItem);
@ -1476,8 +1473,10 @@ let gFolderTreeView = {
this._tree.invalidateRow(index);
},
OnItemPropertyChanged: function(aItem, aProperty, aOld, aNew) {},
OnItemIntPropertyChanged: function(aItem, aProperty, aOld, aNew) {
onMessageRemoved: function(parentFolder, msg) {},
onFolderPropertyChanged: function(aItem, aProperty, aOld, aNew) {},
onFolderIntPropertyChanged: function(aItem, aProperty, aOld, aNew) {
// First try mode specific handling of the changed property.
if (this._modes[this.mode].handleChangedIntProperty(aItem, aProperty, aOld,
aNew))
@ -1499,14 +1498,14 @@ let gFolderTreeView = {
}
},
OnItemBoolPropertyChanged: function(aItem, aProperty, aOld, aNew) {
onFolderBoolPropertyChanged: function(aItem, aProperty, aOld, aNew) {
let index = this.getIndexOfFolder(aItem);
if (index != null)
this._tree.invalidateRow(index);
},
OnItemUnicharPropertyChanged: function(aItem, aProperty, aOld, aNew) {},
OnItemPropertyFlagChanged: function(aItem, aProperty, aOld, aNew) {},
OnItemEvent: function(aFolder, aEvent) {
onFolderUnicharPropertyChanged: function(aItem, aProperty, aOld, aNew) {},
onFolderPropertyFlagChanged: function(aItem, aProperty, aOld, aNew) {},
onFolderEvent: function(aFolder, aEvent) {
let index = this.getIndexOfFolder(aFolder);
if (index != null)
this._tree.invalidateRow(index);

Просмотреть файл

@ -24,31 +24,30 @@ var gNextMessageAfterLoad = null;
// the folderListener object
var folderListener = {
OnItemAdded: function(parentItem, item) {},
OnItemRemoved: function(parentItem, item)
onFolderAdded: function(parentFolder, child) {},
onMessageAdded: function(parentFolder, msg) {},
onFolderRemoved: function(parentFolder, child) {},
onMessageRemoved: function(parentFolder, msg)
{
if (parentItem.URI != gCurrentFolderUri)
if (parentFolder.URI != gCurrentFolderUri)
return;
if (item instanceof Ci.nsIMsgDBHdr &&
extractMsgKeyFromURI() == item.messageKey)
if (extractMsgKeyFromURI() == msg.messageKey)
gCurrentMessageIsDeleted = true;
},
OnItemPropertyChanged: function(item, property, oldValue, newValue) {},
OnItemIntPropertyChanged: function(item, property, oldValue, newValue) {
onFolderPropertyChanged: function(item, property, oldValue, newValue) {},
onFolderIntPropertyChanged: function(item, property, oldValue, newValue) {
if (item.URI == gCurrentFolderUri) {
if (property == "TotalMessages" || property == "TotalUnreadMessages") {
UpdateStandAloneMessageCounts();
}
}
},
OnItemBoolPropertyChanged: function(item, property, oldValue, newValue) {},
OnItemUnicharPropertyChanged: function(item, property, oldValue, newValue){},
OnItemPropertyFlagChanged: function(item, property, oldFlag, newFlag) {},
onFolderBoolPropertyChanged: function(item, property, oldValue, newValue) {},
onFolderUnicharPropertyChanged: function(item, property, oldValue, newValue){},
onFolderPropertyFlagChanged: function(item, property, oldFlag, newFlag) {},
OnItemEvent: function(folder, event) {
onFolderEvent: function(folder, event) {
if (event == "DeleteOrMoveMsgCompleted")
HandleDeleteOrMoveMsgCompleted(folder);
else if (event == "DeleteOrMoveMsgFailed")

Просмотреть файл

@ -113,15 +113,17 @@ function ScrollToMessageAfterFolderLoad(folder)
// the folderListener object
var folderListener =
{
OnItemAdded: function(parentItem, item) {},
OnItemRemoved: function(parentItem, item) {},
onFolderAdded: function(parentFolder, child) {},
onMessageAdded: function(parentFolder, msg) {},
onFolderRemoved: function(parentFolder, child) {},
onMessageRemoved: function(parentFolder, msg) {},
OnItemPropertyChanged: function(item, property, oldValue, newValue) {},
OnItemBoolPropertyChanged: function(item, property, oldValue, newValue) {},
OnItemUnicharPropertyChanged: function(item, property, oldValue, newValue) {},
OnItemPropertyFlagChanged: function(item, property, oldFlag, newFlag) {},
onFolderPropertyChanged: function(item, property, oldValue, newValue) {},
onFolderBoolPropertyChanged: function(item, property, oldValue, newValue) {},
onFolderUnicharPropertyChanged: function(item, property, oldValue, newValue) {},
onFolderPropertyFlagChanged: function(item, property, oldFlag, newFlag) {},
OnItemIntPropertyChanged: function(item, property, oldValue, newValue)
onFolderIntPropertyChanged: function(item, property, oldValue, newValue)
{
// handle the currently visible folder
if (item == gMsgFolderSelected)
@ -151,7 +153,7 @@ var folderListener =
}
},
OnItemEvent: function(folder, event) {
onFolderEvent: function(folder, event) {
if (event == "FolderLoaded") {
if (folder) {
var scrolled = false;