diff --git a/mozilla/mailnews/base/resources/content/commandglue.js b/mozilla/mailnews/base/resources/content/commandglue.js index 7404c9214db..90ae1181666 100644 --- a/mozilla/mailnews/base/resources/content/commandglue.js +++ b/mozilla/mailnews/base/resources/content/commandglue.js @@ -242,7 +242,7 @@ function isNewsURI(uri) return false; } else { - return ((uri.substring(0,6) == "news:/") || (uri.substring(0,14) == "news_message:/")); + return ((uri.substring(0,6) == "news:/") || (uri.substring(0,14) == "news-message:/")); } } diff --git a/mozilla/mailnews/base/resources/content/mailWindowOverlay.js b/mozilla/mailnews/base/resources/content/mailWindowOverlay.js index 1847080e0fe..c7e530f7dce 100644 --- a/mozilla/mailnews/base/resources/content/mailWindowOverlay.js +++ b/mozilla/mailnews/base/resources/content/mailWindowOverlay.js @@ -260,7 +260,7 @@ function InitMessageMenu() function IsNewsMessage(messageUri) { if (!messageUri) return false; - return (messageUri.substring(0,14) == "news_message:/") + return (messageUri.substring(0,14) == "news-message:/") } function InitMessageMark() diff --git a/mozilla/mailnews/base/util/nsMsgUtils.cpp b/mozilla/mailnews/base/util/nsMsgUtils.cpp index 949f129e7c0..0b397cc69e8 100644 --- a/mozilla/mailnews/base/util/nsMsgUtils.cpp +++ b/mozilla/mailnews/base/util/nsMsgUtils.cpp @@ -109,42 +109,40 @@ nsresult GetMsgDBHdrFromURI(const char *uri, nsIMsgDBHdr **msgHdr) nsresult CreateStartupUrl(char *uri, nsIURI** aUrl) { - nsresult rv = NS_ERROR_NULL_POINTER; - if (!uri || !*uri || !aUrl) return rv; - *aUrl = nsnull; - if (PL_strncasecmp(uri, "imap", 4) == 0) - { - nsCOMPtr imapUrl; - rv = nsComponentManager::CreateInstance(kImapUrlCID, nsnull, - NS_GET_IID(nsIImapUrl), - getter_AddRefs(imapUrl)); - if (NS_SUCCEEDED(rv) && imapUrl) - rv = imapUrl->QueryInterface(NS_GET_IID(nsIURI), - (void**) aUrl); - } - else if (PL_strncasecmp(uri, "mailbox", 7) == 0) - { - nsCOMPtr mailboxUrl; - rv = nsComponentManager::CreateInstance(kCMailboxUrl, nsnull, - NS_GET_IID(nsIMailboxUrl), - getter_AddRefs(mailboxUrl)); - if (NS_SUCCEEDED(rv) && mailboxUrl) - rv = mailboxUrl->QueryInterface(NS_GET_IID(nsIURI), - (void**) aUrl); - } - else if (PL_strncasecmp(uri, "news", 4) == 0) - { - nsCOMPtr nntpUrl; - rv = nsComponentManager::CreateInstance(kCNntpUrlCID, nsnull, - NS_GET_IID(nsINntpUrl), - getter_AddRefs(nntpUrl)); - if (NS_SUCCEEDED(rv) && nntpUrl) - rv = nntpUrl->QueryInterface(NS_GET_IID(nsIURI), - (void**) aUrl); - } - if (*aUrl) - (*aUrl)->SetSpec(uri); - return rv; + nsresult rv = NS_ERROR_NULL_POINTER; + if (!uri || !*uri || !aUrl) return rv; + *aUrl = nsnull; + + // XXX fix this, so that base doesn't depend on imap, local or news. + // we can't do NS_NewURI(uri, aUrl), because these are imap-message://, mailbox-message://, news-message:// uris. + // I think we should do something like GetMessageServiceFromURI() to get the service, and then have the service create the + // appropriate nsI*Url, and then QI to nsIURI, and return it. + // see bug #110689 + if (PL_strncasecmp(uri, "imap", 4) == 0) + { + nsCOMPtr imapUrl = do_CreateInstance(kImapUrlCID, &rv); + + if (NS_SUCCEEDED(rv) && imapUrl) + rv = imapUrl->QueryInterface(NS_GET_IID(nsIURI), + (void**) aUrl); + } + else if (PL_strncasecmp(uri, "mailbox", 7) == 0) + { + nsCOMPtr mailboxUrl = do_CreateInstance(kCMailboxUrl, &rv); + if (NS_SUCCEEDED(rv) && mailboxUrl) + rv = mailboxUrl->QueryInterface(NS_GET_IID(nsIURI), + (void**) aUrl); + } + else if (PL_strncasecmp(uri, "news", 4) == 0) + { + nsCOMPtr nntpUrl = do_CreateInstance(kCNntpUrlCID, &rv); + if (NS_SUCCEEDED(rv) && nntpUrl) + rv = nntpUrl->QueryInterface(NS_GET_IID(nsIURI), + (void**) aUrl); + } + if (*aUrl) + (*aUrl)->SetSpec(uri); + return rv; } diff --git a/mozilla/mailnews/compose/src/nsMsgAttachmentHandler.cpp b/mozilla/mailnews/compose/src/nsMsgAttachmentHandler.cpp index 5348e6d6648..3e8258d7d55 100644 --- a/mozilla/mailnews/compose/src/nsMsgAttachmentHandler.cpp +++ b/mozilla/mailnews/compose/src/nsMsgAttachmentHandler.cpp @@ -478,7 +478,7 @@ nsMsgAttachmentHandler::SnarfMsgAttachment(nsMsgCompFields *compFields) nsresult rv = NS_ERROR_INVALID_ARG; nsCOMPtr messageService; - if (PL_strcasestr(m_uri, "_message:")) + if (PL_strcasestr(m_uri, "-message:")) { mFileSpec = nsMsgCreateTempFileSpec("nsmail.tmp"); mDeleteFile = PR_TRUE; diff --git a/mozilla/mailnews/compose/src/nsMsgSend.cpp b/mozilla/mailnews/compose/src/nsMsgSend.cpp index dfdf952b2fc..2d59a448a76 100644 --- a/mozilla/mailnews/compose/src/nsMsgSend.cpp +++ b/mozilla/mailnews/compose/src/nsMsgSend.cpp @@ -2262,13 +2262,13 @@ nsMsgComposeAndSend::AddCompFieldRemoteAttachments(PRUint32 aStartLocation, msg_pick_real_name(&m_attachments[newLoc], proposedName, mCompFields->GetCharacterSet()); ++newLoc; } - else if (strUrl.Find("_message:") != -1) + else if (strUrl.Find("-message:") != -1) { - if (strUrl.Find("mailbox_message:") != -1 || - strUrl.Find("imap_message:") != -1) + if (strUrl.Find("mailbox-message:") != -1 || + strUrl.Find("imap-message:") != -1) (*aMailboxCount)++; - else if (strUrl.Find("news_message:") != -1 || - strUrl.Find("snews_message:") != -1) + else if (strUrl.Find("news-message:") != -1 || + strUrl.Find("snews-message:") != -1) (*aNewsCount)++; m_attachments[newLoc].m_uri = ToNewCString(strUrl); diff --git a/mozilla/mailnews/imap/build/nsImapFactory.cpp b/mozilla/mailnews/imap/build/nsImapFactory.cpp index 9fee15b34c1..0b683a76c52 100644 --- a/mozilla/mailnews/imap/build/nsImapFactory.cpp +++ b/mozilla/mailnews/imap/build/nsImapFactory.cpp @@ -80,7 +80,7 @@ static nsModuleComponentInfo gComponents[] = { nsImapMailFolderConstructor }, { "IMAP Service", NS_IMAPSERVICE_CID, - "@mozilla.org/messenger/messageservice;1?type=imap_message", + "@mozilla.org/messenger/messageservice;1?type=imap-message", nsImapServiceConstructor }, { "IMAP Service", NS_IMAPSERVICE_CID, diff --git a/mozilla/mailnews/imap/src/nsImapUtils.cpp b/mozilla/mailnews/imap/src/nsImapUtils.cpp index 190d10f8a5e..7fb95357b64 100644 --- a/mozilla/mailnews/imap/src/nsImapUtils.cpp +++ b/mozilla/mailnews/imap/src/nsImapUtils.cpp @@ -206,7 +206,7 @@ nsresult nsParseImapMessageURI(const char* uri, nsCString& folderURI, PRUint32 * keySeparator); nsAutoString folderPath; uriStr.Left(folderURI, keySeparator); - folderURI.Cut(4, 8); // cut out the _message part of imap_message: + folderURI.Cut(4, 8); // cut out the _message part of imap-message: nsCAutoString keyStr; if (keyEndSeparator != -1) uriStr.Mid(keyStr, keySeparator+1, diff --git a/mozilla/mailnews/imap/src/nsImapUtils.h b/mozilla/mailnews/imap/src/nsImapUtils.h index bbbae099969..4c2d4423dc6 100644 --- a/mozilla/mailnews/imap/src/nsImapUtils.h +++ b/mozilla/mailnews/imap/src/nsImapUtils.h @@ -43,7 +43,7 @@ #include "nsIMsgIncomingServer.h" static const char kImapRootURI[] = "imap:/"; -static const char kImapMessageRootURI[] = "imap_message:/"; +static const char kImapMessageRootURI[] = "imap-message:/"; extern nsresult nsImapURI2Path(const char* rootURI, const char* uriStr, diff --git a/mozilla/mailnews/local/build/nsMsgLocalCID.h b/mozilla/mailnews/local/build/nsMsgLocalCID.h index ba2a83ef86f..fa7efe2f3f2 100644 --- a/mozilla/mailnews/local/build/nsMsgLocalCID.h +++ b/mozilla/mailnews/local/build/nsMsgLocalCID.h @@ -105,7 +105,7 @@ "@mozilla.org/messenger/messageservice;1?type=mailbox" #define NS_MAILBOXSERVICE_CONTRACTID3 \ - "@mozilla.org/messenger/messageservice;1?type=mailbox_message" + "@mozilla.org/messenger/messageservice;1?type=mailbox-message" #define NS_MAILBOXSERVICE_CONTRACTID4 \ NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "mailbox" diff --git a/mozilla/mailnews/local/src/nsLocalUtils.cpp b/mozilla/mailnews/local/src/nsLocalUtils.cpp index 8b8d29f4b30..073080a2ab6 100644 --- a/mozilla/mailnews/local/src/nsLocalUtils.cpp +++ b/mozilla/mailnews/local/src/nsLocalUtils.cpp @@ -197,7 +197,7 @@ nsLocalURI2Path(const char* rootURI, const char* uriStr, { nsresult rv; - // verify that rootURI starts with "mailbox:/" or "mailbox_message:/" + // verify that rootURI starts with "mailbox:/" or "mailbox-message:/" if ((PL_strcmp(rootURI, kMailboxRootURI) != 0) && (PL_strcmp(rootURI, kMailboxMessageRootURI) != 0)) { pathResult = nsnull; @@ -253,8 +253,8 @@ nsLocalURI2Path(const char* rootURI, const char* uriStr, } /* parses LocalMessageURI - * mailbox_message://folder1/folder2#123?header=none or - * mailbox_message://folder1/folder2#1234&part=1.2 + * mailbox-message://folder1/folder2#123?header=none or + * mailbox-message://folder1/folder2#1234&part=1.2 * * puts folder URI in folderURI (mailbox://folder1/folder2) * message key number in key @@ -274,7 +274,7 @@ nsresult nsParseLocalMessageURI(const char* uri, keySeparator); nsAutoString folderPath; uriStr.Left(folderURI, keySeparator); - folderURI.Cut(7, 8); // cut out the _message part of mailbox_message: + folderURI.Cut(7, 8); // cut out the -message part of mailbox-message: nsCAutoString keyStr; if (keyEndSeparator != -1) @@ -294,7 +294,7 @@ nsresult nsParseLocalMessageURI(const char* uri, nsresult nsBuildLocalMessageURI(const char *baseURI, PRUint32 key, nsCString& uri) { - // need to convert mailbox://hostname/.. to mailbox_message://hostname/.. + // need to convert mailbox://hostname/.. to mailbox-message://hostname/.. uri.Append(baseURI); uri.Append('#'); diff --git a/mozilla/mailnews/local/src/nsLocalUtils.h b/mozilla/mailnews/local/src/nsLocalUtils.h index ff97325a303..b3f37b7c3ad 100644 --- a/mozilla/mailnews/local/src/nsLocalUtils.h +++ b/mozilla/mailnews/local/src/nsLocalUtils.h @@ -43,7 +43,7 @@ #include "nsIMsgIncomingServer.h" static const char kMailboxRootURI[] = "mailbox:/"; -static const char kMailboxMessageRootURI[] = "mailbox_message:/"; +static const char kMailboxMessageRootURI[] = "mailbox-message:/"; nsresult nsLocalURI2Path(const char* rootURI, const char* uriStr, nsFileSpec& pathResult); diff --git a/mozilla/mailnews/local/src/nsPop3Service.cpp b/mozilla/mailnews/local/src/nsPop3Service.cpp index 99713227be4..861478d081a 100644 --- a/mozilla/mailnews/local/src/nsPop3Service.cpp +++ b/mozilla/mailnews/local/src/nsPop3Service.cpp @@ -411,7 +411,7 @@ NS_IMETHODIMP nsPop3Service::NewURI(const char *aSpec, nsIURI *aBaseURI, nsIURI if (NS_SUCCEEDED(rv)) { nsCAutoString messageUri (aSpec); - messageUri.ReplaceSubstring("mailbox:", "mailbox_message:"); + messageUri.ReplaceSubstring("mailbox:", "mailbox-message:"); messageUri.ReplaceSubstring("?number=", "#"); offset = messageUri.Find("&"); if (offset) diff --git a/mozilla/mailnews/mime/src/mimemsg.cpp b/mozilla/mailnews/mime/src/mimemsg.cpp index 5dc9ca29e4a..07336fd9b42 100644 --- a/mozilla/mailnews/mime/src/mimemsg.cpp +++ b/mozilla/mailnews/mime/src/mimemsg.cpp @@ -781,7 +781,7 @@ MimeMessage_partial_message_html(const char *data, void *closure, PR_FALSE); char *msgIdPtr = PL_strstr(msgId, "<"); - orig_url.ReplaceSubstring("mailbox_message", "mailbox"); + orig_url.ReplaceSubstring("mailbox-message", "mailbox"); orig_url.ReplaceSubstring("#", "?number="); if (msgIdPtr) diff --git a/mozilla/mailnews/news/build/nsMsgNewsCID.h b/mozilla/mailnews/news/build/nsMsgNewsCID.h index 99a3f6e958f..28c49f96959 100644 --- a/mozilla/mailnews/news/build/nsMsgNewsCID.h +++ b/mozilla/mailnews/news/build/nsMsgNewsCID.h @@ -79,9 +79,9 @@ #define NS_NNTPPROTOCOLHANDLER_CONTRACTID \ NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "nntp" #define NS_NEWSMESSAGEPROTOCOLHANDLER_CONTRACTID \ - NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "news_message" + NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "news-message" #define NS_NEWSMESSAGESERVICE_CONTRACTID \ - "@mozilla.org/messenger/messageservice;1?type=news_message" + "@mozilla.org/messenger/messageservice;1?type=news-message" #define NS_NNTPMESSAGESERVICE_CONTRACTID \ "@mozilla.org/messenger/messageservice;1?type=news" #define NS_NNTPSERVICE_CONTRACTID \ diff --git a/mozilla/mailnews/news/public/nsINntpService.idl b/mozilla/mailnews/news/public/nsINntpService.idl index c90545201f7..116483fe266 100644 --- a/mozilla/mailnews/news/public/nsINntpService.idl +++ b/mozilla/mailnews/news/public/nsINntpService.idl @@ -78,7 +78,7 @@ interface nsINntpService : nsISupports { void downloadNewsgroupsForOffline(in nsIMsgWindow aMsgWindow, in nsIUrlListener aListener); /** - * can handle news_message:// and news:// + * can handle news-message:// and news:// */ void decomposeNewsURI(in string uri, out nsIMsgFolder folder, out nsMsgKey key); diff --git a/mozilla/mailnews/news/src/nsNNTPProtocol.cpp b/mozilla/mailnews/news/src/nsNNTPProtocol.cpp index beca2432f3f..6630ecd1c01 100644 --- a/mozilla/mailnews/news/src/nsNNTPProtocol.cpp +++ b/mozilla/mailnews/news/src/nsNNTPProtocol.cpp @@ -1003,7 +1003,7 @@ nsresult nsNNTPProtocol::LoadUrl(nsIURI * aURL, nsISupports * aConsumer) if (m_messageID || (m_key != nsMsgKey_None)) { /* - news_message://HOST/GROUP#key + news-message://HOST/GROUP#key news://HOST/MESSAGE_ID not sure about these: diff --git a/mozilla/mailnews/news/src/nsNewsUtils.cpp b/mozilla/mailnews/news/src/nsNewsUtils.cpp index 987ac862d18..52a191fc145 100644 --- a/mozilla/mailnews/news/src/nsNewsUtils.cpp +++ b/mozilla/mailnews/news/src/nsNewsUtils.cpp @@ -57,7 +57,7 @@ nsParseNewsMessageURI(const char* uri, nsCString& folderURI, PRUint32 *key) keySeparator); uriStr.Left(folderURI, keySeparator); - folderURI.Cut(4, 8); // cut out the _message part of news_message: + folderURI.Cut(4, 8); // cut out the -message part of news-message: nsCAutoString keyStr; if (keyEndSeparator != -1) diff --git a/mozilla/mailnews/news/src/nsNewsUtils.h b/mozilla/mailnews/news/src/nsNewsUtils.h index e5c364bf86c..2f0906c9977 100644 --- a/mozilla/mailnews/news/src/nsNewsUtils.h +++ b/mozilla/mailnews/news/src/nsNewsUtils.h @@ -44,7 +44,7 @@ class nsIMsgNewsFolder; static const char kNntpRootURI[] = "nntp:/"; static const char kNewsRootURI[] = "news:/"; -static const char kNewsMessageRootURI[] = "news_message:/"; +static const char kNewsMessageRootURI[] = "news-message:/"; #define kNewsRootURILen 6 #define kNntpRootURILen 6 diff --git a/mozilla/mailnews/news/src/nsNntpService.cpp b/mozilla/mailnews/news/src/nsNntpService.cpp index 32846ade94e..ee2e14d3285 100644 --- a/mozilla/mailnews/news/src/nsNntpService.cpp +++ b/mozilla/mailnews/news/src/nsNntpService.cpp @@ -136,7 +136,7 @@ nsNntpService::SaveMessageToDisk(const char *aMessageURI, nsresult rv = NS_OK; NS_ENSURE_ARG_POINTER(aMessageURI); - // double check it is a news_message:/ uri + // double check it is a news-message:/ uri if (PL_strncmp(aMessageURI, kNewsMessageRootURI, kNewsMessageRootURILen)) { rv = NS_ERROR_UNEXPECTED; NS_ENSURE_SUCCESS(rv,rv); @@ -448,7 +448,7 @@ NS_IMETHODIMP nsNntpService::GetUrlForUri(const char *aMessageURI, nsIURI **aURL NS_ENSURE_ARG_POINTER(aMessageURI); - // double check that it is a news_message:/ uri + // double check that it is a news-message:/ uri if (PL_strncmp(aMessageURI, kNewsMessageRootURI, kNewsMessageRootURILen)) { rv = NS_ERROR_UNEXPECTED; NS_ENSURE_SUCCESS(rv,rv);