fix for #49157. support nntp://host/message-id urls (we already support

news://host/message-id urls).  r/sr=bienvenu
This commit is contained in:
sspitzer%netscape.com 2001-10-09 06:01:16 +00:00
Родитель 55db9535c4
Коммит 05b8b2645d
4 изменённых файлов: 19 добавлений и 3 удалений

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

@ -69,7 +69,6 @@
// nsNntpService
//
// not needed? who does nntp:/ ?
#define NS_NNTPPROTOCOLINFO_CONTRACTID \
NS_MSGPROTOCOLINFO_CONTRACTID_PREFIX "nntp"
@ -77,6 +76,8 @@
NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "news"
#define NS_SNEWSPROTOCOLHANDLER_CONTRACTID \
NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "snews"
#define NS_NNTPPROTOCOLHANDLER_CONTRACTID \
NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "nntp"
#define NS_NEWSMESSAGEPROTOCOLHANDLER_CONTRACTID \
NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "news_message"
#define NS_NEWSMESSAGESERVICE_CONTRACTID \

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

@ -110,6 +110,10 @@ static nsModuleComponentInfo components[] =
NS_NNTPSERVICE_CID,
NS_SNEWSPROTOCOLHANDLER_CONTRACTID,
nsNntpServiceConstructor },
{ "NNTP Protocol Handler",
NS_NNTPSERVICE_CID,
NS_NNTPPROTOCOLHANDLER_CONTRACTID,
nsNntpServiceConstructor },
{ "newsgroup content handler",
NS_NNTPSERVICE_CID,
NS_CONTENT_HANDLER_CONTRACTID_PREFIX"x-application-newsgroup",

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

@ -42,10 +42,12 @@
class nsIMsgNewsFolder;
static const char kNntpRootURI[] = "nntp:/";
static const char kNewsRootURI[] = "news:/";
static const char kNewsMessageRootURI[] = "news_message:/";
#define kNewsRootURILen 6
#define kNntpRootURILen 6
#define kNewsMessageRootURILen 14
extern nsresult

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

@ -523,9 +523,18 @@ nsNntpService::GetFolderFromUri(const char *uri, nsIMsgFolder **folder)
nsCOMPtr <nsIRDFService> rdf = do_GetService("@mozilla.org/rdf/rdf-service;1",&rv);
NS_ENSURE_SUCCESS(rv,rv);
// the user might have typed in or clicked on a nntp:// url
// to support this, we turn it into a news:// url
nsCOMPtr<nsIRDFResource> res;
rv = rdf->GetResource(uri, getter_AddRefs(res));
if ((nsCRT::strlen(uri) > kNntpRootURILen) && nsCRT::strncmp(uri, kNntpRootURI, kNntpRootURILen) == 0) {
nsCAutoString uriStr(kNewsRootURI);
uriStr.Append(uri+kNntpRootURILen);
rv = rdf->GetResource(uriStr.get(), getter_AddRefs(res));
}
else {
rv = rdf->GetResource(uri, getter_AddRefs(res));
}
NS_ENSURE_SUCCESS(rv,rv);
rv = res->QueryInterface(NS_GET_IID(nsIMsgFolder), (void **)folder);