fix for #110502. get "edit as new" and "fwd inline" to work again.

the problem is the standard url parser no longer allows us to use illegal
uris.  '_' is an illegal character in a URI (and URL) scheme.
so this patch switches from "foo_message://" to "foo-message://"
r=bbaetz,sr=bienvenu
This commit is contained in:
sspitzer%netscape.com 2001-11-18 23:38:52 +00:00
Родитель f35c43b8fc
Коммит 7c3194119c
19 изменённых файлов: 61 добавлений и 290 удалений

Просмотреть файл

@ -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:/"));
}
}

Просмотреть файл

@ -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()

Просмотреть файл

@ -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<nsIImapUrl> 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<nsIMailboxUrl> 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<nsINntpUrl> 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<nsIImapUrl> 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<nsIMailboxUrl> 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<nsINntpUrl> 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;
}

Просмотреть файл

@ -478,7 +478,7 @@ nsMsgAttachmentHandler::SnarfMsgAttachment(nsMsgCompFields *compFields)
nsresult rv = NS_ERROR_INVALID_ARG;
nsCOMPtr <nsIMsgMessageService> messageService;
if (PL_strcasestr(m_uri, "_message:"))
if (PL_strcasestr(m_uri, "-message:"))
{
mFileSpec = nsMsgCreateTempFileSpec("nsmail.tmp");
mDeleteFile = PR_TRUE;

Просмотреть файл

@ -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);

Просмотреть файл

@ -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,

Просмотреть файл

@ -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,

Просмотреть файл

@ -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,

Просмотреть файл

@ -1,227 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Adam D. Moss <adam@gimp.org>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsMsgLocalCID_h__
#define nsMsgLocalCID_h__
#include "nsISupports.h"
#include "nsIFactory.h"
#include "nsIComponentManager.h"
#include "nsMsgBaseCID.h"
#define NS_POP3INCOMINGSERVER_TYPE "pop3"
//
// nsLocalMailFolderResourceCID
//
#define NS_LOCALMAILFOLDERRESOURCE_CONTRACTID \
NS_RDF_RESOURCE_FACTORY_CONTRACTID_PREFIX "mailbox"
#define NS_LOCALMAILFOLDERRESOURCE_CID \
{ /* e490d22c-cd67-11d2-8cca-0060b0fc14a3 */ \
0xe490d22c, \
0xcd67, \
0x11d2, \
{0x8c, 0xca, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3} \
}
//
// nsPop3IncomingServer
//
#define NS_POP3INCOMINGSERVER_CONTRACTID \
NS_MSGINCOMINGSERVER_CONTRACTID_PREFIX NS_POP3INCOMINGSERVER_TYPE
#define NS_POP3INCOMINGSERVER_CID \
{ /* D2876E51-E62C-11d2-B7FC-00805F05FFA5 */ \
0xd2876e51, 0xe62c, 0x11d2, \
{0xb7, 0xfc, 0x0, 0x80, 0x5f, 0x5, 0xff, 0xa5 }}
#ifdef HAVE_MOVEMAIL
//
// nsMovemailIncomingServer
//
#define NS_MOVEMAILINCOMINGSERVER_CONTRACTID \
NS_MSGINCOMINGSERVER_CONTRACTID_PREFIX "movemail"
#define NS_MOVEMAILINCOMINGSERVER_CID \
{ /* efbb77e4-1dd2-11b2-bbcf-961563396fec */ \
0xefbb77e4, 0x1dd2, 0x11b2, \
{0xbb, 0xcf, 0x96, 0x15, 0x63, 0x39, 0x6f, 0xec }}
#endif /* HAVE_MOVEMAIL */
//
// nsNoIncomingServer
//
#define NS_NOINCOMINGSERVER_CONTRACTID \
NS_MSGINCOMINGSERVER_CONTRACTID_PREFIX "none"
#define NS_NOINCOMINGSERVER_CID \
{ /* {ca5ffe7e-5f47-11d3-9a51-004005263078} */ \
0xca5ffe7e, 0x5f47, 0x11d3, \
{0x9a, 0x51, 0x00, 0x40, 0x05, 0x26, 0x30, 0x78}}
//
// nsMsgMailboxService
#define NS_MAILBOXSERVICE_CONTRACTID1 \
"@mozilla.org/messenger/mailboxservice;1"
#define NS_MAILBOXSERVICE_CONTRACTID2 \
"@mozilla.org/messenger/messageservice;1?type=mailbox"
#define NS_MAILBOXSERVICE_CONTRACTID3 \
"@mozilla.org/messenger/messageservice;1?type=mailbox_message"
#define NS_MAILBOXSERVICE_CONTRACTID4 \
NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "mailbox"
#define NS_MAILBOXSERVICE_CID \
{ /* EEF82462-CB69-11d2-8065-006008128C4E */ \
0xeef82462, 0xcb69, 0x11d2, \
{0x80, 0x65, 0x0, 0x60, 0x8, 0x12, 0x8c, 0x4e}}
//
// nsMailboxUrl
//
#define NS_MAILBOXURL_CONTRACTID \
"@mozilla.org/messenger/mailboxurl;1"
/* 46EFCB10-CB6D-11d2-8065-006008128C4E */
#define NS_MAILBOXURL_CID \
{ 0x46efcb10, 0xcb6d, 0x11d2, \
{ 0x80, 0x65, 0x0, 0x60, 0x8, 0x12, 0x8c, 0x4e } }
//
// nsPop3Url
//
#define NS_POP3URL_CONTRACTID \
"@mozilla.org/messenger/popurl;1"
/* EA1B0A11-E6F4-11d2-8070-006008128C4E */
#define NS_POP3URL_CID \
{ 0xea1b0a11, 0xe6f4, 0x11d2, \
{ 0x80, 0x70, 0x0, 0x60, 0x8, 0x12, 0x8c, 0x4e } }
//
// nsPop3Service
//
#define NS_POP3SERVICE_CONTRACTID1 \
"@mozilla.org/messenger/popservice;1"
#define NS_POP3SERVICE_CONTRACTID2 \
NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "pop"
#define NS_POP3PROTOCOLINFO_CONTRACTID \
NS_MSGPROTOCOLINFO_CONTRACTID_PREFIX NS_POP3INCOMINGSERVER_TYPE
#define NS_POP3SERVICE_CID \
{ /* 3BB459E3-D746-11d2-806A-006008128C4E */ \
0x3bb459e3, 0xd746, 0x11d2, \
{ 0x80, 0x6a, 0x0, 0x60, 0x8, 0x12, 0x8c, 0x4e }}
//
// nsNoneService
//
#define NS_NONESERVICE_CONTRACTID \
"@mozilla.org/messenger/noneservice;1"
#define NS_NONEPROTOCOLINFO_CONTRACTID \
NS_MSGPROTOCOLINFO_CONTRACTID_PREFIX "none"
#define NS_NONESERVICE_CID \
{ /* 75b63b46-1dd2-11b2-9873-bb375e1550fa */ \
0x75b63b46, 0x1dd2, 0x11b2, \
{ 0x98, 0x73, 0xbb, 0x37, 0x5e, 0x15, 0x50, 0xfa }}
#ifdef HAVE_MOVEMAIL
//
// nsMovemailService
//
#define NS_MOVEMAILSERVICE_CONTRACTID \
"@mozilla.org/messenger/movemailservice;1"
#define NS_MOVEMAILPROTOCOLINFO_CONTRACTID \
NS_MSGPROTOCOLINFO_CONTRACTID_PREFIX "movemail"
#define NS_MOVEMAILSERVICE_CID \
{ /* 0e4db62e-1dd2-11b2-a5e4-f128fe4f1b69 */ \
0x0e4db62e, 0x1dd2, 0x11b2, \
{ 0xa5, 0xe4, 0xf1, 0x28, 0xfe, 0x4f, 0x1b, 0x69 }}
#endif /* HAVE_MOVEMAIL */
//
// nsParseMailMsgState
//
#define NS_PARSEMAILMSGSTATE_CONTRACTID \
"@mozilla.org/messenger/messagestateparser;1"
#define NS_PARSEMAILMSGSTATE_CID \
{ /* 2B79AC51-1459-11d3-8097-006008128C4E */ \
0x2b79ac51, 0x1459, 0x11d3, \
{0x80, 0x97, 0x0, 0x60, 0x8, 0x12, 0x8c, 0x4e} }
//
// nsMsgMailboxParser
//
#define NS_MAILBOXPARSER_CONTRACTID \
"@mozilla.org/messenger/mailboxparser;1"
/* 46EFCB10-CB6D-11d2-8065-006008128C4E */
#define NS_MAILBOXPARSER_CID \
{ 0x8597ab60, 0xd4e2, 0x11d2, \
{ 0x80, 0x69, 0x0, 0x60, 0x8, 0x12, 0x8c, 0x4e } }
/* 15263446-D55E-11d3-98B1-001083010E9B */
#define NS_MSG_LOCALSTRINGSERVICE_CID \
{ 0x15263446, 0xd55e, 0x11d3, \
{ 0x98, 0xb1, 0x0, 0x10, 0x83, 0x1, 0xe, 0x9b } }
#define NS_MSG_MAILBOXSTRINGSERVICE_CONTRACTID \
NS_MAILNEWS_STRINGSERVICE_CONTRACTID_PREFIX "mailbox"
#define NS_MSG_POPSTRINGSERVICE_CONTRACTID \
NS_MAILNEWS_STRINGSERVICE_CONTRACTID_PREFIX NS_POP3INCOMINGSERVER_TYPE
#endif // nsMsgLocalCID_h__

Просмотреть файл

@ -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('#');

Просмотреть файл

@ -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);

Просмотреть файл

@ -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)

Просмотреть файл

@ -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)

Просмотреть файл

@ -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 \

Просмотреть файл

@ -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);

Просмотреть файл

@ -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:

Просмотреть файл

@ -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)

Просмотреть файл

@ -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

Просмотреть файл

@ -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);