Bug 1556242 - Discard '-message' part of URL scheme in nsMsgAccountManager::FindServerByURI(). r=aceman DONTBUILD
authorJorg K <jorgk@jorgk.com>
Wed, 05 Jun 2019 11:16:36 +0200
changeset 35775 2be4f664709ce345bf9a06561b6462e509aef9a1
parent 35774 0e71e7bac1888f0d0871fc6542dec4b32fb5b532
child 35776 96ab0ff97ab4901115e88ee8cfb0d02d19c34a89
push id392
push userclokep@gmail.com
push dateMon, 02 Sep 2019 20:17:19 +0000
reviewersaceman
bugs1556242
Bug 1556242 - Discard '-message' part of URL scheme in nsMsgAccountManager::FindServerByURI(). r=aceman DONTBUILD
mailnews/base/src/nsMsgAccountManager.cpp
--- a/mailnews/base/src/nsMsgAccountManager.cpp
+++ b/mailnews/base/src/nsMsgAccountManager.cpp
@@ -1723,16 +1723,20 @@ nsMsgAccountManager::FindServerByURI(nsI
   nsAutoCString escapedHostname;
   rv = aURI->GetHost(escapedHostname);
   if (NS_SUCCEEDED(rv) && !escapedHostname.IsEmpty())
     MsgUnescapeString(escapedHostname, 0, hostname);
 
   nsAutoCString type;
   rv = aURI->GetScheme(type);
   if (NS_SUCCEEDED(rv) && !type.IsEmpty()) {
+    // Remove "-message" from the scheme in case we get called with
+    // "imap-message", "mailbox-message", or friends.
+    if (StringEndsWith(type, nsDependentCString("-message")))
+      type.SetLength(type.Length() - 8);
     // now modify type if pop or news
     if (type.EqualsLiteral("pop")) type.AssignLiteral("pop3");
     // we use "nntp" in the server list so translate it here.
     else if (type.EqualsLiteral("news"))
       type.AssignLiteral("nntp");
     // we use "any" as the wildcard type.
     else if (type.EqualsLiteral("any"))
       type.Truncate();