Bug 1614846 - remove nsIArray use in nsIMsgAccountManager (part one: accounts). r=mkmelin
--HG-- extra : histedit_source : 0ae61a3d840bf390ad0175c1048195915e692910
This commit is contained in:
Родитель
e8e4c17a00
Коммит
64f99a59c4
|
@ -53,9 +53,7 @@ var calemail = {
|
|||
* @param {Function} aFunc The function to be called for each identity and account
|
||||
*/
|
||||
iterateIdentities(aFunc) {
|
||||
let accounts = MailServices.accounts.accounts;
|
||||
for (let i = 0; i < accounts.length; ++i) {
|
||||
let account = accounts.queryElementAt(i, Ci.nsIMsgAccount);
|
||||
for (let account of MailServices.accounts.accounts) {
|
||||
let identities = account.identities;
|
||||
for (let j = 0; j < identities.length; ++j) {
|
||||
let identity = identities.queryElementAt(j, Ci.nsIMsgIdentity);
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
var { MailServices } = ChromeUtils.import("resource:///modules/MailServices.jsm");
|
||||
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
var { fixIterator } = ChromeUtils.import("resource:///modules/iteratorUtils.jsm");
|
||||
|
||||
ChromeUtils.defineModuleGetter(this, "cal", "resource:///modules/calendar/calUtils.jsm");
|
||||
|
||||
|
@ -267,8 +266,7 @@ var calprovider = {
|
|||
let foundIdentity = findIdentity(foundAccount);
|
||||
|
||||
if (!foundAccount || !foundIdentity) {
|
||||
let accounts = MailServices.accounts.accounts;
|
||||
for (let account of fixIterator(accounts, Ci.nsIMsgAccount)) {
|
||||
for (let account of MailServices.accounts.accounts) {
|
||||
let identity = findIdentity(account);
|
||||
|
||||
if (account && identity) {
|
||||
|
|
|
@ -90,9 +90,8 @@ var AboutSupport = {
|
|||
*/
|
||||
getAccountDetails() {
|
||||
let accountDetails = [];
|
||||
let accounts = MailServices.accounts.accounts;
|
||||
|
||||
for (let account of fixIterator(accounts, Ci.nsIMsgAccount)) {
|
||||
for (let account of MailServices.accounts.accounts) {
|
||||
let server = account.incomingServer;
|
||||
accountDetails.push({
|
||||
key: account.key,
|
||||
|
|
|
@ -17,11 +17,11 @@ add_task(async function setup() {
|
|||
|
||||
function createAccount() {
|
||||
registerCleanupFunction(() => {
|
||||
[...MailServices.accounts.accounts.enumerate()].forEach(cleanUpAccount);
|
||||
MailServices.accounts.accounts.forEach(cleanUpAccount);
|
||||
});
|
||||
|
||||
MailServices.accounts.createLocalMailAccount();
|
||||
let account = MailServices.accounts.accounts.enumerate().getNext();
|
||||
let account = MailServices.accounts.accounts[0];
|
||||
info(`Created account ${account.toString()}`);
|
||||
|
||||
return account;
|
||||
|
|
|
@ -6701,10 +6701,7 @@ function DetermineConvertibility() {
|
|||
*/
|
||||
function hideIrrelevantAddressingOptions(accountKey, prevKey) {
|
||||
let hideNews = true;
|
||||
for (let account of fixIterator(
|
||||
MailServices.accounts.accounts,
|
||||
Ci.nsIMsgAccount
|
||||
)) {
|
||||
for (let account of MailServices.accounts.accounts) {
|
||||
if (account.incomingServer.type == "nntp") {
|
||||
hideNews = false;
|
||||
}
|
||||
|
|
|
@ -49,10 +49,7 @@ this.accounts = class extends ExtensionAPI {
|
|||
accounts: {
|
||||
async list() {
|
||||
let accounts = [];
|
||||
for (let account of fixIterator(
|
||||
MailServices.accounts.accounts,
|
||||
Ci.nsIMsgAccount
|
||||
)) {
|
||||
for (let account of MailServices.accounts.accounts) {
|
||||
account = convertAccount(account);
|
||||
if (account) {
|
||||
accounts.push(account);
|
||||
|
|
|
@ -33,11 +33,11 @@ registerCleanupFunction(() => {
|
|||
|
||||
function createAccount() {
|
||||
registerCleanupFunction(() => {
|
||||
[...MailServices.accounts.accounts.enumerate()].forEach(cleanUpAccount);
|
||||
MailServices.accounts.accounts.forEach(cleanUpAccount);
|
||||
});
|
||||
|
||||
MailServices.accounts.createLocalMailAccount();
|
||||
let account = MailServices.accounts.accounts.enumerate().getNext();
|
||||
let account = MailServices.accounts.accounts[0];
|
||||
info(`Created account ${account.toString()}`);
|
||||
|
||||
return account;
|
||||
|
|
|
@ -33,10 +33,7 @@ var createHttpServer = (...args) => {
|
|||
|
||||
function createAccount() {
|
||||
MailServices.accounts.createLocalMailAccount();
|
||||
let account = MailServices.accounts.accounts
|
||||
.enumerate()
|
||||
.getNext()
|
||||
.QueryInterface(Ci.nsIMsgAccount);
|
||||
let account = MailServices.accounts.accounts[0];
|
||||
account.incomingServer = MailServices.accounts.localFoldersServer;
|
||||
info(`Created account ${account.toString()}`);
|
||||
|
||||
|
@ -49,7 +46,7 @@ function cleanUpAccount(account) {
|
|||
}
|
||||
|
||||
registerCleanupFunction(() => {
|
||||
[...MailServices.accounts.accounts.enumerate()].forEach(cleanUpAccount);
|
||||
MailServices.accounts.accounts.forEach(cleanUpAccount);
|
||||
});
|
||||
|
||||
function addIdentity(account, email = "xpcshell@localhost") {
|
||||
|
|
|
@ -7,9 +7,6 @@
|
|||
/* globals MsgAccountManager */
|
||||
|
||||
var { Services } = ChromeUtils.import("resource:///modules/imServices.jsm");
|
||||
var { fixIterator } = ChromeUtils.import(
|
||||
"resource:///modules/iteratorUtils.jsm"
|
||||
);
|
||||
var { MailServices } = ChromeUtils.import(
|
||||
"resource:///modules/MailServices.jsm"
|
||||
);
|
||||
|
@ -364,8 +361,7 @@ var gAccountManager = {
|
|||
// Find the nsIIncomingServer for the current imIAccount.
|
||||
let server = null;
|
||||
let imAccountId = this.accountList.selectedItem.account.numericId;
|
||||
let mgr = MailServices.accounts;
|
||||
for (let account of fixIterator(mgr.accounts, Ci.nsIMsgAccount)) {
|
||||
for (let account of MailServices.accounts.accounts) {
|
||||
let incomingServer = account.incomingServer;
|
||||
if (!incomingServer || incomingServer.type != "im") {
|
||||
continue;
|
||||
|
|
|
@ -5,9 +5,6 @@
|
|||
const EXPORTED_SYMBOLS = ["allContacts", "onlineContacts", "ChatCore"];
|
||||
|
||||
const { Services } = ChromeUtils.import("resource:///modules/imServices.jsm");
|
||||
const { fixIterator } = ChromeUtils.import(
|
||||
"resource:///modules/iteratorUtils.jsm"
|
||||
);
|
||||
const { MailServices } = ChromeUtils.import(
|
||||
"resource:///modules/MailServices.jsm"
|
||||
);
|
||||
|
@ -53,7 +50,7 @@ var ChatCore = {
|
|||
accountsById[account.numericId] = account;
|
||||
}
|
||||
let mgr = MailServices.accounts;
|
||||
for (let account of fixIterator(mgr.accounts, Ci.nsIMsgAccount)) {
|
||||
for (let account of mgr.accounts) {
|
||||
let incomingServer = account.incomingServer;
|
||||
if (!incomingServer || incomingServer.type != "im") {
|
||||
continue;
|
||||
|
|
|
@ -15,9 +15,6 @@ const { GlodaAccount } = ChromeUtils.import(
|
|||
const { GlodaIndexer, IndexingJob } = ChromeUtils.import(
|
||||
"resource:///modules/gloda/GlodaIndexer.jsm"
|
||||
);
|
||||
const { fixIterator } = ChromeUtils.import(
|
||||
"resource:///modules/iteratorUtils.jsm"
|
||||
);
|
||||
const { Services } = ChromeUtils.import("resource:///modules/imServices.jsm");
|
||||
const { MailServices } = ChromeUtils.import(
|
||||
"resource:///modules/MailServices.jsm"
|
||||
|
@ -103,8 +100,7 @@ GlodaIMConversation.prototype = {
|
|||
}
|
||||
|
||||
// Find the nsIIncomingServer for the current imIAccount.
|
||||
let mgr = MailServices.accounts;
|
||||
for (let account of fixIterator(mgr.accounts, Ci.nsIMsgAccount)) {
|
||||
for (let account of MailServices.accounts.accounts) {
|
||||
let incomingServer = account.incomingServer;
|
||||
if (!incomingServer || incomingServer.type != "im") {
|
||||
continue;
|
||||
|
|
|
@ -46,6 +46,9 @@ const { EnigmailLazy } = ChromeUtils.import(
|
|||
const { EnigmailAutoSetup } = ChromeUtils.import(
|
||||
"chrome://openpgp/content/modules/autoSetup.jsm"
|
||||
);
|
||||
const { MailServices } = ChromeUtils.import(
|
||||
"resource:///modules/MailServices.jsm"
|
||||
);
|
||||
|
||||
/**
|
||||
* Upgrade sending prefs
|
||||
|
@ -149,13 +152,9 @@ function replaceKeyIdWithFpr() {
|
|||
* (v1.8.x -> v1.9)
|
||||
*/
|
||||
function defaultPgpMime() {
|
||||
let accountManager = Cc[
|
||||
"@mozilla.org/messenger/account-manager;1"
|
||||
].getService(Ci.nsIMsgAccountManager);
|
||||
let changedSomething = false;
|
||||
|
||||
for (let acct = 0; acct < accountManager.accounts.length; acct++) {
|
||||
let ac = accountManager.accounts.queryElementAt(acct, Ci.nsIMsgAccount);
|
||||
for (let ac of MailServices.accounts.accounts) {
|
||||
if (ac.incomingServer.type.search(/(pop3|imap|movemail)/) >= 0) {
|
||||
for (let i = 0; i < ac.identities.length; i++) {
|
||||
let id = ac.identities.queryElementAt(i, Ci.nsIMsgIdentity);
|
||||
|
@ -184,12 +183,7 @@ function defaultPgpMime() {
|
|||
*/
|
||||
function setAutocryptForOldAccounts() {
|
||||
try {
|
||||
let accountManager = Cc[
|
||||
"@mozilla.org/messenger/account-manager;1"
|
||||
].getService(Ci.nsIMsgAccountManager);
|
||||
|
||||
for (let acct = 0; acct < accountManager.accounts.length; acct++) {
|
||||
let ac = accountManager.accounts.queryElementAt(acct, Ci.nsIMsgAccount);
|
||||
for (let ac of MailServices.accounts.accounts) {
|
||||
if (ac.incomingServer.type.search(/(pop3|imap|movemail)/) >= 0) {
|
||||
ac.incomingServer.setIntValue("acPreferEncrypt", 1);
|
||||
}
|
||||
|
|
|
@ -22,6 +22,9 @@ const { EnigmailPrefs } = ChromeUtils.import(
|
|||
const { EnigmailData } = ChromeUtils.import(
|
||||
"chrome://openpgp/content/modules/data.jsm"
|
||||
);
|
||||
const { MailServices } = ChromeUtils.import(
|
||||
"resource:///modules/MailServices.jsm"
|
||||
);
|
||||
|
||||
var gTxtConverter = null;
|
||||
|
||||
|
@ -414,13 +417,7 @@ var EnigmailFuncs = {
|
|||
* Get the nsIMsgAccount associated with a given nsIMsgIdentity
|
||||
*/
|
||||
getAccountForIdentity(identity) {
|
||||
let accountManager = Cc[
|
||||
"@mozilla.org/messenger/account-manager;1"
|
||||
].getService(Ci.nsIMsgAccountManager);
|
||||
|
||||
for (let acct = 0; acct < accountManager.accounts.length; acct++) {
|
||||
let ac = accountManager.accounts.queryElementAt(acct, Ci.nsIMsgAccount);
|
||||
|
||||
for (let ac of MailServices.accounts.accounts) {
|
||||
for (let i = 0; i < ac.identities.length; i++) {
|
||||
let id = ac.identities.queryElementAt(i, Ci.nsIMsgIdentity);
|
||||
if (id.key === identity.key) {
|
||||
|
@ -435,17 +432,12 @@ var EnigmailFuncs = {
|
|||
* Get the default identity of the default account
|
||||
*/
|
||||
getDefaultIdentity() {
|
||||
let accountManager = Cc[
|
||||
"@mozilla.org/messenger/account-manager;1"
|
||||
].getService(Ci.nsIMsgAccountManager);
|
||||
|
||||
try {
|
||||
let ac;
|
||||
if (accountManager.defaultAccount) {
|
||||
ac = accountManager.defaultAccount;
|
||||
if (MailServices.accounts.defaultAccount) {
|
||||
ac = MailServices.accounts.defaultAccount;
|
||||
} else {
|
||||
for (let i = 0; i < accountManager.accounts.length; i++) {
|
||||
ac = accountManager.accounts.queryElementAt(i, Ci.nsIMsgAccount);
|
||||
for (ac of MailServices.accounts.accounts) {
|
||||
if (
|
||||
ac.incomingServer.type === "imap" ||
|
||||
ac.incomingServer.type === "pop3"
|
||||
|
|
|
@ -26,6 +26,9 @@ const { EnigmailConstants } = ChromeUtils.import(
|
|||
const { EnigmailLazy } = ChromeUtils.import(
|
||||
"chrome://openpgp/content/modules/lazy.jsm"
|
||||
);
|
||||
const { MailServices } = ChromeUtils.import(
|
||||
"resource:///modules/MailServices.jsm"
|
||||
);
|
||||
|
||||
const getDialog = EnigmailLazy.loader("enigmail/dialog.jsm", "EnigmailDialog");
|
||||
const getWindows = EnigmailLazy.loader(
|
||||
|
@ -97,15 +100,10 @@ var EnigmailKeyUsability = {
|
|||
*/
|
||||
getKeysSpecForIdentities() {
|
||||
EnigmailLog.DEBUG("keyUsability.jsm: getKeysSpecForIdentities()\n");
|
||||
let accountManager = Cc[
|
||||
"@mozilla.org/messenger/account-manager;1"
|
||||
].getService(Ci.nsIMsgAccountManager);
|
||||
|
||||
let keySpecList = [];
|
||||
|
||||
for (let acct = 0; acct < accountManager.accounts.length; acct++) {
|
||||
let ac = accountManager.accounts.queryElementAt(acct, Ci.nsIMsgAccount);
|
||||
|
||||
for (let ac of MailServices.accounts.accounts) {
|
||||
for (let i = 0; i < ac.identities.length; i++) {
|
||||
let id = ac.identities.queryElementAt(i, Ci.nsIMsgIdentity);
|
||||
if (id.getBoolAttribute("enablePgp")) {
|
||||
|
|
|
@ -182,10 +182,7 @@ function getDefaultIdentity() {
|
|||
*/
|
||||
function getIdentities(aSkipNntpIdentities = true) {
|
||||
let identities = [];
|
||||
for (let account of fixIterator(
|
||||
MailServices.accounts.accounts,
|
||||
Ci.nsIMsgAccount
|
||||
)) {
|
||||
for (let account of MailServices.accounts.accounts) {
|
||||
let server = account.incomingServer;
|
||||
if (
|
||||
aSkipNntpIdentities &&
|
||||
|
@ -424,13 +421,7 @@ function combine(a1, a2) {
|
|||
* @return {Bool}
|
||||
*/
|
||||
function hasConfiguredAccounts() {
|
||||
let accountManager = Cc[
|
||||
"@mozilla.org/messenger/account-manager;1"
|
||||
].getService(Ci.nsIMsgAccountManager);
|
||||
|
||||
for (let acct = 0; acct < accountManager.accounts.length; acct++) {
|
||||
let ac = accountManager.accounts.queryElementAt(acct, Ci.nsIMsgAccount);
|
||||
|
||||
for (let ac of MailServices.accounts.accounts) {
|
||||
if (ac.incomingServer.type !== "none") {
|
||||
if (ac.defaultIdentity.email.length > 0) {
|
||||
return true;
|
||||
|
|
|
@ -118,10 +118,7 @@ function remove_NNTP_account() {
|
|||
*/
|
||||
add_task(function test_address_types() {
|
||||
// Be sure there is no NNTP account yet.
|
||||
for (let account of fixIterator(
|
||||
MailServices.accounts.accounts,
|
||||
Ci.nsIMsgAccount
|
||||
)) {
|
||||
for (let account of MailServices.accounts.accounts) {
|
||||
Assert.notEqual(
|
||||
account.incomingServer.type,
|
||||
"nntp",
|
||||
|
|
|
@ -35,10 +35,7 @@ add_task(function test_folder_names_in_recent_view_mode() {
|
|||
// We need 2 local accounts that have pristine folders with
|
||||
// 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 fixIterator(
|
||||
MailServices.accounts.accounts,
|
||||
Ci.nsIMsgAccount
|
||||
)) {
|
||||
for (let acc of MailServices.accounts.accounts) {
|
||||
for (let fld of fixIterator(
|
||||
acc.incomingServer.rootFolder.subFolders,
|
||||
Ci.nsIMsgFolder
|
||||
|
@ -47,8 +44,8 @@ add_task(function test_folder_names_in_recent_view_mode() {
|
|||
}
|
||||
}
|
||||
|
||||
let acc1 = MailServices.accounts.accounts.queryElementAt(1, Ci.nsIMsgAccount);
|
||||
let acc2 = MailServices.accounts.accounts.queryElementAt(0, Ci.nsIMsgAccount);
|
||||
let acc1 = MailServices.accounts.accounts[1];
|
||||
let acc2 = MailServices.accounts.accounts[0];
|
||||
let rootFolder1 = acc1.incomingServer.rootFolder;
|
||||
let rootFolder2 = acc2.incomingServer.rootFolder;
|
||||
|
||||
|
|
|
@ -45,11 +45,7 @@ add_task(function setupModule(module) {
|
|||
|
||||
// We need to make sure we have only one identity:
|
||||
// 1) Delete all accounts except for Local Folders
|
||||
for (let i = MailServices.accounts.accounts.length - 1; i >= 0; i--) {
|
||||
let account = MailServices.accounts.accounts.queryElementAt(
|
||||
i,
|
||||
Ci.nsIMsgAccount
|
||||
);
|
||||
for (let account of MailServices.accounts.accounts) {
|
||||
if (account != localAccount) {
|
||||
MailServices.accounts.removeAccount(account);
|
||||
}
|
||||
|
|
|
@ -32,9 +32,6 @@ var { input_value } = ChromeUtils.import(
|
|||
|
||||
var { Assert } = ChromeUtils.import("resource://testing-common/Assert.jsm");
|
||||
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
var { fixIterator } = ChromeUtils.import(
|
||||
"resource:///modules/iteratorUtils.jsm"
|
||||
);
|
||||
var { MailServices } = ChromeUtils.import(
|
||||
"resource:///modules/MailServices.jsm"
|
||||
);
|
||||
|
@ -145,10 +142,7 @@ function wait_to_be_offline(w) {
|
|||
* @param aAddress the email address to try to remove.
|
||||
*/
|
||||
function remove_email_account(aAddress) {
|
||||
for (let account of fixIterator(
|
||||
MailServices.accounts.accounts,
|
||||
Ci.nsIMsgAccount
|
||||
)) {
|
||||
for (let account of MailServices.accounts.accounts) {
|
||||
if (account.defaultIdentity && account.defaultIdentity.email == aAddress) {
|
||||
MailServices.accounts.removeAccount(account);
|
||||
break;
|
||||
|
|
|
@ -21,11 +21,9 @@ var gAnyValidIdentity = false; // If there are no valid identities for any accou
|
|||
var gNewAccountToLoad = null; // used to load new messages if we come from the mail3pane
|
||||
|
||||
function getInvalidAccounts(accounts) {
|
||||
let numAccounts = accounts.length;
|
||||
let invalidAccounts = [];
|
||||
let numIdentities = 0;
|
||||
for (let i = 0; i < numAccounts; i++) {
|
||||
let account = accounts.queryElementAt(i, Ci.nsIMsgAccount);
|
||||
for (let account of accounts) {
|
||||
try {
|
||||
if (!account.incomingServer.valid) {
|
||||
invalidAccounts[invalidAccounts.length] = account;
|
||||
|
|
|
@ -305,10 +305,7 @@ function onAdvanced() {
|
|||
MailServices.accounts.getAccount(serverSettings.deferredToAccount)
|
||||
.incomingServer.serverURI;
|
||||
|
||||
for (let account of fixIterator(
|
||||
MailServices.accounts.accounts,
|
||||
Ci.nsIMsgAccount
|
||||
)) {
|
||||
for (let account of MailServices.accounts.accounts) {
|
||||
let accountValues = parent.getValueArrayFor(account);
|
||||
let type = parent.getAccountValue(
|
||||
account,
|
||||
|
|
|
@ -234,10 +234,7 @@ function openPrefsFromAccountManager(
|
|||
* searching the name. If unset, do not skip any account.
|
||||
*/
|
||||
function accountNameExists(aAccountName, aAccountKey) {
|
||||
for (let account of fixIterator(
|
||||
MailServices.accounts.accounts,
|
||||
Ci.nsIMsgAccount
|
||||
)) {
|
||||
for (let account of MailServices.accounts.accounts) {
|
||||
if (
|
||||
account.key != aAccountKey &&
|
||||
account.incomingServer &&
|
||||
|
|
|
@ -85,7 +85,7 @@ interface nsIMsgAccountManager : nsISupports {
|
|||
* Accounts with hidden servers are not returned.
|
||||
* array of nsIMsgAccount
|
||||
*/
|
||||
readonly attribute nsIArray accounts;
|
||||
readonly attribute Array<nsIMsgAccount> accounts;
|
||||
|
||||
/* list of all identities in all accounts
|
||||
* array of nsIMsgIdentity
|
||||
|
|
|
@ -829,16 +829,13 @@ NS_IMETHODIMP nsMsgAccountManager::GetFolderCache(
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgAccountManager::GetAccounts(nsIArray **_retval) {
|
||||
nsMsgAccountManager::GetAccounts(nsTArray<RefPtr<nsIMsgAccount>> &accounts) {
|
||||
nsresult rv = LoadAccounts();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIMutableArray> accounts(
|
||||
do_CreateInstance(NS_ARRAY_CONTRACTID, &rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
for (uint32_t index = 0; index < m_accounts.Length(); index++) {
|
||||
nsCOMPtr<nsIMsgAccount> existingAccount(m_accounts[index]);
|
||||
accounts.Clear();
|
||||
accounts.SetCapacity(m_accounts.Length());
|
||||
for (auto existingAccount : m_accounts) {
|
||||
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||
existingAccount->GetIncomingServer(getter_AddRefs(server));
|
||||
if (!server) continue;
|
||||
|
@ -847,9 +844,8 @@ nsMsgAccountManager::GetAccounts(nsIArray **_retval) {
|
|||
server->GetHidden(&hidden);
|
||||
if (hidden) continue;
|
||||
}
|
||||
accounts->AppendElement(existingAccount);
|
||||
accounts.AppendElement(existingAccount);
|
||||
}
|
||||
accounts.forget(_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -355,15 +355,14 @@ NS_IMETHODIMP nsSpamSettings::Initialize(nsIMsgIncomingServer *aServer) {
|
|||
// Loop through all accounts, adding emails from this account, as well as
|
||||
// from any accounts that defer to this account.
|
||||
mEmails.Clear();
|
||||
nsCOMPtr<nsIArray> accounts;
|
||||
rv = accountManager->GetAccounts(getter_AddRefs(accounts));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
uint32_t accountCount = 0;
|
||||
nsTArray<RefPtr<nsIMsgAccount>> accounts;
|
||||
// No sense scanning accounts if we've nothing to match.
|
||||
if (account && accounts) accounts->GetLength(&accountCount);
|
||||
if (account) {
|
||||
rv = accountManager->GetAccounts(accounts);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < accountCount; i++) {
|
||||
nsCOMPtr<nsIMsgAccount> loopAccount(do_QueryElementAt(accounts, i));
|
||||
for (auto loopAccount : accounts) {
|
||||
if (!loopAccount) continue;
|
||||
nsAutoCString loopAccountKey;
|
||||
loopAccount->GetKey(loopAccountKey);
|
||||
|
|
|
@ -12,10 +12,7 @@ function run_test() {
|
|||
MailServices.accounts.createLocalMailAccount();
|
||||
|
||||
// Get the account
|
||||
let account = MailServices.accounts.accounts.queryElementAt(
|
||||
0,
|
||||
Ci.nsIMsgAccount
|
||||
);
|
||||
let account = MailServices.accounts.accounts[0];
|
||||
|
||||
// Get the root folder
|
||||
var root = account.incomingServer.rootFolder;
|
||||
|
|
|
@ -17,9 +17,6 @@ this.EXPORTED_SYMBOLS = [
|
|||
const { MailServices } = ChromeUtils.import(
|
||||
"resource:///modules/MailServices.jsm"
|
||||
);
|
||||
const { fixIterator, toArray } = ChromeUtils.import(
|
||||
"resource:///modules/iteratorUtils.jsm"
|
||||
);
|
||||
|
||||
/**
|
||||
* Returns a string representation of a folder's "special" type.
|
||||
|
@ -159,15 +156,12 @@ function compareAccounts(aAccount1, aAccount2) {
|
|||
* @param aExcludeIMAccounts Remove IM accounts from the list?
|
||||
*/
|
||||
function allAccountsSorted(aExcludeIMAccounts) {
|
||||
// Get the account list, and add the proper items.
|
||||
let accountList = toArray(
|
||||
fixIterator(MailServices.accounts.accounts, Ci.nsIMsgAccount)
|
||||
);
|
||||
|
||||
// This is a HACK to work around bug 41133. If we have one of the
|
||||
// dummy "news" accounts there, that account won't have an
|
||||
// incomingServer attached to it, and everything will blow up.
|
||||
accountList = accountList.filter(a => a.incomingServer);
|
||||
let accountList = MailServices.accounts.accounts.filter(
|
||||
a => a.incomingServer
|
||||
);
|
||||
|
||||
// Remove IM servers.
|
||||
if (aExcludeIMAccounts) {
|
||||
|
|
|
@ -615,13 +615,12 @@ nsMsgSendLater::HasUnsentMessages(nsIMsgIdentity *aIdentity, bool *aResult) {
|
|||
do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIArray> accounts;
|
||||
accountManager->GetAccounts(getter_AddRefs(accounts));
|
||||
nsTArray<RefPtr<nsIMsgAccount>> accounts;
|
||||
rv = accountManager->GetAccounts(accounts);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
uint32_t cnt = 0;
|
||||
rv = accounts->GetLength(&cnt);
|
||||
if (cnt == 0) return NS_OK; // no account set up -> no unsent messages
|
||||
if (accounts.IsEmpty())
|
||||
return NS_OK; // no account set up -> no unsent messages
|
||||
|
||||
// XXX This code should be set up for multiple unsent folders, however we
|
||||
// don't support that at the moment, so for now just assume one folder.
|
||||
|
|
|
@ -2014,10 +2014,7 @@ var GlodaMsgIndexer = {
|
|||
this._log.info("Queueing all accounts for indexing.");
|
||||
|
||||
GlodaDatastore._beginTransaction();
|
||||
for (let account of fixIterator(
|
||||
MailServices.accounts.accounts,
|
||||
Ci.nsIMsgAccount
|
||||
)) {
|
||||
for (let account of MailServices.accounts.accounts) {
|
||||
this.indexAccount(account);
|
||||
}
|
||||
GlodaDatastore._commitTransaction();
|
||||
|
|
|
@ -655,15 +655,11 @@ nsresult nsAutoSyncManager::AutoUpdateFolders() {
|
|||
do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIArray> accounts;
|
||||
rv = accountManager->GetAccounts(getter_AddRefs(accounts));
|
||||
nsTArray<RefPtr<nsIMsgAccount>> accounts;
|
||||
rv = accountManager->GetAccounts(accounts);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
uint32_t accountCount;
|
||||
accounts->GetLength(&accountCount);
|
||||
|
||||
for (uint32_t i = 0; i < accountCount; ++i) {
|
||||
nsCOMPtr<nsIMsgAccount> account(do_QueryElementAt(accounts, i, &rv));
|
||||
for (auto account : accounts) {
|
||||
if (!account) continue;
|
||||
|
||||
nsCOMPtr<nsIMsgIncomingServer> incomingServer;
|
||||
|
|
|
@ -655,17 +655,12 @@ nsresult nsBeckyFilters::GetMessageFolder(const nsAString &aName,
|
|||
accountManager = do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIArray> accounts;
|
||||
rv = accountManager->GetAccounts(getter_AddRefs(accounts));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
uint32_t accountCount;
|
||||
rv = accounts->GetLength(&accountCount);
|
||||
nsTArray<RefPtr<nsIMsgAccount>> accounts;
|
||||
rv = accountManager->GetAccounts(accounts);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIMsgFolder> found;
|
||||
for (uint32_t i = 0; i < accountCount; i++) {
|
||||
nsCOMPtr<nsIMsgAccount> account(do_QueryElementAt(accounts, i));
|
||||
for (auto account : accounts) {
|
||||
if (!account) continue;
|
||||
|
||||
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||
|
|
|
@ -473,10 +473,7 @@ SettingsImportHelper.prototype = {
|
|||
},
|
||||
|
||||
_ensureNoAccounts() {
|
||||
let accounts = MailServices.accounts.accounts;
|
||||
|
||||
for (let i = 0; i < accounts.length; i++) {
|
||||
let account = accounts.queryElementAt(i, Ci.nsIMsgAccount);
|
||||
for (let account of MailServices.accounts.accounts) {
|
||||
MailServices.accounts.removeAccount(account);
|
||||
}
|
||||
},
|
||||
|
@ -564,9 +561,7 @@ SettingsImportHelper.prototype = {
|
|||
},
|
||||
|
||||
checkResults() {
|
||||
let accounts = MailServices.accounts.accounts;
|
||||
for (let i = 0; i < accounts.length - 1; i++) {
|
||||
let actualAccount = accounts.queryElementAt(i, Ci.nsIMsgAccount);
|
||||
for (let actualAccount of MailServices.accounts.accounts) {
|
||||
if (this._isLocalMailAccount(actualAccount)) {
|
||||
continue;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче