Bug 1682941 - Remove nsISimpleEnumerator from nsIMsgFolder.subFolders property. r=mkmelin
This commit is contained in:
Родитель
62c1eb0846
Коммит
5afc64da10
|
@ -1373,7 +1373,7 @@ var gFolderTreeView = {
|
|||
},
|
||||
|
||||
_subFoldersWithStringProperty(folder, folders, aFolderName, deep) {
|
||||
for (let child of fixIterator(folder.subFolders, Ci.nsIMsgFolder)) {
|
||||
for (let child of folder.subFolders) {
|
||||
// if the folder selection is based on a string property, use that
|
||||
if (aFolderName == getSmartFolderName(child)) {
|
||||
folders.push(child);
|
||||
|
@ -2613,7 +2613,7 @@ var gFolderTreeView = {
|
|||
* @param folders the array to add the folders to.
|
||||
*/
|
||||
addSubFolders(folder, folders) {
|
||||
for (let f of fixIterator(folder.subFolders, Ci.nsIMsgFolder)) {
|
||||
for (let f of folder.subFolders) {
|
||||
folders.push(f);
|
||||
this.addSubFolders(f, folders);
|
||||
}
|
||||
|
@ -3195,9 +3195,9 @@ FtvItem.prototype = {
|
|||
get children() {
|
||||
// We're caching our child list to save perf.
|
||||
if (!this._children) {
|
||||
let iter;
|
||||
let subFolders;
|
||||
try {
|
||||
iter = fixIterator(this._folder.subFolders, Ci.nsIMsgFolder);
|
||||
subFolders = this._folder.subFolders;
|
||||
} catch (ex) {
|
||||
Services.console.logStringMessage(
|
||||
"Discovering children for " +
|
||||
|
@ -3205,12 +3205,12 @@ FtvItem.prototype = {
|
|||
" failed with exception: " +
|
||||
ex
|
||||
);
|
||||
iter = [];
|
||||
subFolders = [];
|
||||
}
|
||||
this._children = [];
|
||||
// Out of all children, only keep those that match the _folderFilter
|
||||
// and those that contain such children.
|
||||
for (let folder of iter) {
|
||||
for (let folder of subFolders) {
|
||||
if (!this._folderFilter || this._folderFilter(folder)) {
|
||||
this._children.push(new FtvItem(folder, this._folderFilter));
|
||||
}
|
||||
|
@ -3878,13 +3878,11 @@ FtvSmartItem.prototype = {
|
|||
// We're caching our child list to save perf.
|
||||
if (!this._children) {
|
||||
this._children = [];
|
||||
let iter = fixIterator(this._folder.subFolders, Ci.nsIMsgFolder);
|
||||
for (let folder of iter) {
|
||||
for (let folder of this._folder.subFolders) {
|
||||
if (!smartMode.isSmartFolder(folder)) {
|
||||
this._children.push(new FtvSmartItem(folder));
|
||||
} else if (folder.getFlag(Ci.nsMsgFolderFlags.Inbox)) {
|
||||
let subIter = fixIterator(folder.subFolders, Ci.nsIMsgFolder);
|
||||
for (let subfolder of subIter) {
|
||||
for (let subfolder of folder.subFolders) {
|
||||
if (!smartMode.isSmartFolder(subfolder)) {
|
||||
this._children.push(new FtvSmartItem(subfolder));
|
||||
}
|
||||
|
|
|
@ -16,18 +16,11 @@ var { allAccountsSorted } = ChromeUtils.import(
|
|||
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
function GetSubFoldersInFolderPaneOrder(folder) {
|
||||
var msgFolders = [];
|
||||
|
||||
// get all the subfolders
|
||||
msgFolders = [...folder.subFolders];
|
||||
|
||||
function compareFolderSortKey(folder1, folder2) {
|
||||
return folder1.compareSortKeys(folder2);
|
||||
}
|
||||
|
||||
// sort the subfolders
|
||||
msgFolders.sort(compareFolderSortKey);
|
||||
return msgFolders;
|
||||
return folder.subFolders.sort(compareFolderSortKey);
|
||||
}
|
||||
|
||||
function FindNextChildFolder(aParent, aAfter) {
|
||||
|
|
|
@ -1515,7 +1515,7 @@ function convertFolder(folder, accountId) {
|
|||
function traverseSubfolders(folder, accountId) {
|
||||
let f = convertFolder(folder, accountId);
|
||||
f.subFolders = [];
|
||||
for (let subFolder of fixIterator(folder.subFolders, Ci.nsIMsgFolder)) {
|
||||
for (let subFolder of folder.subFolders) {
|
||||
f.subFolders.push(traverseSubfolders(subFolder, accountId || f.accountId));
|
||||
}
|
||||
return f;
|
||||
|
|
|
@ -142,7 +142,7 @@ async function testExecuteMessageDisplayActionWithOptions(msg, options = {}) {
|
|||
add_task(async function prepare_test() {
|
||||
let account = createAccount();
|
||||
let rootFolder = account.incomingServer.rootFolder;
|
||||
let subFolders = [...rootFolder.subFolders];
|
||||
let subFolders = rootFolder.subFolders;
|
||||
createMessages(subFolders[0], 10);
|
||||
gMessages = [...subFolders[0].messages];
|
||||
|
||||
|
|
|
@ -258,7 +258,7 @@ add_task(async function set_up() {
|
|||
|
||||
gAccount = createAccount();
|
||||
addIdentity(gAccount);
|
||||
gFolders = [...gAccount.incomingServer.rootFolder.subFolders];
|
||||
gFolders = gAccount.incomingServer.rootFolder.subFolders;
|
||||
createMessages(gFolders[0], {
|
||||
count: 1,
|
||||
body: {
|
||||
|
|
|
@ -7,7 +7,7 @@ let account;
|
|||
add_task(async () => {
|
||||
account = createAccount();
|
||||
let rootFolder = account.incomingServer.rootFolder;
|
||||
let subFolders = [...rootFolder.subFolders];
|
||||
let subFolders = rootFolder.subFolders;
|
||||
createMessages(subFolders[0], 10);
|
||||
|
||||
window.gFolderTreeView.selectFolder(subFolders[0]);
|
||||
|
|
|
@ -7,7 +7,7 @@ let account, rootFolder, subFolders;
|
|||
add_task(async () => {
|
||||
account = createAccount();
|
||||
rootFolder = account.incomingServer.rootFolder;
|
||||
subFolders = [...rootFolder.subFolders];
|
||||
subFolders = rootFolder.subFolders;
|
||||
createMessages(subFolders[0], 10);
|
||||
|
||||
window.gFolderTreeView.selectFolder(rootFolder);
|
||||
|
|
|
@ -140,7 +140,7 @@ add_task(async function testFirstTab() {
|
|||
|
||||
let gAccount = createAccount();
|
||||
window.gFolderTreeView.selectFolder(
|
||||
[...gAccount.incomingServer.rootFolder.subFolders][0]
|
||||
gAccount.incomingServer.rootFolder.subFolders[0]
|
||||
);
|
||||
window.ClearMessagePane();
|
||||
return subTest(createTab, getBrowser, false);
|
||||
|
|
|
@ -180,12 +180,12 @@ add_task(async function test_accounts() {
|
|||
extension.sendMessage(account2.key, account2.incomingServer.prettyName);
|
||||
|
||||
await extension.awaitMessage("create folders");
|
||||
let inbox1 = [...account1.incomingServer.rootFolder.subFolders][0];
|
||||
let inbox1 = account1.incomingServer.rootFolder.subFolders[0];
|
||||
// Test our code can handle characters that might be escaped.
|
||||
inbox1.createSubfolder("foo 'bar'(!)", null);
|
||||
inbox1.createSubfolder("Ϟ", null); // Test our code can handle unicode.
|
||||
|
||||
let inbox2 = [...account2.incomingServer.rootFolder.subFolders][0];
|
||||
let inbox2 = account2.incomingServer.rootFolder.subFolders[0];
|
||||
inbox2.QueryInterface(Ci.nsIMsgImapMailFolder).hierarchyDelimiter = "/";
|
||||
// Test our code can handle characters that might be escaped.
|
||||
inbox2.createSubfolder("foo 'bar'(!)", null);
|
||||
|
|
|
@ -4,9 +4,6 @@
|
|||
|
||||
var EXPORTED_SYMBOLS = ["IMIncomingServer"];
|
||||
|
||||
var { EmptyEnumerator } = ChromeUtils.import(
|
||||
"resource:///modules/imXPCOMUtils.jsm"
|
||||
);
|
||||
var { Services } = ChromeUtils.import("resource:///modules/imServices.jsm");
|
||||
|
||||
function IMIncomingServer() {}
|
||||
|
@ -327,7 +324,7 @@ IMIncomingServer.prototype = {
|
|||
getFolderWithFlags: aFlags => null,
|
||||
getFoldersWithFlags: aFlags => [],
|
||||
get subFolders() {
|
||||
return EmptyEnumerator;
|
||||
return [];
|
||||
},
|
||||
getStringProperty: aPropertyName => "",
|
||||
getNumUnread: aDeep => 0,
|
||||
|
|
|
@ -416,11 +416,9 @@ function getMsgFolders(folder, msgFolderArr) {
|
|||
}
|
||||
|
||||
// add all subfolders
|
||||
if (folder.hasSubFolders) {
|
||||
for (let folder of folder.subFolders) {
|
||||
getMsgFolders(folder, msgFolderArr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Util Function for Extracting manually added Headers
|
||||
|
|
|
@ -22,9 +22,6 @@ var {
|
|||
var { MailServices } = ChromeUtils.import(
|
||||
"resource:///modules/MailServices.jsm"
|
||||
);
|
||||
var { fixIterator } = ChromeUtils.import(
|
||||
"resource:///modules/iteratorUtils.jsm"
|
||||
);
|
||||
|
||||
add_task(function setupModule(module) {
|
||||
assert_folder_mode("all");
|
||||
|
@ -36,10 +33,7 @@ add_task(function test_folder_names_in_recent_view_mode() {
|
|||
// unmodified times, so that it does not influence the
|
||||
// list of Recent folders. So clear out the most-recently-used time.
|
||||
for (let acc of MailServices.accounts.accounts) {
|
||||
for (let fld of fixIterator(
|
||||
acc.incomingServer.rootFolder.subFolders,
|
||||
Ci.nsIMsgFolder
|
||||
)) {
|
||||
for (let fld of acc.incomingServer.rootFolder.subFolders) {
|
||||
fld.setStringProperty("MRUTime", "0");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,9 +18,6 @@
|
|||
getSpecialFolderString,
|
||||
getMostRecentFolders,
|
||||
} = ChromeUtils.import("resource:///modules/folderUtils.jsm");
|
||||
const { fixIterator, toArray } = ChromeUtils.import(
|
||||
"resource:///modules/iteratorUtils.jsm"
|
||||
);
|
||||
const { MailServices } = ChromeUtils.import(
|
||||
"resource:///modules/MailServices.jsm"
|
||||
);
|
||||
|
@ -450,9 +447,7 @@
|
|||
|
||||
// If we have a parent folder, just get the subFolders for that parent.
|
||||
if (parentFolder) {
|
||||
folders = toArray(
|
||||
fixIterator(parentFolder.subFolders, Ci.nsIMsgFolder)
|
||||
);
|
||||
folders = parentFolder.subFolders;
|
||||
} else {
|
||||
// If we don't have a parent, then we assume we should build the
|
||||
// top-level accounts. (Actually we build the fake root folders for
|
||||
|
|
|
@ -653,10 +653,10 @@ interface nsIMsgFolder : nsISupports {
|
|||
attribute nsMsgKey lastMessageLoaded;
|
||||
|
||||
/**
|
||||
* Returns an enumerator containing a list of nsIMsgFolder items that are
|
||||
* Returns an array containing nsIMsgFolder items that are
|
||||
* subfolders of the instance this is called on.
|
||||
*/
|
||||
readonly attribute nsISimpleEnumerator subFolders;
|
||||
readonly attribute Array<nsIMsgFolder> subFolders;
|
||||
|
||||
/**
|
||||
* Returns true if this folder has sub folders.
|
||||
|
|
|
@ -138,17 +138,11 @@ nsMsgAccount::SetIncomingServer(nsIMsgIncomingServer* aIncomingServer) {
|
|||
|
||||
// Force built-in folders to be created and discovered. Then, notify
|
||||
// listeners about them.
|
||||
nsCOMPtr<nsISimpleEnumerator> enumerator;
|
||||
rv = rootFolder->GetSubFolders(getter_AddRefs(enumerator));
|
||||
nsTArray<RefPtr<nsIMsgFolder>> subFolders;
|
||||
rv = rootFolder->GetSubFolders(subFolders);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
bool hasMore;
|
||||
while (NS_SUCCEEDED(enumerator->HasMoreElements(&hasMore)) && hasMore) {
|
||||
nsCOMPtr<nsISupports> item;
|
||||
enumerator->GetNext(getter_AddRefs(item));
|
||||
|
||||
nsCOMPtr<nsIMsgFolder> msgFolder(do_QueryInterface(item));
|
||||
if (!msgFolder) continue;
|
||||
for (nsIMsgFolder* msgFolder : subFolders) {
|
||||
mailSession->OnItemAdded(rootFolder, msgFolder);
|
||||
notifier->NotifyFolderAdded(msgFolder);
|
||||
}
|
||||
|
|
|
@ -1474,25 +1474,16 @@ nsMsgAccountManager::CleanupOnExit() {
|
|||
if (isImap) urlListener = do_QueryInterface(accountManager, &rv);
|
||||
|
||||
if (isImap && cleanupInboxOnExit) {
|
||||
nsCOMPtr<nsISimpleEnumerator> enumerator;
|
||||
rv = root->GetSubFolders(getter_AddRefs(enumerator));
|
||||
nsTArray<RefPtr<nsIMsgFolder>> subFolders;
|
||||
rv = root->GetSubFolders(subFolders);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
bool hasMore;
|
||||
while (NS_SUCCEEDED(enumerator->HasMoreElements(&hasMore)) &&
|
||||
hasMore) {
|
||||
nsCOMPtr<nsISupports> item;
|
||||
enumerator->GetNext(getter_AddRefs(item));
|
||||
|
||||
nsCOMPtr<nsIMsgFolder> inboxFolder(do_QueryInterface(item));
|
||||
if (!inboxFolder) continue;
|
||||
|
||||
for (nsIMsgFolder* folder : subFolders) {
|
||||
uint32_t flags;
|
||||
inboxFolder->GetFlags(&flags);
|
||||
folder->GetFlags(&flags);
|
||||
if (flags & nsMsgFolderFlags::Inbox) {
|
||||
rv = inboxFolder->Compact(urlListener,
|
||||
nullptr /* msgwindow */);
|
||||
rv = folder->Compact(urlListener, nullptr /* msgwindow */);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
accountManager->SetFolderDoingCleanupInbox(inboxFolder);
|
||||
accountManager->SetFolderDoingCleanupInbox(folder);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2664,10 +2664,13 @@ typedef bool
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgDBFolder::GetSubFolders(nsISimpleEnumerator** aResult) {
|
||||
return aResult ? NS_NewArrayEnumerator(aResult, mSubFolders,
|
||||
NS_GET_IID(nsIMsgFolder))
|
||||
: NS_ERROR_NULL_POINTER;
|
||||
nsMsgDBFolder::GetSubFolders(nsTArray<RefPtr<nsIMsgFolder>>& folders) {
|
||||
folders.ClearAndRetainStorage();
|
||||
folders.SetCapacity(mSubFolders.Length());
|
||||
for (nsIMsgFolder* f : mSubFolders) {
|
||||
folders.AppendElement(f);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -3113,18 +3116,17 @@ NS_IMETHODIMP nsMsgDBFolder::GetAbbreviatedName(nsAString& aAbbreviatedName) {
|
|||
NS_IMETHODIMP
|
||||
nsMsgDBFolder::GetChildNamed(const nsAString& aName, nsIMsgFolder** aChild) {
|
||||
NS_ENSURE_ARG_POINTER(aChild);
|
||||
nsCOMPtr<nsISimpleEnumerator> dummy;
|
||||
GetSubFolders(getter_AddRefs(dummy)); // initialize mSubFolders
|
||||
nsTArray<RefPtr<nsIMsgFolder>> dummy;
|
||||
GetSubFolders(dummy); // initialize mSubFolders
|
||||
*aChild = nullptr;
|
||||
int32_t count = mSubFolders.Count();
|
||||
|
||||
for (int32_t i = 0; i < count; i++) {
|
||||
for (nsIMsgFolder* child : mSubFolders) {
|
||||
nsString folderName;
|
||||
nsresult rv = mSubFolders[i]->GetName(folderName);
|
||||
nsresult rv = child->GetName(folderName);
|
||||
// case-insensitive compare is probably LCD across OS filesystems
|
||||
if (NS_SUCCEEDED(rv) &&
|
||||
folderName.Equals(aName, nsCaseInsensitiveStringComparator)) {
|
||||
NS_ADDREF(*aChild = mSubFolders[i]);
|
||||
NS_ADDREF(*aChild = child);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
@ -3140,17 +3142,11 @@ NS_IMETHODIMP nsMsgDBFolder::GetChildWithURI(const nsACString& uri, bool deep,
|
|||
NS_ENSURE_ARG_POINTER(child);
|
||||
// will return nullptr if we can't find it
|
||||
*child = nullptr;
|
||||
nsCOMPtr<nsISimpleEnumerator> enumerator;
|
||||
nsresult rv = GetSubFolders(getter_AddRefs(enumerator));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsTArray<RefPtr<nsIMsgFolder>> subFolders;
|
||||
nsresult rv = GetSubFolders(subFolders);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
bool hasMore;
|
||||
while (NS_SUCCEEDED(enumerator->HasMoreElements(&hasMore)) && hasMore) {
|
||||
nsCOMPtr<nsISupports> item;
|
||||
enumerator->GetNext(getter_AddRefs(item));
|
||||
|
||||
nsCOMPtr<nsIMsgFolder> folder(do_QueryInterface(item));
|
||||
if (folder) {
|
||||
for (nsIMsgFolder* folder : subFolders) {
|
||||
nsCString folderURI;
|
||||
rv = folder->GetURI(folderURI);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -3159,7 +3155,7 @@ NS_IMETHODIMP nsMsgDBFolder::GetChildWithURI(const nsACString& uri, bool deep,
|
|||
? uri.Equals(folderURI, nsCaseInsensitiveCStringComparator)
|
||||
: uri.Equals(folderURI));
|
||||
if (equal) {
|
||||
folder.forget(child);
|
||||
NS_ADDREF(*child = folder);
|
||||
return NS_OK;
|
||||
}
|
||||
if (deep) {
|
||||
|
@ -3169,7 +3165,6 @@ NS_IMETHODIMP nsMsgDBFolder::GetChildWithURI(const nsACString& uri, bool deep,
|
|||
if (*child) return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -3415,18 +3410,11 @@ nsresult nsMsgDBFolder::CheckIfFolderExists(const nsAString& newFolderName,
|
|||
nsIMsgFolder* parentFolder,
|
||||
nsIMsgWindow* msgWindow) {
|
||||
NS_ENSURE_ARG_POINTER(parentFolder);
|
||||
nsCOMPtr<nsISimpleEnumerator> subFolders;
|
||||
nsresult rv = parentFolder->GetSubFolders(getter_AddRefs(subFolders));
|
||||
nsTArray<RefPtr<nsIMsgFolder>> subFolders;
|
||||
nsresult rv = parentFolder->GetSubFolders(subFolders);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
bool hasMore;
|
||||
while (NS_SUCCEEDED(subFolders->HasMoreElements(&hasMore)) && hasMore) {
|
||||
nsCOMPtr<nsISupports> item;
|
||||
rv = subFolders->GetNext(getter_AddRefs(item));
|
||||
|
||||
nsCOMPtr<nsIMsgFolder> msgFolder(do_QueryInterface(item));
|
||||
if (!msgFolder) break;
|
||||
|
||||
for (nsIMsgFolder* msgFolder : subFolders) {
|
||||
nsString folderName;
|
||||
|
||||
msgFolder->GetName(folderName);
|
||||
|
@ -3955,8 +3943,8 @@ NS_IMETHODIMP nsMsgDBFolder::GetFolderWithFlags(uint32_t aFlags,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> dummy;
|
||||
GetSubFolders(getter_AddRefs(dummy)); // initialize mSubFolders
|
||||
nsTArray<RefPtr<nsIMsgFolder>> dummy;
|
||||
GetSubFolders(dummy); // initialize mSubFolders
|
||||
|
||||
int32_t count = mSubFolders.Count();
|
||||
*aResult = nullptr;
|
||||
|
@ -3971,15 +3959,15 @@ NS_IMETHODIMP nsMsgDBFolder::GetFoldersWithFlags(
|
|||
aResult.Clear();
|
||||
|
||||
// Ensure initialisation of mSubFolders.
|
||||
nsCOMPtr<nsISimpleEnumerator> dummy;
|
||||
GetSubFolders(getter_AddRefs(dummy));
|
||||
nsTArray<RefPtr<nsIMsgFolder>> dummy;
|
||||
GetSubFolders(dummy);
|
||||
|
||||
if ((mFlags & aFlags) == aFlags) {
|
||||
aResult.AppendElement(this);
|
||||
}
|
||||
|
||||
// Recurse down through children.
|
||||
for (auto child : mSubFolders) {
|
||||
for (nsIMsgFolder* child : mSubFolders) {
|
||||
nsTArray<RefPtr<nsIMsgFolder>> subMatches;
|
||||
child->GetFoldersWithFlags(aFlags, subMatches);
|
||||
aResult.AppendElements(subMatches);
|
||||
|
|
|
@ -115,7 +115,7 @@ add_task(async () => {
|
|||
EventUtils.synthesizeMouseAtCenter(menuItem, {});
|
||||
await Promise.all([hiddenPromise, dialogPromise]);
|
||||
|
||||
let folder = [...rootFolder.subFolders].find(f => f.name == "Test Feed");
|
||||
let folder = rootFolder.subFolders.find(f => f.name == "Test Feed");
|
||||
Assert.ok(folder);
|
||||
|
||||
index = window.gFolderTreeView.getIndexOfFolder(folder);
|
||||
|
|
|
@ -1532,69 +1532,52 @@ bool nsImapIncomingServer::CheckSpecialFolder(nsCString& folderUri,
|
|||
|
||||
bool nsImapIncomingServer::NoDescendentsAreVerified(
|
||||
nsIMsgFolder* parentFolder) {
|
||||
bool nobodyIsVerified = true;
|
||||
nsCOMPtr<nsISimpleEnumerator> subFolders;
|
||||
nsresult rv = parentFolder->GetSubFolders(getter_AddRefs(subFolders));
|
||||
nsTArray<RefPtr<nsIMsgFolder>> subFolders;
|
||||
nsresult rv = parentFolder->GetSubFolders(subFolders);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
bool moreFolders;
|
||||
while (NS_SUCCEEDED(subFolders->HasMoreElements(&moreFolders)) &&
|
||||
moreFolders && nobodyIsVerified) {
|
||||
nsCOMPtr<nsISupports> child;
|
||||
rv = subFolders->GetNext(getter_AddRefs(child));
|
||||
if (NS_SUCCEEDED(rv) && child) {
|
||||
bool childVerified = false;
|
||||
for (nsIMsgFolder* child : subFolders) {
|
||||
nsCOMPtr<nsIMsgImapMailFolder> childImapFolder =
|
||||
do_QueryInterface(child, &rv);
|
||||
if (NS_SUCCEEDED(rv) && childImapFolder) {
|
||||
nsCOMPtr<nsIMsgFolder> childFolder = do_QueryInterface(child, &rv);
|
||||
bool childVerified = false;
|
||||
rv = childImapFolder->GetVerifiedAsOnlineFolder(&childVerified);
|
||||
nobodyIsVerified =
|
||||
!childVerified && NoDescendentsAreVerified(childFolder);
|
||||
if (NS_SUCCEEDED(rv) && childVerified) {
|
||||
return false;
|
||||
}
|
||||
if (!NoDescendentsAreVerified(child)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return nobodyIsVerified;
|
||||
// If we get this far we didn't find any verified.
|
||||
return true;
|
||||
}
|
||||
|
||||
bool nsImapIncomingServer::AllDescendentsAreNoSelect(
|
||||
nsIMsgFolder* parentFolder) {
|
||||
bool allDescendentsAreNoSelect = true;
|
||||
nsCOMPtr<nsISimpleEnumerator> subFolders;
|
||||
nsresult rv = parentFolder->GetSubFolders(getter_AddRefs(subFolders));
|
||||
nsTArray<RefPtr<nsIMsgFolder>> subFolders;
|
||||
nsresult rv = parentFolder->GetSubFolders(subFolders);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
bool moreFolders;
|
||||
while (NS_SUCCEEDED(subFolders->HasMoreElements(&moreFolders)) &&
|
||||
moreFolders && allDescendentsAreNoSelect) {
|
||||
nsCOMPtr<nsISupports> child;
|
||||
rv = subFolders->GetNext(getter_AddRefs(child));
|
||||
if (NS_SUCCEEDED(rv) && child) {
|
||||
bool childIsNoSelect = false;
|
||||
for (nsIMsgFolder* child : subFolders) {
|
||||
nsCOMPtr<nsIMsgImapMailFolder> childImapFolder =
|
||||
do_QueryInterface(child, &rv);
|
||||
if (NS_SUCCEEDED(rv) && childImapFolder) {
|
||||
uint32_t flags;
|
||||
nsCOMPtr<nsIMsgFolder> childFolder = do_QueryInterface(child, &rv);
|
||||
rv = childFolder->GetFlags(&flags);
|
||||
childIsNoSelect =
|
||||
rv = child->GetFlags(&flags);
|
||||
bool isNoSelect =
|
||||
NS_SUCCEEDED(rv) && (flags & nsMsgFolderFlags::ImapNoselect);
|
||||
allDescendentsAreNoSelect =
|
||||
!childIsNoSelect && AllDescendentsAreNoSelect(childFolder);
|
||||
if (!isNoSelect) {
|
||||
return false;
|
||||
}
|
||||
if (!AllDescendentsAreNoSelect(child)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
int numberOfSubfolders = parentFolder->GetNumSubFolders();
|
||||
|
||||
for (int childIndex=0; allDescendantsAreNoSelect && (childIndex < numberOfSubfolders); childIndex++)
|
||||
{
|
||||
MSG_IMAPFolderInfoMail *currentChild = (MSG_IMAPFolderInfoMail *) parentFolder->GetSubFolder(childIndex);
|
||||
allDescendentsAreNoSelect = (currentChild->GetFolderPrefFlags() & MSG_FOLDER_PREF_IMAPNOSELECT) &&
|
||||
AllDescendentsAreNoSelect(currentChild);
|
||||
}
|
||||
#endif // 0
|
||||
return allDescendentsAreNoSelect;
|
||||
// If we get this far we found none without the Noselect flag.
|
||||
return true;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1785,26 +1768,17 @@ nsresult nsImapIncomingServer::ResetFoldersToUnverified(
|
|||
return ResetFoldersToUnverified(rootFolder);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> subFolders;
|
||||
nsCOMPtr<nsIMsgImapMailFolder> imapFolder =
|
||||
do_QueryInterface(parentFolder, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = imapFolder->SetVerifiedAsOnlineFolder(false);
|
||||
rv = parentFolder->GetSubFolders(getter_AddRefs(subFolders));
|
||||
nsTArray<RefPtr<nsIMsgFolder>> subFolders;
|
||||
rv = parentFolder->GetSubFolders(subFolders);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
bool moreFolders = false;
|
||||
while (NS_SUCCEEDED(subFolders->HasMoreElements(&moreFolders)) &&
|
||||
moreFolders) {
|
||||
nsCOMPtr<nsISupports> child;
|
||||
rv = subFolders->GetNext(getter_AddRefs(child));
|
||||
if (NS_SUCCEEDED(rv) && child) {
|
||||
nsCOMPtr<nsIMsgFolder> childFolder = do_QueryInterface(child, &rv);
|
||||
if (NS_SUCCEEDED(rv) && childFolder) {
|
||||
rv = ResetFoldersToUnverified(childFolder);
|
||||
if (NS_FAILED(rv)) break;
|
||||
}
|
||||
}
|
||||
for (nsIMsgFolder* child : subFolders) {
|
||||
rv = ResetFoldersToUnverified(child);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
@ -1838,18 +1812,10 @@ void nsImapIncomingServer::GetUnverifiedSubFolders(
|
|||
aFoldersArray.AppendObject(imapFolder);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> subFolders;
|
||||
if (NS_SUCCEEDED(parentFolder->GetSubFolders(getter_AddRefs(subFolders)))) {
|
||||
bool moreFolders;
|
||||
|
||||
while (NS_SUCCEEDED(subFolders->HasMoreElements(&moreFolders)) &&
|
||||
moreFolders) {
|
||||
nsCOMPtr<nsISupports> child;
|
||||
subFolders->GetNext(getter_AddRefs(child));
|
||||
if (child) {
|
||||
nsCOMPtr<nsIMsgFolder> childFolder(do_QueryInterface(child));
|
||||
if (childFolder) GetUnverifiedSubFolders(childFolder, aFoldersArray);
|
||||
}
|
||||
nsTArray<RefPtr<nsIMsgFolder>> subFolders;
|
||||
if (NS_SUCCEEDED(parentFolder->GetSubFolders(subFolders))) {
|
||||
for (nsIMsgFolder* child : subFolders) {
|
||||
GetUnverifiedSubFolders(child, aFoldersArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2760,20 +2726,10 @@ nsImapIncomingServer::GetNewMessagesForNonInboxFolders(nsIMsgFolder* aFolder,
|
|||
}
|
||||
|
||||
// Loop through all subfolders to get new messages for them.
|
||||
nsCOMPtr<nsISimpleEnumerator> enumerator;
|
||||
rv = aFolder->GetSubFolders(getter_AddRefs(enumerator));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
bool hasMore;
|
||||
while (NS_SUCCEEDED(enumerator->HasMoreElements(&hasMore)) && hasMore) {
|
||||
nsCOMPtr<nsISupports> item;
|
||||
enumerator->GetNext(getter_AddRefs(item));
|
||||
|
||||
nsCOMPtr<nsIMsgFolder> msgFolder(do_QueryInterface(item));
|
||||
if (!msgFolder) {
|
||||
NS_WARNING("Not an nsIMsgFolder");
|
||||
continue;
|
||||
}
|
||||
nsTArray<RefPtr<nsIMsgFolder>> subFolders;
|
||||
rv = aFolder->GetSubFolders(subFolders);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
for (nsIMsgFolder* msgFolder : subFolders) {
|
||||
GetNewMessagesForNonInboxFolders(msgFolder, aWindow, forceAllFolders,
|
||||
performingBiff);
|
||||
}
|
||||
|
|
|
@ -514,7 +514,8 @@ nsresult nsImapMailFolder::CreateSubFolders(nsIFile* path) {
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapMailFolder::GetSubFolders(nsISimpleEnumerator** aResult) {
|
||||
NS_IMETHODIMP nsImapMailFolder::GetSubFolders(
|
||||
nsTArray<RefPtr<nsIMsgFolder>>& folders) {
|
||||
bool isServer;
|
||||
nsresult rv = GetIsServer(&isServer);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -554,18 +555,20 @@ NS_IMETHODIMP nsImapMailFolder::GetSubFolders(nsISimpleEnumerator** aResult) {
|
|||
}
|
||||
}
|
||||
|
||||
int32_t count = mSubFolders.Count();
|
||||
nsCOMPtr<nsISimpleEnumerator> dummy;
|
||||
for (int32_t i = 0; i < count; i++)
|
||||
mSubFolders[i]->GetSubFolders(getter_AddRefs(dummy));
|
||||
// Force initialisation recursively.
|
||||
for (nsIMsgFolder* f : mSubFolders) {
|
||||
nsTArray<RefPtr<nsIMsgFolder>> dummy;
|
||||
rv = f->GetSubFolders(dummy);
|
||||
if (NS_FAILED(rv)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
UpdateSummaryTotals(false);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
return aResult ? NS_NewArrayEnumerator(aResult, mSubFolders,
|
||||
NS_GET_IID(nsIMsgFolder))
|
||||
: NS_ERROR_NULL_POINTER;
|
||||
return nsMsgDBFolder::GetSubFolders(folders);
|
||||
}
|
||||
|
||||
// Makes sure the database is open and exists. If the database is valid then
|
||||
|
@ -1372,31 +1375,14 @@ NS_IMETHODIMP nsImapMailFolder::EmptyTrash(nsIMsgWindow* aMsgWindow,
|
|||
// finish.
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
bool hasSubfolders = false;
|
||||
rv = trashFolder->GetHasSubFolders(&hasSubfolders);
|
||||
// Delete any subfolders under Trash.
|
||||
nsTArray<RefPtr<nsIMsgFolder>> subFolders;
|
||||
rv = trashFolder->GetSubFolders(subFolders);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (hasSubfolders) {
|
||||
nsCOMPtr<nsISimpleEnumerator> enumerator;
|
||||
nsCOMPtr<nsISupports> item;
|
||||
nsCOMArray<nsIMsgFolder> array;
|
||||
|
||||
rv = trashFolder->GetSubFolders(getter_AddRefs(enumerator));
|
||||
while (!subFolders.IsEmpty()) {
|
||||
RefPtr<nsIMsgFolder> f = subFolders.PopLastElement();
|
||||
rv = trashFolder->PropagateDelete(f, true, aMsgWindow);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
bool hasMore;
|
||||
while (NS_SUCCEEDED(enumerator->HasMoreElements(&hasMore)) && hasMore) {
|
||||
rv = enumerator->GetNext(getter_AddRefs(item));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIMsgFolder> folder(do_QueryInterface(item, &rv));
|
||||
if (NS_SUCCEEDED(rv)) array.AppendObject(folder);
|
||||
}
|
||||
}
|
||||
for (int32_t i = array.Count() - 1; i >= 0; i--) {
|
||||
trashFolder->PropagateDelete(array[i], true, aMsgWindow);
|
||||
// Remove the object, presumably to free it up before we delete the
|
||||
// next.
|
||||
array.RemoveObjectAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDBFolderInfo> transferInfo;
|
||||
|
@ -7162,35 +7148,29 @@ nsImapFolderCopyState::OnStopRunningUrl(nsIURI* aUrl, nsresult aExitCode) {
|
|||
// check if the source folder has children. If it does, list them
|
||||
// into m_srcChildFolders, and set m_destParents for the
|
||||
// corresponding indexes to the newly created folder.
|
||||
nsCOMPtr<nsISimpleEnumerator> enumerator;
|
||||
rv = m_curSrcFolder->GetSubFolders(getter_AddRefs(enumerator));
|
||||
nsTArray<RefPtr<nsIMsgFolder>> subFolders;
|
||||
rv = m_curSrcFolder->GetSubFolders(subFolders);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsISupports> item;
|
||||
bool hasMore = false;
|
||||
uint32_t childIndex = 0;
|
||||
while (NS_SUCCEEDED(enumerator->HasMoreElements(&hasMore)) &&
|
||||
hasMore) {
|
||||
rv = enumerator->GetNext(getter_AddRefs(item));
|
||||
nsCOMPtr<nsIMsgFolder> folder(do_QueryInterface(item, &rv));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
for (nsIMsgFolder* folder : subFolders) {
|
||||
m_srcChildFolders.InsertElementAt(m_childIndex + childIndex + 1,
|
||||
folder);
|
||||
m_destParents.InsertElementAt(m_childIndex + childIndex + 1,
|
||||
newMsgFolder);
|
||||
}
|
||||
++childIndex;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> enumerator;
|
||||
rv = m_curSrcFolder->GetMessages(getter_AddRefs(enumerator));
|
||||
nsTArray<RefPtr<nsIMsgDBHdr>> msgArray;
|
||||
hasMore = false;
|
||||
bool hasMore = false;
|
||||
|
||||
if (enumerator) rv = enumerator->HasMoreElements(&hasMore);
|
||||
|
||||
if (!hasMore) return AdvanceToNextFolder(NS_OK);
|
||||
|
||||
while (NS_SUCCEEDED(rv) && hasMore) {
|
||||
nsCOMPtr<nsISupports> item;
|
||||
rv = enumerator->GetNext(getter_AddRefs(item));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIMsgDBHdr> hdr(do_QueryInterface(item, &rv));
|
||||
|
@ -7818,53 +7798,45 @@ NS_IMETHODIMP nsImapMailFolder::ResetNamespaceReferences() {
|
|||
hierarchyDelimiter, m_namespace)
|
||||
: false;
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> enumerator;
|
||||
GetSubFolders(getter_AddRefs(enumerator));
|
||||
if (!enumerator) return NS_OK;
|
||||
nsTArray<RefPtr<nsIMsgFolder>> subFolders;
|
||||
nsresult rv = GetSubFolders(subFolders);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsresult rv;
|
||||
bool hasMore;
|
||||
while (NS_SUCCEEDED(enumerator->HasMoreElements(&hasMore)) && hasMore) {
|
||||
nsCOMPtr<nsISupports> item;
|
||||
rv = enumerator->GetNext(getter_AddRefs(item));
|
||||
if (NS_FAILED(rv)) break;
|
||||
|
||||
nsCOMPtr<nsIMsgImapMailFolder> folder(do_QueryInterface(item, &rv));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
folder->ResetNamespaceReferences();
|
||||
for (nsIMsgFolder* f : subFolders) {
|
||||
nsCOMPtr<nsIMsgImapMailFolder> imapFolder(do_QueryInterface(f, &rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = imapFolder->ResetNamespaceReferences();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
return rv;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapMailFolder::FindOnlineSubFolder(
|
||||
const nsACString& targetOnlineName, nsIMsgImapMailFolder** aResultFolder) {
|
||||
*aResultFolder = nullptr;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsCString onlineName;
|
||||
GetOnlineName(onlineName);
|
||||
|
||||
if (onlineName.Equals(targetOnlineName))
|
||||
if (onlineName.Equals(targetOnlineName)) {
|
||||
return QueryInterface(NS_GET_IID(nsIMsgImapMailFolder),
|
||||
(void**)aResultFolder);
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> enumerator;
|
||||
GetSubFolders(getter_AddRefs(enumerator));
|
||||
if (!enumerator) return NS_OK;
|
||||
|
||||
bool hasMore;
|
||||
while (NS_SUCCEEDED(enumerator->HasMoreElements(&hasMore)) && hasMore) {
|
||||
nsCOMPtr<nsISupports> item;
|
||||
rv = enumerator->GetNext(getter_AddRefs(item));
|
||||
if (NS_FAILED(rv)) break;
|
||||
|
||||
nsCOMPtr<nsIMsgImapMailFolder> folder(do_QueryInterface(item, &rv));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = folder->FindOnlineSubFolder(targetOnlineName, aResultFolder);
|
||||
if (*aResultFolder) return rv;
|
||||
}
|
||||
return rv;
|
||||
|
||||
nsTArray<RefPtr<nsIMsgFolder>> subFolders;
|
||||
rv = GetSubFolders(subFolders);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
for (nsIMsgFolder* f : subFolders) {
|
||||
nsCOMPtr<nsIMsgImapMailFolder> imapFolder(do_QueryInterface(f, &rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = imapFolder->FindOnlineSubFolder(targetOnlineName, aResultFolder);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (*aResultFolder) {
|
||||
return NS_OK; // Found it!
|
||||
}
|
||||
}
|
||||
return NS_OK; // Not found.
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapMailFolder::GetFolderNeedsAdded(bool* bVal) {
|
||||
|
@ -8060,20 +8032,13 @@ NS_IMETHODIMP nsImapMailFolder::RenameClient(nsIMsgWindow* msgWindow,
|
|||
NS_IMETHODIMP nsImapMailFolder::RenameSubFolders(nsIMsgWindow* msgWindow,
|
||||
nsIMsgFolder* oldFolder) {
|
||||
m_initialized = true;
|
||||
nsCOMPtr<nsISimpleEnumerator> enumerator;
|
||||
nsresult rv = oldFolder->GetSubFolders(getter_AddRefs(enumerator));
|
||||
nsTArray<RefPtr<nsIMsgFolder>> subFolders;
|
||||
nsresult rv = oldFolder->GetSubFolders(subFolders);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
bool hasMore;
|
||||
while (NS_SUCCEEDED(enumerator->HasMoreElements(&hasMore)) && hasMore) {
|
||||
nsCOMPtr<nsISupports> item;
|
||||
if (NS_FAILED(enumerator->GetNext(getter_AddRefs(item)))) continue;
|
||||
|
||||
nsCOMPtr<nsIMsgFolder> msgFolder(do_QueryInterface(item, &rv));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
for (nsIMsgFolder* msgFolder : subFolders) {
|
||||
nsCOMPtr<nsIMsgImapMailFolder> folder(do_QueryInterface(msgFolder, &rv));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
char hierarchyDelimiter = '/';
|
||||
folder->GetHierarchyDelimiter(&hierarchyDelimiter);
|
||||
|
|
|
@ -221,7 +221,7 @@ class nsImapMailFolder : public nsMsgDBFolder,
|
|||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIMsgFolder methods:
|
||||
NS_IMETHOD GetSubFolders(nsISimpleEnumerator** aResult) override;
|
||||
NS_IMETHOD GetSubFolders(nsTArray<RefPtr<nsIMsgFolder>>& folders) override;
|
||||
|
||||
NS_IMETHOD UpdateFolder(nsIMsgWindow* aWindow) override;
|
||||
|
||||
|
|
|
@ -609,26 +609,18 @@ nsresult nsBeckyFilters::FindMessageFolder(const nsAString& aName,
|
|||
nsCOMPtr<nsIMsgFolder> found;
|
||||
rv = aParentFolder->GetChildNamed(aName, getter_AddRefs(found));
|
||||
if (found) {
|
||||
found.forget(_retval);
|
||||
NS_ADDREF(*_retval = found);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> children;
|
||||
rv = aParentFolder->GetSubFolders(getter_AddRefs(children));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
bool more;
|
||||
nsCOMPtr<nsISupports> entry;
|
||||
while (NS_SUCCEEDED(children->HasMoreElements(&more)) && more) {
|
||||
rv = children->GetNext(getter_AddRefs(entry));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIMsgFolder> child = do_QueryInterface(entry, &rv);
|
||||
nsTArray<RefPtr<nsIMsgFolder>> children;
|
||||
rv = aParentFolder->GetSubFolders(children);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
for (nsIMsgFolder* child : children) {
|
||||
rv = FindMessageFolder(aName, child, getter_AddRefs(found));
|
||||
if (found) {
|
||||
found.forget(_retval);
|
||||
NS_ADDREF(*_retval = found);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -710,8 +710,8 @@ bool nsImportGenericMail::CreateFolder(nsIMsgFolder** ppFolder) {
|
|||
if (localRootFolder) {
|
||||
// we need to call GetSubFolders() so that the folders get initialized
|
||||
// if they are not initialized yet.
|
||||
nsCOMPtr<nsISimpleEnumerator> aEnumerator;
|
||||
rv = localRootFolder->GetSubFolders(getter_AddRefs(aEnumerator));
|
||||
nsTArray<RefPtr<nsIMsgFolder>> dummy;
|
||||
rv = localRootFolder->GetSubFolders(dummy);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// check if the folder name we picked already exists.
|
||||
bool exists = false;
|
||||
|
@ -772,8 +772,8 @@ GetSubFoldersRunnable::GetSubFoldersRunnable(nsIMsgFolder* aFolder)
|
|||
: mozilla::Runnable("GetSubFoldersRunnable"), m_folder(aFolder) {}
|
||||
|
||||
NS_IMETHODIMP GetSubFoldersRunnable::Run() {
|
||||
nsCOMPtr<nsISimpleEnumerator> dummy;
|
||||
mResult = m_folder->GetSubFolders(getter_AddRefs(dummy));
|
||||
nsTArray<RefPtr<nsIMsgFolder>> dummy;
|
||||
mResult = m_folder->GetSubFolders(dummy);
|
||||
return NS_OK; // Sync runnable must return OK.
|
||||
}
|
||||
|
||||
|
|
|
@ -407,24 +407,17 @@ MailImportHelper.prototype = {
|
|||
interfaceType: Ci.nsIImportGeneric,
|
||||
_checkEqualFolder(expectedFolder, actualFolder) {
|
||||
Assert.equal(expectedFolder.leafName, actualFolder.name);
|
||||
let expectedSubFolderCount = 0;
|
||||
|
||||
let expectedSubFolders = [];
|
||||
for (let entry of expectedFolder.directoryEntries) {
|
||||
if (entry.isDirectory()) {
|
||||
expectedSubFolderCount++;
|
||||
expectedSubFolders.push(entry);
|
||||
}
|
||||
}
|
||||
Assert.equal(expectedSubFolderCount, actualFolder.numSubFolders);
|
||||
|
||||
let actualEnumerator = actualFolder.subFolders;
|
||||
for (let i = 0; i < expectedSubFolderCount; i++) {
|
||||
let expectedSubFolder = expectedSubFolders[i];
|
||||
let actualSubFolder = actualEnumerator
|
||||
.getNext()
|
||||
.QueryInterface(Ci.nsIMsgFolder);
|
||||
this._checkEqualFolder(expectedSubFolder, actualSubFolder);
|
||||
let actualSubFolders = actualFolder.subFolders;
|
||||
Assert.equal(expectedSubFolders.length, actualSubFolders.length);
|
||||
for (let i = 0; i < expectedSubFolders.length; i++) {
|
||||
this._checkEqualFolder(expectedSubFolders[i], actualSubFolders[i]);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -171,7 +171,7 @@ nsMsgLocalMailFolder::GetMsgDatabase(nsIMsgDatabase** aMsgDatabase) {
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgLocalMailFolder::GetSubFolders(nsISimpleEnumerator** aResult) {
|
||||
nsMsgLocalMailFolder::GetSubFolders(nsTArray<RefPtr<nsIMsgFolder>>& folders) {
|
||||
if (!mInitialized) {
|
||||
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||
nsresult rv = GetServer(getter_AddRefs(server));
|
||||
|
@ -218,9 +218,7 @@ nsMsgLocalMailFolder::GetSubFolders(nsISimpleEnumerator** aResult) {
|
|||
UpdateSummaryTotals(false);
|
||||
}
|
||||
|
||||
return aResult ? NS_NewArrayEnumerator(aResult, mSubFolders,
|
||||
NS_GET_IID(nsIMsgFolder))
|
||||
: NS_ERROR_NULL_POINTER;
|
||||
return nsMsgDBFolder::GetSubFolders(folders);
|
||||
}
|
||||
|
||||
nsresult nsMsgLocalMailFolder::GetDatabase() {
|
||||
|
@ -543,13 +541,13 @@ NS_IMETHODIMP nsMsgLocalMailFolder::EmptyTrash(nsIMsgWindow* msgWindow,
|
|||
int32_t totalMessages = 0;
|
||||
rv = trashFolder->GetTotalMessages(true, &totalMessages);
|
||||
if (totalMessages <= 0) {
|
||||
nsCOMPtr<nsISimpleEnumerator> enumerator;
|
||||
rv = trashFolder->GetSubFolders(getter_AddRefs(enumerator));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
// Any folders to deal with?
|
||||
bool hasMore;
|
||||
rv = enumerator->HasMoreElements(&hasMore);
|
||||
if (NS_FAILED(rv) || !hasMore) return NS_OK;
|
||||
nsTArray<RefPtr<nsIMsgFolder>> subFolders;
|
||||
rv = trashFolder->GetSubFolders(subFolders);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (subFolders.IsEmpty()) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
nsCOMPtr<nsIMsgFolder> parentFolder;
|
||||
rv = trashFolder->GetParent(getter_AddRefs(parentFolder));
|
||||
|
@ -755,8 +753,8 @@ NS_IMETHODIMP nsMsgLocalMailFolder::Rename(const nsAString& aNewName,
|
|||
if (count > 0) newFolder->RenameSubFolders(msgWindow, this);
|
||||
|
||||
// Discover the subfolders inside this folder (this is recursive)
|
||||
nsCOMPtr<nsISimpleEnumerator> dummy;
|
||||
newFolder->GetSubFolders(getter_AddRefs(dummy));
|
||||
nsTArray<RefPtr<nsIMsgFolder>> dummy;
|
||||
newFolder->GetSubFolders(dummy);
|
||||
|
||||
// the newFolder should have the same flags
|
||||
newFolder->SetFlags(mFlags);
|
||||
|
@ -785,18 +783,11 @@ NS_IMETHODIMP nsMsgLocalMailFolder::RenameSubFolders(nsIMsgWindow* msgWindow,
|
|||
oldFolder->GetFlags(&flags);
|
||||
SetFlags(flags);
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> enumerator;
|
||||
rv = oldFolder->GetSubFolders(getter_AddRefs(enumerator));
|
||||
nsTArray<RefPtr<nsIMsgFolder>> subFolders;
|
||||
rv = oldFolder->GetSubFolders(subFolders);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
bool hasMore;
|
||||
while (NS_SUCCEEDED(enumerator->HasMoreElements(&hasMore)) && hasMore) {
|
||||
nsCOMPtr<nsISupports> item;
|
||||
enumerator->GetNext(getter_AddRefs(item));
|
||||
|
||||
nsCOMPtr<nsIMsgFolder> msgFolder(do_QueryInterface(item));
|
||||
if (!msgFolder) continue;
|
||||
|
||||
for (nsIMsgFolder* msgFolder : subFolders) {
|
||||
nsString folderName;
|
||||
rv = msgFolder->GetName(folderName);
|
||||
nsCOMPtr<nsIMsgFolder> newFolder;
|
||||
|
@ -1509,19 +1500,14 @@ nsresult // copy the sub folders
|
|||
nsMsgLocalMailFolder::CopyAllSubFolders(nsIMsgFolder* srcFolder,
|
||||
nsIMsgWindow* msgWindow,
|
||||
nsIMsgCopyServiceListener* listener) {
|
||||
nsCOMPtr<nsISimpleEnumerator> enumerator;
|
||||
nsresult rv = srcFolder->GetSubFolders(getter_AddRefs(enumerator));
|
||||
nsTArray<RefPtr<nsIMsgFolder>> subFolders;
|
||||
nsresult rv = srcFolder->GetSubFolders(subFolders);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
bool hasMore;
|
||||
while (NS_SUCCEEDED(enumerator->HasMoreElements(&hasMore)) && hasMore) {
|
||||
nsCOMPtr<nsISupports> item;
|
||||
enumerator->GetNext(getter_AddRefs(item));
|
||||
|
||||
nsCOMPtr<nsIMsgFolder> folder(do_QueryInterface(item));
|
||||
if (folder) CopyFolderAcrossServer(folder, msgWindow, listener);
|
||||
for (nsIMsgFolder* folder : subFolders) {
|
||||
CopyFolderAcrossServer(folder, msgWindow, listener);
|
||||
}
|
||||
return rv;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -106,7 +106,7 @@ class nsMsgLocalMailFolder : public nsMsgDBFolder,
|
|||
NS_IMETHOD OnStopRunningUrl(nsIURI* aUrl, nsresult aExitCode) override;
|
||||
|
||||
// nsIMsgFolder methods:
|
||||
NS_IMETHOD GetSubFolders(nsISimpleEnumerator** aResult) override;
|
||||
NS_IMETHOD GetSubFolders(nsTArray<RefPtr<nsIMsgFolder>>& folders) override;
|
||||
NS_IMETHOD GetMsgDatabase(nsIMsgDatabase** aMsgDatabase) override;
|
||||
|
||||
NS_IMETHOD OnAnnouncerGoingAway(nsIDBChangeAnnouncer* instigator) override;
|
||||
|
|
|
@ -469,8 +469,8 @@ NS_IMETHODIMP nsMsgBrkMBoxStore::CopyFolder(
|
|||
rv = aSrcFolder->MatchOrChangeFilterDestination(newMsgFolder, true, &changed);
|
||||
if (changed) aSrcFolder->AlertFilterChanged(aMsgWindow);
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> enumerator;
|
||||
rv = aSrcFolder->GetSubFolders(getter_AddRefs(enumerator));
|
||||
nsTArray<RefPtr<nsIMsgFolder>> subFolders;
|
||||
rv = aSrcFolder->GetSubFolders(subFolders);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Copy subfolders to the new location
|
||||
|
@ -478,15 +478,7 @@ NS_IMETHODIMP nsMsgBrkMBoxStore::CopyFolder(
|
|||
nsCOMPtr<nsIMsgLocalMailFolder> localNewFolder(
|
||||
do_QueryInterface(newMsgFolder, &rv));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
bool hasMore;
|
||||
while (NS_SUCCEEDED(enumerator->HasMoreElements(&hasMore)) && hasMore &&
|
||||
NS_SUCCEEDED(copyStatus)) {
|
||||
nsCOMPtr<nsISupports> item;
|
||||
enumerator->GetNext(getter_AddRefs(item));
|
||||
|
||||
nsCOMPtr<nsIMsgFolder> folder(do_QueryInterface(item));
|
||||
if (!folder) continue;
|
||||
|
||||
for (nsIMsgFolder* folder : subFolders) {
|
||||
copyStatus =
|
||||
localNewFolder->CopyFolderLocal(folder, false, aMsgWindow, aListener);
|
||||
// Test if the call succeeded, if not we have to stop recursive call
|
||||
|
|
|
@ -471,8 +471,8 @@ NS_IMETHODIMP nsMsgMaildirStore::CopyFolder(
|
|||
rv = aSrcFolder->MatchOrChangeFilterDestination(newMsgFolder, true, &changed);
|
||||
if (changed) aSrcFolder->AlertFilterChanged(aMsgWindow);
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> enumerator;
|
||||
rv = aSrcFolder->GetSubFolders(getter_AddRefs(enumerator));
|
||||
nsTArray<RefPtr<nsIMsgFolder>> subFolders;
|
||||
rv = aSrcFolder->GetSubFolders(subFolders);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Copy subfolders to the new location
|
||||
|
@ -480,15 +480,7 @@ NS_IMETHODIMP nsMsgMaildirStore::CopyFolder(
|
|||
nsCOMPtr<nsIMsgLocalMailFolder> localNewFolder(
|
||||
do_QueryInterface(newMsgFolder, &rv));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
bool hasMore;
|
||||
while (NS_SUCCEEDED(enumerator->HasMoreElements(&hasMore)) && hasMore &&
|
||||
NS_SUCCEEDED(copyStatus)) {
|
||||
nsCOMPtr<nsISupports> item;
|
||||
enumerator->GetNext(getter_AddRefs(item));
|
||||
|
||||
nsCOMPtr<nsIMsgFolder> folder(do_QueryInterface(item));
|
||||
if (!folder) continue;
|
||||
|
||||
for (nsIMsgFolder* folder : subFolders) {
|
||||
copyStatus =
|
||||
localNewFolder->CopyFolderLocal(folder, false, aMsgWindow, aListener);
|
||||
// Test if the call succeeded, if not we have to stop recursive call
|
||||
|
|
|
@ -116,19 +116,15 @@ NS_IMETHODIMP nsPop3IncomingServer::GetDeferredToAccount(nsACString& aRetVal) {
|
|||
// think Sent Mail could end up here, but if any folders have
|
||||
// messages, might as well copy them to the real Local Folders
|
||||
// account.
|
||||
nsCOMPtr<nsISimpleEnumerator> enumerator;
|
||||
rv = hiddenRootFolder->GetSubFolders(getter_AddRefs(enumerator));
|
||||
nsTArray<RefPtr<nsIMsgFolder>> subFolders;
|
||||
rv = hiddenRootFolder->GetSubFolders(subFolders);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
bool hasMore;
|
||||
while (NS_SUCCEEDED(enumerator->HasMoreElements(&hasMore)) &&
|
||||
hasMore) {
|
||||
nsCOMPtr<nsISupports> item;
|
||||
enumerator->GetNext(getter_AddRefs(item));
|
||||
nsCOMPtr<nsIMsgFolder> subFolder(do_QueryInterface(item));
|
||||
if (subFolder) {
|
||||
for (nsIMsgFolder* subFolder : subFolders) {
|
||||
nsCOMPtr<nsIMsgDatabase> subFolderDB;
|
||||
subFolder->GetMsgDatabase(getter_AddRefs(subFolderDB));
|
||||
if (subFolderDB) {
|
||||
if (!subFolderDB) {
|
||||
continue;
|
||||
}
|
||||
// Copy any messages in this sub-folder of the hidden
|
||||
// account to the corresponding folder in Local Folders.
|
||||
nsTArray<nsMsgKey> keys;
|
||||
|
@ -145,17 +141,16 @@ NS_IMETHODIMP nsPop3IncomingServer::GetDeferredToAccount(nsACString& aRetVal) {
|
|||
subFolder->GetName(folderName);
|
||||
localFoldersRoot->GetChildNamed(folderName,
|
||||
getter_AddRefs(dest));
|
||||
if (dest)
|
||||
if (dest) {
|
||||
dest->CopyMessages(subFolder, hdrsToCopy, false, nullptr,
|
||||
nullptr, false, false);
|
||||
}
|
||||
// Should we copy the folder if the dest doesn't exist?
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
rv = acctMgr->FindAccountForServer(localServer,
|
||||
getter_AddRefs(localAccount));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
|
|
@ -190,7 +190,7 @@ nsresult nsMsgNewsFolder::AddDirectorySeparator(nsIFile* path) {
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgNewsFolder::GetSubFolders(nsISimpleEnumerator** aResult) {
|
||||
nsMsgNewsFolder::GetSubFolders(nsTArray<RefPtr<nsIMsgFolder>>& folders) {
|
||||
if (!mInitialized) {
|
||||
// do this first, so we make sure to do it, even on failure.
|
||||
// see bug #70494
|
||||
|
@ -209,9 +209,7 @@ nsMsgNewsFolder::GetSubFolders(nsISimpleEnumerator** aResult) {
|
|||
(void)UpdateSummaryTotals(false);
|
||||
}
|
||||
|
||||
return aResult ? NS_NewArrayEnumerator(aResult, mSubFolders,
|
||||
NS_GET_IID(nsIMsgFolder))
|
||||
: NS_ERROR_NULL_POINTER;
|
||||
return nsMsgDBFolder::GetSubFolders(folders);
|
||||
}
|
||||
|
||||
// Makes sure the database is open and exists. If the database is valid then
|
||||
|
|
|
@ -29,7 +29,7 @@ class nsMsgNewsFolder : public nsMsgDBFolder, public nsIMsgNewsFolder {
|
|||
// nsIUrlListener method
|
||||
NS_IMETHOD OnStopRunningUrl(nsIURI* aUrl, nsresult aExitCode) override;
|
||||
// nsIMsgFolder methods:
|
||||
NS_IMETHOD GetSubFolders(nsISimpleEnumerator** aResult) override;
|
||||
NS_IMETHOD GetSubFolders(nsTArray<RefPtr<nsIMsgFolder>>& folders) override;
|
||||
|
||||
NS_IMETHOD UpdateFolder(nsIMsgWindow* aWindow) override;
|
||||
|
||||
|
|
|
@ -300,7 +300,6 @@ nsNntpIncomingServer::WriteNewsrcFile() {
|
|||
newsrcFile, -1, 00600);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> subFolders;
|
||||
nsCOMPtr<nsIMsgFolder> rootFolder;
|
||||
rv = GetRootFolder(getter_AddRefs(rootFolder));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -339,16 +338,10 @@ nsNntpIncomingServer::WriteNewsrcFile() {
|
|||
}
|
||||
#endif /* DEBUG_NEWS */
|
||||
|
||||
rv = rootFolder->GetSubFolders(getter_AddRefs(subFolders));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
bool moreFolders;
|
||||
|
||||
while (NS_SUCCEEDED(subFolders->HasMoreElements(&moreFolders)) &&
|
||||
moreFolders) {
|
||||
nsCOMPtr<nsISupports> child;
|
||||
rv = subFolders->GetNext(getter_AddRefs(child));
|
||||
if (NS_SUCCEEDED(rv) && child) {
|
||||
nsTArray<RefPtr<nsIMsgFolder>> subFolders;
|
||||
rv = rootFolder->GetSubFolders(subFolders);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
for (nsIMsgFolder* child : subFolders) {
|
||||
newsFolder = do_QueryInterface(child, &rv);
|
||||
if (NS_SUCCEEDED(rv) && newsFolder) {
|
||||
nsCString newsrcLine;
|
||||
|
@ -360,7 +353,6 @@ nsNntpIncomingServer::WriteNewsrcFile() {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
newsrcStream->Close();
|
||||
|
||||
|
@ -638,17 +630,10 @@ nsresult nsNntpIncomingServer::DownloadMail(nsIMsgWindow* aMsgWindow) {
|
|||
nsresult rv = GetRootFolder(getter_AddRefs(rootFolder));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> groups;
|
||||
rv = rootFolder->GetSubFolders(getter_AddRefs(groups));
|
||||
nsTArray<RefPtr<nsIMsgFolder>> groups;
|
||||
rv = rootFolder->GetSubFolders(groups);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
bool hasNext;
|
||||
while (NS_SUCCEEDED(rv = groups->HasMoreElements(&hasNext)) && hasNext) {
|
||||
nsCOMPtr<nsISupports> nextGroup;
|
||||
rv = groups->GetNext(getter_AddRefs(nextGroup));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIMsgFolder> group(do_QueryInterface(nextGroup));
|
||||
for (nsIMsgFolder* group : groups) {
|
||||
rv = group->GetNewMessages(aMsgWindow, nullptr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
@ -714,8 +699,8 @@ nsNntpIncomingServer::ContainsNewsgroup(const nsACString& aName,
|
|||
nsCOMPtr<nsIMsgFolder> rootFolder;
|
||||
GetRootFolder(getter_AddRefs(rootFolder));
|
||||
if (rootFolder) {
|
||||
nsCOMPtr<nsISimpleEnumerator> subfolders;
|
||||
rootFolder->GetSubFolders(getter_AddRefs(subfolders));
|
||||
nsTArray<RefPtr<nsIMsgFolder>> dummy;
|
||||
rootFolder->GetSubFolders(dummy);
|
||||
}
|
||||
}
|
||||
nsAutoCString unescapedName;
|
||||
|
@ -1272,20 +1257,12 @@ nsNntpIncomingServer::ForgetPassword() {
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// clear password of all child folders
|
||||
nsCOMPtr<nsISimpleEnumerator> subFolders;
|
||||
|
||||
rv = rootFolder->GetSubFolders(getter_AddRefs(subFolders));
|
||||
nsTArray<RefPtr<nsIMsgFolder>> subFolders;
|
||||
rv = rootFolder->GetSubFolders(subFolders);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
bool moreFolders = false;
|
||||
|
||||
nsresult return_rv = NS_OK;
|
||||
|
||||
while (NS_SUCCEEDED(subFolders->HasMoreElements(&moreFolders)) &&
|
||||
moreFolders) {
|
||||
nsCOMPtr<nsISupports> child;
|
||||
rv = subFolders->GetNext(getter_AddRefs(child));
|
||||
if (NS_SUCCEEDED(rv) && child) {
|
||||
for (nsIMsgFolder* child : subFolders) {
|
||||
newsFolder = do_QueryInterface(child, &rv);
|
||||
if (NS_SUCCEEDED(rv) && newsFolder) {
|
||||
rv = newsFolder->ForgetAuthenticationCredentials();
|
||||
|
@ -1294,7 +1271,6 @@ nsNntpIncomingServer::ForgetPassword() {
|
|||
return_rv = NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return return_rv;
|
||||
}
|
||||
|
@ -1921,28 +1897,21 @@ nsNntpIncomingServer::OnUserOrHostNameChanged(const nsACString& oldName,
|
|||
rv = GetRootMsgFolder(getter_AddRefs(serverFolder));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> subFolders;
|
||||
rv = serverFolder->GetSubFolders(getter_AddRefs(subFolders));
|
||||
nsTArray<RefPtr<nsIMsgFolder>> subFolders;
|
||||
rv = serverFolder->GetSubFolders(subFolders);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsTArray<nsString> groupList;
|
||||
nsString folderName;
|
||||
|
||||
// Prepare the group list
|
||||
bool hasMore;
|
||||
while (NS_SUCCEEDED(subFolders->HasMoreElements(&hasMore)) && hasMore) {
|
||||
nsCOMPtr<nsISupports> item;
|
||||
subFolders->GetNext(getter_AddRefs(item));
|
||||
nsCOMPtr<nsIMsgFolder> newsgroupFolder(do_QueryInterface(item));
|
||||
if (!newsgroupFolder) continue;
|
||||
|
||||
nsTArray<nsString> groupList(subFolders.Length());
|
||||
for (nsIMsgFolder* newsgroupFolder : subFolders) {
|
||||
nsString folderName;
|
||||
rv = newsgroupFolder->GetName(folderName);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
groupList.AppendElement(folderName);
|
||||
}
|
||||
|
||||
// If nothing subscribed then we're done.
|
||||
if (groupList.Length() == 0) return NS_OK;
|
||||
if (groupList.IsEmpty()) return NS_OK;
|
||||
|
||||
// Now unsubscribe & subscribe.
|
||||
uint32_t i;
|
||||
|
|
|
@ -414,12 +414,7 @@ function onSearch()
|
|||
}
|
||||
|
||||
function AddSubFolders(folder) {
|
||||
var subFolders = folder.subFolders;
|
||||
while (subFolders.hasMoreElements())
|
||||
{
|
||||
var nextFolder =
|
||||
subFolders.getNext().QueryInterface(Ci.nsIMsgFolder);
|
||||
|
||||
for (let nextFolder of folder.subFolders) {
|
||||
if (!(nextFolder.flags & Ci.nsMsgFolderFlags.Virtual))
|
||||
{
|
||||
if (!nextFolder.noSelect)
|
||||
|
@ -434,13 +429,8 @@ function AddSubFoldersToURI(folder)
|
|||
{
|
||||
var returnString = "";
|
||||
|
||||
var subFolders = folder.subFolders;
|
||||
|
||||
while (subFolders.hasMoreElements())
|
||||
for (let nextFolder of folder.subFolders) {
|
||||
{
|
||||
var nextFolder =
|
||||
subFolders.getNext().QueryInterface(Ci.nsIMsgFolder);
|
||||
|
||||
if (!(nextFolder.flags & Ci.nsMsgFolderFlags.Virtual))
|
||||
{
|
||||
if (!nextFolder.noSelect && !nextFolder.isServer)
|
||||
|
|
|
@ -243,9 +243,9 @@ var gFolderTreeController = {
|
|||
return;
|
||||
|
||||
// Delete any sub-folders this folder might have.
|
||||
let iter = folder.subFolders;
|
||||
while (iter.hasMoreElements())
|
||||
folder.propagateDelete(iter.getNext(), true, msgWindow);
|
||||
for (let f of folder.subFolders) {
|
||||
folder.propagateDelete(f, true, msgWindow);
|
||||
}
|
||||
|
||||
// Now delete the messages.
|
||||
let messages = Array.from(fixIterator(folder.messages));
|
||||
|
|
|
@ -728,19 +728,14 @@ function OpenMessageByHeader(messageHeader, openInNewWindow)
|
|||
function SearchForMessageIdInSubFolder(folder, messageId)
|
||||
{
|
||||
var messageHeader;
|
||||
var subFolders = folder.subFolders;
|
||||
|
||||
// search in folder
|
||||
if (!folder.isServer)
|
||||
messageHeader = CheckForMessageIdInFolder(folder, messageId);
|
||||
|
||||
// search subfolders recursively
|
||||
while (subFolders.hasMoreElements() && !messageHeader)
|
||||
{
|
||||
for (let currentFolder of folder.subFolders) {
|
||||
// search in current folder
|
||||
var currentFolder =
|
||||
subFolders.getNext().QueryInterface(Ci.nsIMsgFolder);
|
||||
|
||||
messageHeader = CheckForMessageIdInFolder(currentFolder, messageId);
|
||||
|
||||
// search in its subfolder
|
||||
|
|
|
@ -11,14 +11,7 @@ const {allAccountsSorted} = ChromeUtils.import("resource:///modules/folderUtils.
|
|||
|
||||
function GetSubFoldersInFolderPaneOrder(folder)
|
||||
{
|
||||
var subFolders = folder.subFolders;
|
||||
var msgFolders = Array();
|
||||
|
||||
// get all the subfolders
|
||||
while (subFolders.hasMoreElements()) {
|
||||
msgFolders[msgFolders.length] =
|
||||
subFolders.getNext().QueryInterface(Ci.nsIMsgFolder);
|
||||
}
|
||||
var msgFolders = folder.subFolders;
|
||||
|
||||
function compareFolderSortKey(folder1, folder2) {
|
||||
return folder1.compareSortKeys(folder2);
|
||||
|
|
Загрузка…
Ссылка в новой задаче