Bug 1770342 - Remove nsIMsgAccountManager.findRealServer, use findServer instead. r=mkmelin draft
authorPing Chen <remotenonsense@gmail.com>
Sat, 21 May 2022 14:07:26 +0900
changeset 116727 d50715ea3d66ebc6140c3ce81022a415ea991d3b
parent 116708 9400a0f6772d73739d683cd109cf23907c41ba45
child 116728 1718a7205416ce74b5bbb9dcc44c117c30fc3caa
push id15950
push userremotenonsense@gmail.com
push dateSat, 21 May 2022 05:09:00 +0000
treeherdertry-comm-central@db396449da7b [default view] [failures only]
reviewersmkmelin
bugs1770342
Bug 1770342 - Remove nsIMsgAccountManager.findRealServer, use findServer instead. r=mkmelin
mail/base/content/folderPane.js
mail/components/accountcreation/CreateInBackend.jsm
mail/components/accountcreation/verifyConfig.jsm
mail/components/activity/modules/moveCopy.jsm
mail/test/browser/account/browser_abWhitelist.js
mail/test/browser/account/browser_portSetting.js
mail/test/browser/account/browser_settingsInfrastructure.js
mail/test/browser/cloudfile/browser_attachmentErrors.js
mail/test/browser/cloudfile/browser_attachmentUrls.js
mail/test/browser/composition/browser_addressWidgets.js
mail/test/browser/composition/browser_sendButton.js
mail/test/browser/composition/browser_signatureUpdating.js
mail/test/browser/folder-pane/browser_folderPane.js
mail/test/browser/folder-tree-modes/browser_customFolderTreeMode.js
mail/test/browser/folder-tree-modes/browser_smartFolders.js
mail/test/browser/shared-modules/FolderDisplayHelpers.jsm
mailnews/base/prefs/content/AccountManager.js
mailnews/base/public/nsIMsgAccountManager.idl
mailnews/base/src/nsMsgAccountManager.cpp
mailnews/compose/src/SmtpServer.jsm
mailnews/extensions/newsblog/FeedUtils.jsm
mailnews/import/src/nsBeckySettings.cpp
mailnews/import/src/nsOutlookSettings.cpp
mailnews/import/src/nsWMSettings.cpp
mailnews/local/test/unit/test_fileName.js
mailnews/news/src/NntpMessageService.jsm
mailnews/news/src/NntpService.jsm
mailnews/news/src/NntpUtils.jsm
mailnews/news/src/nsNntpService.cpp
mailnews/news/src/nsNntpUrl.cpp
--- a/mail/base/content/folderPane.js
+++ b/mail/base/content/folderPane.js
@@ -2304,17 +2304,17 @@ var gFolderTreeView = {
       __proto__: IFolderTreeMode,
 
       /**
        * The smart server. This will create the server if it doesn't exist.
        */
       get _smartServer() {
         let smartServer;
         try {
-          smartServer = MailServices.accounts.FindServer(
+          smartServer = MailServices.accounts.findServer(
             "nobody",
             "smart mailboxes",
             "none"
           );
         } catch (ex) {
           smartServer = MailServices.accounts.createIncomingServer(
             "nobody",
             "smart mailboxes",
--- a/mail/components/accountcreation/CreateInBackend.jsm
+++ b/mail/components/accountcreation/CreateInBackend.jsm
@@ -347,27 +347,27 @@ function rememberPassword(server, passwo
  * @param config {AccountConfig} filled in (no placeholders)
  * @return {nsIMsgIncomingServer} If it already exists, the server
  *     object is returned.
  *     If it's a new server, |null| is returned.
  */
 function checkIncomingServerAlreadyExists(config) {
   AccountCreationUtils.assert(config instanceof AccountConfig);
   let incoming = config.incoming;
-  let existing = MailServices.accounts.findRealServer(
+  let existing = MailServices.accounts.findServer(
     incoming.username,
     incoming.hostname,
     incoming.type,
     incoming.port
   );
 
   // if username does not have an '@', also check the e-mail
   // address form of the name.
   if (!existing && !incoming.username.includes("@")) {
-    existing = MailServices.accounts.findRealServer(
+    existing = MailServices.accounts.findServer(
       config.identity.emailAddress,
       incoming.hostname,
       incoming.type,
       incoming.port
     );
   }
   return existing;
 }
--- a/mail/components/accountcreation/verifyConfig.jsm
+++ b/mail/components/accountcreation/verifyConfig.jsm
@@ -66,17 +66,17 @@ function verifyConfig(
     config instanceof AccountConfig,
     "BUG: Arg 'config' needs to be an AccountConfig object"
   );
   assert(typeof alter == "boolean");
   assert(typeof successCallback == "function");
   assert(typeof errorCallback == "function");
 
   if (
-    MailServices.accounts.findRealServer(
+    MailServices.accounts.findServer(
       config.incoming.username,
       config.incoming.hostname,
       config.incoming.type,
       config.incoming.port
     )
   ) {
     errorCallback("Incoming server exists");
     return;
--- a/mail/components/activity/modules/moveCopy.jsm
+++ b/mail/components/activity/modules/moveCopy.jsm
@@ -194,17 +194,17 @@ var moveCopyModule = {
   folderDeleted(aFolder) {
     let server;
     try {
       // When a new account is created we get this notification with an empty named
       // folder that can't return its server. Ignore it.
       // TODO: find out what it is.
       server = aFolder.server;
       // If the account has been removed, we're going to ignore this notification.
-      MailServices.accounts.FindServer(
+      MailServices.accounts.findServer(
         server.username,
         server.hostName,
         server.type
       );
     } catch (ex) {
       return;
     }
 
--- a/mail/test/browser/account/browser_abWhitelist.js
+++ b/mail/test/browser/account/browser_abWhitelist.js
@@ -28,17 +28,17 @@ var { MailServices } = ChromeUtils.impor
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var gOldWhiteList = null;
 var gKeyString = null;
 
 var gAccount = null;
 
 add_setup(function() {
-  let server = MailServices.accounts.FindServer(
+  let server = MailServices.accounts.findServer(
     "tinderbox",
     FAKE_SERVER_HOSTNAME,
     "pop3"
   );
   gAccount = MailServices.accounts.FindAccountForServer(server);
   let serverKey = server.key;
 
   gKeyString = "mail.server." + serverKey + ".whiteListAbURI";
--- a/mail/test/browser/account/browser_portSetting.js
+++ b/mail/test/browser/account/browser_portSetting.js
@@ -29,17 +29,17 @@ var PORT_NUMBERS_TO_TEST = [
   "110", // Back to the original.
 ];
 
 var gTestNumber;
 
 function subtest_check_set_port_number(tab, dontSet) {
   // This test expects the following POP account to exist by default
   // with port number 110 and no security.
-  let server = MailServices.accounts.FindServer(
+  let server = MailServices.accounts.findServer(
     "tinderbox",
     FAKE_SERVER_HOSTNAME,
     "pop3"
   );
   let account = MailServices.accounts.FindAccountForServer(server);
 
   let accountRow = get_account_tree_row(account.key, "am-server.xhtml", tab);
   click_account_tree_row(tab, accountRow);
--- a/mail/test/browser/account/browser_settingsInfrastructure.js
+++ b/mail/test/browser/account/browser_settingsInfrastructure.js
@@ -386,17 +386,17 @@ function subtest_check_replyTo_leak(tab)
   let replyAddress = iframe.getElementById("identity.replyTo");
   Assert.equal(replyAddress.value, "");
 
   // Now we set a value into it and switch to another account, the main pane.
   replyAddress.value = "somewhere@else.com";
 
   // This test expects the following POP account to exist by default
   // in the test profile with port number 110 and no security.
-  let firstServer = MailServices.accounts.FindServer(
+  let firstServer = MailServices.accounts.findServer(
     "tinderbox",
     FAKE_SERVER_HOSTNAME,
     "pop3"
   );
   let firstAccount = MailServices.accounts.FindAccountForServer(firstServer);
 
   accountRow = get_account_tree_row(firstAccount.key, null, tab);
   click_account_tree_row(tab, accountRow);
--- a/mail/test/browser/cloudfile/browser_attachmentErrors.js
+++ b/mail/test/browser/cloudfile/browser_attachmentErrors.js
@@ -81,17 +81,17 @@ add_setup(async function() {
   );
   Services.prefs.setStringPref(
     "mail.identity.id2.htmlSigText",
     "Tinderboxpushlog is the new <b>hotness!</b>"
   );
 
   // For replies and forwards, we'll work off a message in the Inbox folder
   // of the fake "tinderbox" account.
-  let server = MailServices.accounts.FindServer(
+  let server = MailServices.accounts.findServer(
     "tinderbox",
     FAKE_SERVER_HOSTNAME,
     "pop3"
   );
   gInbox = await get_special_folder(Ci.nsMsgFolderFlags.Inbox, false, server);
   await add_message_to_folder([gInbox], create_message());
 
   gMockFilePickReg.register();
--- a/mail/test/browser/cloudfile/browser_attachmentUrls.js
+++ b/mail/test/browser/cloudfile/browser_attachmentUrls.js
@@ -103,17 +103,17 @@ add_setup(async function() {
   );
   Services.prefs.setStringPref(
     "mail.identity.id2.htmlSigText",
     "Tinderboxpushlog is the new <b>hotness!</b>"
   );
 
   // For replies and forwards, we'll work off a message in the Inbox folder
   // of the fake "tinderbox" account.
-  let server = MailServices.accounts.FindServer(
+  let server = MailServices.accounts.findServer(
     "tinderbox",
     FAKE_SERVER_HOSTNAME,
     "pop3"
   );
   gInbox = await get_special_folder(Ci.nsMsgFolderFlags.Inbox, false, server);
   await add_message_to_folder([gInbox], create_message());
 
   gMockFilePickReg.register();
--- a/mail/test/browser/composition/browser_addressWidgets.js
+++ b/mail/test/browser/composition/browser_addressWidgets.js
@@ -28,17 +28,17 @@ var accountPOP3 = null;
 var accountNNTP = null;
 var originalAccountCount;
 
 add_setup(function() {
   gFolderTreeView._tree.focus();
 
   // Ensure we're in the tinderbox account as that has the right identities set
   // up for this test.
-  let server = MailServices.accounts.FindServer(
+  let server = MailServices.accounts.findServer(
     "tinderbox",
     FAKE_SERVER_HOSTNAME,
     "pop3"
   );
   accountPOP3 = MailServices.accounts.FindAccountForServer(server);
 
   // There may be pre-existing accounts from other tests.
   originalAccountCount = MailServices.accounts.allServers.length;
--- a/mail/test/browser/composition/browser_sendButton.js
+++ b/mail/test/browser/composition/browser_sendButton.js
@@ -44,17 +44,17 @@ var { MailServices } = ChromeUtils.impor
   "resource:///modules/MailServices.jsm"
 );
 
 var account = null;
 
 add_setup(async function() {
   // Ensure we're in the tinderbox account as that has the right identities set
   // up for this test.
-  let server = MailServices.accounts.FindServer(
+  let server = MailServices.accounts.findServer(
     "tinderbox",
     FAKE_SERVER_HOSTNAME,
     "pop3"
   );
   account = MailServices.accounts.FindAccountForServer(server);
   let inbox = await get_special_folder(
     Ci.nsMsgFolderFlags.Inbox,
     false,
--- a/mail/test/browser/composition/browser_signatureUpdating.js
+++ b/mail/test/browser/composition/browser_signatureUpdating.js
@@ -44,17 +44,17 @@ add_setup(async function() {
   );
   Services.prefs.setStringPref(
     "mail.identity.id2.htmlSigText",
     "Tinderboxpushlog is the new <b>hotness!</b>"
   );
 
   // Ensure we're in the tinderbox account as that has the right identities set
   // up for this test.
-  let server = MailServices.accounts.FindServer(
+  let server = MailServices.accounts.findServer(
     "tinderbox",
     FAKE_SERVER_HOSTNAME,
     "pop3"
   );
   let inbox = await get_special_folder(
     Ci.nsMsgFolderFlags.Inbox,
     false,
     server
--- a/mail/test/browser/folder-pane/browser_folderPane.js
+++ b/mail/test/browser/folder-pane/browser_folderPane.js
@@ -33,17 +33,17 @@ var { MailServices } = ChromeUtils.impor
  * Assert the Folder Pane is in All Folder mode by default.  Check that the
  * correct number of rows for accounts and folders are always shown as new
  * folders are created, expanded, and collapsed.
  */
 add_task(async function test_all_folders_toggle_folder_open_state() {
   // Test that we are in All Folders mode by default
   assert_folder_mode("all");
 
-  let pop3Server = MailServices.accounts.FindServer(
+  let pop3Server = MailServices.accounts.findServer(
     "tinderbox",
     FAKE_SERVER_HOSTNAME,
     "pop3"
   );
   collapse_folder(pop3Server.rootFolder);
   collapse_folder(MailServices.accounts.localFoldersServer.rootFolder);
 
   // All folders mode should give us only 2 rows to start
--- a/mail/test/browser/folder-tree-modes/browser_customFolderTreeMode.js
+++ b/mail/test/browser/folder-tree-modes/browser_customFolderTreeMode.js
@@ -31,34 +31,34 @@ var { ExtensionSupport } = ChromeUtils.i
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 var { MailUtils } = ChromeUtils.import("resource:///modules/MailUtils.jsm");
 
 var gInbox;
 
 add_setup(async function() {
-  let server = MailServices.accounts.FindServer(
+  let server = MailServices.accounts.findServer(
     "tinderbox",
     FAKE_SERVER_HOSTNAME,
     "pop3"
   );
   gInbox = await get_special_folder(Ci.nsMsgFolderFlags.Inbox, false, server);
 
   ExtensionSupport.registerWindowListener("mochitest", {
     chromeURLs: ["chrome://messenger/content/messenger.xhtml"],
     onLoadWindow(aWindow) {
       let testFolderTreeMode = {
         __proto__: aWindow.IFolderTreeMode,
         generateMap(aFTV) {
           var { MailServices } = ChromeUtils.import(
             "resource:///modules/MailServices.jsm"
           );
           // Pick the tinderbox@foo.invalid inbox and use it as the only folder
-          let server = MailServices.accounts.FindServer(
+          let server = MailServices.accounts.findServer(
             "tinderbox",
             "tinderbox123",
             "pop3"
           );
           let item = [];
           let inbox = new aWindow.FtvItem(
             server.rootFolder.getChildNamed("Inbox")
           );
--- a/mail/test/browser/folder-tree-modes/browser_smartFolders.js
+++ b/mail/test/browser/folder-tree-modes/browser_smartFolders.js
@@ -178,17 +178,17 @@ add_task(function test_select_folder_exp
 add_task(async function test_folder_flag_changes() {
   expand_folder(smartInboxFolder);
   // Now attempt to select the folder.
   mc.folderTreeView.selectFolder(inboxSubfolder);
   // Need to archive two messages in two different accounts in order to
   // create a smart Archives folder.
   select_click_row(0);
   archive_selected_messages();
-  let pop3Server = MailServices.accounts.FindServer(
+  let pop3Server = MailServices.accounts.findServer(
     "tinderbox",
     FAKE_SERVER_HOSTNAME,
     "pop3"
   );
   let pop3Inbox = await get_special_folder(
     Ci.nsMsgFolderFlags.Inbox,
     false,
     pop3Server
--- a/mail/test/browser/shared-modules/FolderDisplayHelpers.jsm
+++ b/mail/test/browser/shared-modules/FolderDisplayHelpers.jsm
@@ -1611,17 +1611,17 @@ function middle_click_on_folder(aFolder)
 
 /**
  * Get a reference to the smart folder with the given name.
  *
  * @param aFolderName The name of the smart folder (e.g. "Inbox").
  * @returns An nsIMsgFolder representing the smart folder with the given name.
  */
 function get_smart_folder_named(aFolderName) {
-  let smartServer = MailServices.accounts.FindServer(
+  let smartServer = MailServices.accounts.findServer(
     "nobody",
     "smart mailboxes",
     "none"
   );
   return smartServer.rootFolder.getChildNamed(aFolderName);
 }
 
 /**
--- a/mailnews/base/prefs/content/AccountManager.js
+++ b/mailnews/base/prefs/content/AccountManager.js
@@ -629,17 +629,17 @@ function checkUserServerChanges(showAler
     if (oldUser != newUser || oldHost != newHost) {
       newUser = newUser.trim();
       newHost = cleanUpHostName(newHost);
       if (checkUser && newUser == "") {
         alertText = prefBundle.getString("userNameEmpty");
       } else if (!isLegalHostNameOrIP(newHost)) {
         alertText = prefBundle.getString("enterValidServerName");
       } else {
-        let sameServer = MailServices.accounts.findRealServer(
+        let sameServer = MailServices.accounts.findServer(
           newUser,
           newHost,
           newType,
           0
         );
         if (sameServer && sameServer != currentServer) {
           alertText = prefBundle.getString("modifiedAccountExists");
         } else {
--- a/mailnews/base/public/nsIMsgAccountManager.idl
+++ b/mailnews/base/public/nsIMsgAccountManager.idl
@@ -114,35 +114,30 @@ interface nsIMsgAccountManager : nsISupp
    * for preventing unauthenticated users from seeing header information
    */
   attribute boolean userNeedsToAuthenticate;
   /*
    * search for the server with the given username, hostname, and type
    * the type is the same as is specified in the preferences,
    * i.e. "imap", "pop3", "none", or "nntp"
    */
-  nsIMsgIncomingServer
-      FindServer(in ACString userName, in ACString hostname, in ACString type);
+  nsIMsgIncomingServer findServer(in ACString userName,
+                                  in ACString hostname,
+                                  in ACString type,
+                                  [optional] in long port);
 
   /*
    * search for the server with the given uri
    * an analog to FindServer()
    * The boolean flag selects whether we compare input against the
    * 'realhostname' and 'realuserName' pref settings.
    */
   nsIMsgIncomingServer
       findServerByURI(in nsIURI aURI, in boolean aRealFlag);
 
-  /*
-   * Same as FindServer() except it compares the input values against
-   * 'realhostname' and 'realuserName' pref settings.
-   */
-  nsIMsgIncomingServer
-      findRealServer(in ACString userName, in ACString hostname, in ACString type, in long port );
-
   /**
    * find the index of this server in the (ordered) list of accounts
    */
   long FindServerIndex(in nsIMsgIncomingServer server);
 
   /**
    * Finds an account for the given incoming server.
    *
--- a/mailnews/base/src/nsMsgAccountManager.cpp
+++ b/mailnews/base/src/nsMsgAccountManager.cpp
@@ -548,18 +548,17 @@ nsresult nsMsgAccountManager::createKeye
 
   int32_t port;
   nsCOMPtr<nsIMsgIncomingServer> existingServer;
   server->SetKey(key);
   server->SetType(type);
   server->SetUsername(username);
   server->SetHostName(hostname);
   server->GetPort(&port);
-  FindRealServer(username, hostname, type, port,
-                 getter_AddRefs(existingServer));
+  FindServer(username, hostname, type, port, getter_AddRefs(existingServer));
   // don't allow duplicate servers.
   if (existingServer) return NS_ERROR_FAILURE;
 
   m_incomingServers.InsertOrUpdate(key, server);
 
   // now add all listeners that are supposed to be
   // waiting on root folders
   nsCOMPtr<nsIMsgFolder> rootFolder;
@@ -1217,17 +1216,17 @@ nsresult nsMsgAccountManager::LoadAccoun
             serverPrefBranch->GetCharPref("type", type);
             // Find a server with the same info.
             nsCOMPtr<nsIMsgAccountManager> accountManager =
                 do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
             if (NS_FAILED(rv)) {
               continue;
             }
             nsCOMPtr<nsIMsgIncomingServer> server;
-            accountManager->FindServer(userName, hostName, type,
+            accountManager->FindServer(userName, hostName, type, 0,
                                        getter_AddRefs(server));
             if (server) {
               nsCOMPtr<nsIMsgAccount> replacement;
               accountManager->FindAccountForServer(server,
                                                    getter_AddRefs(replacement));
               if (replacement) {
                 nsCString accountKey;
                 replacement->GetKey(accountKey);
@@ -1836,30 +1835,19 @@ nsresult nsMsgAccountManager::findServer
   }
 
   return NS_ERROR_UNEXPECTED;
 }
 
 NS_IMETHODIMP
 nsMsgAccountManager::FindServer(const nsACString& username,
                                 const nsACString& hostname,
-                                const nsACString& type,
+                                const nsACString& type, int32_t port,
                                 nsIMsgIncomingServer** aResult) {
-  return findServerInternal(username, hostname, type, 0, false, aResult);
-}
-
-// Interface called by UI js only (always return true).
-NS_IMETHODIMP
-nsMsgAccountManager::FindRealServer(const nsACString& username,
-                                    const nsACString& hostname,
-                                    const nsACString& type, int32_t port,
-                                    nsIMsgIncomingServer** aResult) {
-  *aResult = nullptr;
-  findServerInternal(username, hostname, type, port, true, aResult);
-  return NS_OK;
+  return findServerInternal(username, hostname, type, port, false, aResult);
 }
 
 void nsMsgAccountManager::findAccountByServerKey(const nsCString& aKey,
                                                  nsIMsgAccount** aResult) {
   *aResult = nullptr;
 
   for (uint32_t i = 0; i < m_accounts.Length(); ++i) {
     nsCOMPtr<nsIMsgIncomingServer> server;
@@ -2036,23 +2024,24 @@ NS_IMETHODIMP nsMsgAccountManager::GetLo
   if (NS_SUCCEEDED(rv) && !serverKey.IsEmpty()) {
     rv = GetIncomingServer(serverKey, aServer);
     if (NS_SUCCEEDED(rv)) return rv;
     // otherwise, we're going to fall through to looking for an existing local
     // folders account, because now we fail creating one if one already exists.
   }
 
   // try ("nobody","Local Folders","none"), and work down to any "none" server.
-  rv = FindServer("nobody"_ns, "Local Folders"_ns, "none"_ns, aServer);
+  rv = FindServer("nobody"_ns, "Local Folders"_ns, "none"_ns, 0, aServer);
   if (NS_FAILED(rv) || !*aServer) {
-    rv = FindServer("nobody"_ns, EmptyCString(), "none"_ns, aServer);
+    rv = FindServer("nobody"_ns, EmptyCString(), "none"_ns, 0, aServer);
     if (NS_FAILED(rv) || !*aServer) {
-      rv = FindServer(EmptyCString(), "Local Folders"_ns, "none"_ns, aServer);
+      rv =
+          FindServer(EmptyCString(), "Local Folders"_ns, "none"_ns, 0, aServer);
       if (NS_FAILED(rv) || !*aServer)
-        rv = FindServer(EmptyCString(), EmptyCString(), "none"_ns, aServer);
+        rv = FindServer(EmptyCString(), EmptyCString(), "none"_ns, 0, aServer);
     }
   }
 
   NS_ENSURE_SUCCESS(rv, rv);
   if (!*aServer) return NS_ERROR_FAILURE;
 
   // we don't want the Smart Mailboxes server to be the local server.
   bool hidden;
--- a/mailnews/compose/src/SmtpServer.jsm
+++ b/mailnews/compose/src/SmtpServer.jsm
@@ -158,17 +158,17 @@ SmtpServer.prototype = {
         "mail.smtp.useMatchingHostNameServer"
       );
       let useMatchingDomainServer = Services.prefs.getBoolPref(
         "mail.smtp.useMatchingDomainServer"
       );
       if (useMatchingHostNameServer || useMatchingDomainServer) {
         if (useMatchingHostNameServer) {
           // Pass in empty type and port=0, to match imap and pop3.
-          incomingServer = MailServices.accounts.findRealServer(
+          incomingServer = MailServices.accounts.findServer(
             this.username,
             this.hostname,
             "",
             0
           );
         }
         if (
           !incomingServer &&
--- a/mailnews/extensions/newsblog/FeedUtils.jsm
+++ b/mailnews/extensions/newsblog/FeedUtils.jsm
@@ -139,19 +139,24 @@ var FeedUtils = {
   createRssAccount(aName) {
     let userName = "nobody";
     let hostName = "Feeds";
     let hostNamePref = hostName;
     let server;
     let serverType = "rss";
     let defaultName = FeedUtils.strings.GetStringFromName("feeds-accountname");
     let i = 2;
-    while (
-      MailServices.accounts.findRealServer(userName, hostName, serverType, 0)
-    ) {
+    let findServer = () => {
+      try {
+        return MailServices.accounts.findServer(userName, hostName, serverType);
+      } catch (e) {
+        return false;
+      }
+    };
+    while (findServer()) {
       // If "Feeds" exists, try "Feeds-2", then "Feeds-3", etc.
       hostName = hostNamePref + "-" + i++;
     }
 
     server = MailServices.accounts.createIncomingServer(
       userName,
       hostName,
       serverType
--- a/mailnews/import/src/nsBeckySettings.cpp
+++ b/mailnews/import/src/nsBeckySettings.cpp
@@ -112,17 +112,17 @@ nsresult nsBeckySettings::CreateIncoming
                                                const nsCString& aProtocol,
                                                nsIMsgIncomingServer** aServer) {
   nsresult rv;
   nsCOMPtr<nsIMsgAccountManager> accountManager =
       do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIMsgIncomingServer> incomingServer;
-  rv = accountManager->FindServer(aUserName, aServerName, aProtocol,
+  rv = accountManager->FindServer(aUserName, aServerName, aProtocol, 0,
                                   getter_AddRefs(incomingServer));
 
   if (NS_FAILED(rv) || !incomingServer) {
     rv = accountManager->CreateIncomingServer(aUserName, aServerName, aProtocol,
                                               getter_AddRefs(incomingServer));
     NS_ENSURE_SUCCESS(rv, rv);
   }
   incomingServer.forget(aServer);
--- a/mailnews/import/src/nsOutlookSettings.cpp
+++ b/mailnews/import/src/nsOutlookSettings.cpp
@@ -261,17 +261,17 @@ bool OutlookSettings::DoIMAPServer(nsIMs
   bool result = false;
 
   // I now have a user name/server name pair, find out if it already exists?
   nsAutoCString nativeUserName;
   NS_CopyUnicodeToNative(userName, nativeUserName);
   nsAutoCString nativeServerName;
   NS_CopyUnicodeToNative(aServerName, nativeServerName);
   nsCOMPtr<nsIMsgIncomingServer> in;
-  rv = aMgr->FindServer(nativeUserName, nativeServerName, "imap"_ns,
+  rv = aMgr->FindServer(nativeUserName, nativeServerName, "imap"_ns, 0,
                         getter_AddRefs(in));
   if (NS_FAILED(rv) || (in == nullptr)) {
     // Create the incoming server and an account for it?
     rv = aMgr->CreateIncomingServer(nativeUserName, nativeServerName, "imap"_ns,
                                     getter_AddRefs(in));
     if (NS_SUCCEEDED(rv) && in) {
       rv = in->SetType("imap"_ns);
       // TODO SSL, auth method
@@ -314,17 +314,17 @@ bool OutlookSettings::DoPOP3Server(nsIMs
   if (NS_FAILED(rv)) return false;
 
   // I now have a user name/server name pair, find out if it already exists?
   nsAutoCString nativeUserName;
   NS_CopyUnicodeToNative(userName, nativeUserName);
   nsAutoCString nativeServerName;
   NS_CopyUnicodeToNative(aServerName, nativeServerName);
   nsCOMPtr<nsIMsgIncomingServer> in;
-  rv = aMgr->FindServer(nativeUserName, nativeServerName, "pop3"_ns,
+  rv = aMgr->FindServer(nativeUserName, nativeServerName, "pop3"_ns, 0,
                         getter_AddRefs(in));
   if (NS_SUCCEEDED(rv)) return true;
 
   // Create the incoming server and an account for it?
   rv = aMgr->CreateIncomingServer(nativeUserName, nativeServerName, "pop3"_ns,
                                   getter_AddRefs(in));
   rv = in->SetType("pop3"_ns);
 
--- a/mailnews/import/src/nsWMSettings.cpp
+++ b/mailnews/import/src/nsWMSettings.cpp
@@ -207,17 +207,17 @@ bool WMSettings::DoIMAPServer(nsIMsgAcco
   nsAutoString userName, value;
   if (NS_FAILED(nsWMUtils::GetValueForTag(xmlDoc, "IMAP_User_Name", userName)))
     return false;
   bool result = false;
   // I now have a user name/server name pair, find out if it already exists?
   nsCOMPtr<nsIMsgIncomingServer> in;
   nsresult rv = pMgr->FindServer(NS_ConvertUTF16toUTF8(userName),
                                  NS_ConvertUTF16toUTF8(serverName), "imap"_ns,
-                                 getter_AddRefs(in));
+                                 0, getter_AddRefs(in));
   if (NS_FAILED(rv) || (in == nullptr)) {
     // Create the incoming server and an account for it?
     rv = pMgr->CreateIncomingServer(NS_ConvertUTF16toUTF8(userName),
                                     NS_ConvertUTF16toUTF8(serverName),
                                     "imap"_ns, getter_AddRefs(in));
     if (NS_SUCCEEDED(rv) && in) {
       nsCOMPtr<nsIImapIncomingServer> imapServer = do_QueryInterface(in);
       if (!imapServer) {
@@ -303,17 +303,17 @@ bool WMSettings::DoPOP3Server(nsIMsgAcco
   nsAutoString userName, value;
   if (NS_FAILED(nsWMUtils::GetValueForTag(xmlDoc, "POP3_User_Name", userName)))
     return false;
   bool result = false;
   // I now have a user name/server name pair, find out if it already exists?
   nsCOMPtr<nsIMsgIncomingServer> in;
   nsresult rv = pMgr->FindServer(NS_ConvertUTF16toUTF8(userName),
                                  NS_ConvertUTF16toUTF8(serverName), "pop3"_ns,
-                                 getter_AddRefs(in));
+                                 0, getter_AddRefs(in));
   if (NS_FAILED(rv) || (in == nullptr)) {
     // Create the incoming server and an account for it?
     rv = pMgr->CreateIncomingServer(NS_ConvertUTF16toUTF8(userName),
                                     NS_ConvertUTF16toUTF8(serverName),
                                     "pop3"_ns, getter_AddRefs(in));
     if (NS_SUCCEEDED(rv) && in) {
       nsCOMPtr<nsIPop3IncomingServer> pop3Server = do_QueryInterface(in);
       if (!pop3Server) {
@@ -454,17 +454,17 @@ bool WMSettings::DoNNTPServer(nsIMsgAcco
   nsWMUtils::GetValueForTag(xmlDoc, "NNTP_User_Name", userName);
   bool result = false;
 
   // I now have a user name/server name pair, find out if it already exists?
   // NNTP can have empty user name.  This is wild card in findserver
   nsCOMPtr<nsIMsgIncomingServer> in;
   nsresult rv =
       pMgr->FindServer(EmptyCString(), NS_ConvertUTF16toUTF8(serverName),
-                       "nntp"_ns, getter_AddRefs(in));
+                       "nntp"_ns, 0, getter_AddRefs(in));
   if (NS_FAILED(rv) || (in == nullptr)) {
     // Create the incoming server and an account for it?
     rv = pMgr->CreateIncomingServer(nsDependentCString(""),
                                     NS_ConvertUTF16toUTF8(serverName),
                                     "nntp"_ns, getter_AddRefs(in));
     if (NS_SUCCEEDED(rv) && in) {
       nsCOMPtr<nsINntpIncomingServer> nntpServer = do_QueryInterface(in);
       if (!nntpServer) {
--- a/mailnews/local/test/unit/test_fileName.js
+++ b/mailnews/local/test/unit/test_fileName.js
@@ -67,17 +67,17 @@ function run_test() {
   Services.prefs.setCharPref("mail.server.server2.userName", "user");
   // This basically says to ignore the time stamp in the .msf file
   Services.prefs.setIntPref("mail.db_timestamp_leeway", 0x7fffffff);
 
   localAccountUtils.incomingServer = MailServices.accounts.localFoldersServer;
   // force load of accounts.
   MailServices.accounts.defaultAccount;
 
-  let pop3Server = MailServices.accounts.FindServer("user", "poptest", "pop3");
+  let pop3Server = MailServices.accounts.findServer("user", "poptest", "pop3");
   let rootFolder = localAccountUtils.incomingServer.rootMsgFolder.QueryInterface(
     Ci.nsIMsgLocalMailFolder
   );
   let pop3Root = pop3Server.rootMsgFolder;
 
   // Note: Inbox is not created automatically when there is no deferred server,
   // so we need to create it.
   localAccountUtils.inboxFolder = rootFolder.createLocalSubfolder("Inbox");
--- a/mailnews/news/src/NntpMessageService.jsm
+++ b/mailnews/news/src/NntpMessageService.jsm
@@ -136,17 +136,17 @@ class BaseMessageService {
     } else {
       let url = new URL(uri);
       host = url.hostname;
       groupName = url.searchParams.get("group");
       key = url.searchParams.get("key");
     }
     groupName = groupName ? decodeURIComponent(groupName) : null;
     let server = MailServices.accounts
-      .FindServer("", host, "nntp")
+      .findServer("", host, "nntp")
       .QueryInterface(Ci.nsINntpIncomingServer);
     let folder;
     if (groupName) {
       folder = server.rootFolder
         .getChildNamed(groupName)
         .QueryInterface(Ci.nsIMsgNewsFolder);
     }
     return [folder, key];
--- a/mailnews/news/src/NntpService.jsm
+++ b/mailnews/news/src/NntpService.jsm
@@ -52,17 +52,17 @@ class NntpService {
     }
     outNewsHostHeader.value = host;
   }
 
   postMessage(messageFile, groupNames, accountKey, urlListener, msgWindow) {
     let server = MailServices.accounts.getAccount(accountKey)?.incomingServer;
     if (!server) {
       // If no matching server, find the first news server and use it.
-      server = MailServices.accounts.FindServer("", "", "nntp");
+      server = MailServices.accounts.findServer("", "", "nntp");
     }
     server = server.QueryInterface(Ci.nsINntpIncomingServer);
 
     server.wrappedJSObject.withClient(client => {
       client.urlListener = urlListener;
 
       client.onOpen = () => {
         client.post(msgWindow);
@@ -167,17 +167,17 @@ class NntpService {
         // Cancelled.
         return;
       }
     }
     // The cancelUrl is in the form of "news://host/message-id?cancel"
     let url = new URL(cancelUrl);
     let messageId = "<" + decodeURIComponent(url.pathname.slice(1)) + ">";
     let server = MailServices.accounts
-      .FindServer("", url.host, "nntp")
+      .findServer("", url.host, "nntp")
       .QueryInterface(Ci.nsINntpIncomingServer);
     let groupName = new URL(messageUri).pathname.slice(1);
     let messageKey = messageUri.split("#")[1];
     let newsFolder = server.findGroup(groupName);
     let from = MailServices.accounts.getFirstIdentityForServer(server).email;
     let bundle = Services.strings.createBundle(
       "chrome://branding/locale/brand.properties"
     );
--- a/mailnews/news/src/NntpUtils.jsm
+++ b/mailnews/news/src/NntpUtils.jsm
@@ -17,17 +17,17 @@ XPCOMUtils.defineLazyModuleGetters(this,
  * Collection of helper functions for NNTP.
  */
 var NntpUtils = {
   /**
    * Find a server instance by its hostname.
    *
    * Sometimes we create a server instance to load a news url, this server is
    * written to the prefs but not associated with any account. Different from
-   * nsIMsgAccountManager.findRealServer which can only find servers associated
+   * nsIMsgAccountManager.findServer which can only find servers associated
    * with accounts, this function looks for NNTP server in the mail.server.
    * branch directly.
    *
    * @param {string} hostname - The hostname of the server.
    * @returns {nsINntpIncomingServer|null}
    */
   findServer(hostname) {
     let branch = Services.prefs.getBranch("mail.server.");
--- a/mailnews/news/src/nsNntpService.cpp
+++ b/mailnews/news/src/nsNntpService.cpp
@@ -758,17 +758,17 @@ nsresult nsNntpService::GetNntpServerByA
                                     getter_AddRefs(account));
     if (NS_SUCCEEDED(rv) && account)
       rv = account->GetIncomingServer(aNntpServer);
   }
 
   // if we don't have a news host, find the first news server and use it
   if (NS_FAILED(rv) || !*aNntpServer)
     rv = accountManager->FindServer(EmptyCString(), EmptyCString(), "nntp"_ns,
-                                    aNntpServer);
+                                    0, aNntpServer);
 
   return rv;
 }
 
 NS_IMETHODIMP
 nsNntpService::PostMessage(nsIFile* aFileToPost, const char* newsgroupsNames,
                            const char* aAccountKey,
                            nsIUrlListener* aUrlListener,
--- a/mailnews/news/src/nsNntpUrl.cpp
+++ b/mailnews/news/src/nsNntpUrl.cpp
@@ -391,45 +391,25 @@ nsNntpUrl::GetServer(nsIMsgIncomingServe
   GetHost(host);
 
   // No authority -> no server
   if (host.IsEmpty()) {
     *aServer = nullptr;
     return NS_OK;
   }
 
-  // Looking up the server...
-  // news-message is used purely internally, so it can never refer to the real
-  // attribute. nntp is never used internally, so it probably refers to the real
-  // one. news is used both internally and externally, so it could refer to
-  // either one. We'll assume it's an internal one first, though.
-  bool isNews = scheme.EqualsLiteral("news") || scheme.EqualsLiteral("snews");
-  bool isNntp = scheme.EqualsLiteral("nntp") || scheme.EqualsLiteral("nntps");
-
-  bool tryReal = isNntp;
-
   nsCOMPtr<nsIMsgAccountManager> accountManager =
       do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Ignoring return results: it is perfectly acceptable for the server to not
-  // exist, but FindServer (and not FindRealServer) throws NS_ERROR_UNEXPECTED
+  // exist, but FindServer (and not FindServer) throws NS_ERROR_UNEXPECTED
   // in this case.
   *aServer = nullptr;
-  if (tryReal)
-    accountManager->FindRealServer(user, host, "nntp"_ns, 0, aServer);
-  else
-    accountManager->FindServer(user, host, "nntp"_ns, aServer);
-  if (!*aServer && (isNews || isNntp)) {
-    // Didn't find it, try the other option
-    if (tryReal)
-      accountManager->FindServer(user, host, "nntp"_ns, aServer);
-    else
-      accountManager->FindRealServer(user, host, "nntp"_ns, 0, aServer);
-  }
+  accountManager->FindServer(user, host, "nntp"_ns, 0, aServer);
   return NS_OK;
 }
 
 NS_IMETHODIMP nsNntpUrl::GetFolder(nsIMsgFolder** msgFolder) {
   NS_ENSURE_ARG_POINTER(msgFolder);
 
   nsresult rv;