From 8e3eb389aa1b68d64a04398b34168ac3ec5fdeed Mon Sep 17 00:00:00 2001 From: "alecf%netscape.com" Date: Wed, 28 Apr 1999 06:13:22 +0000 Subject: [PATCH] instead of getting the first server from the account manager, get the first one named news.mozilla.org (eventually we have to figure out our own hostname from the URI) --- mailnews/news/src/nsNewsUtils.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/mailnews/news/src/nsNewsUtils.cpp b/mailnews/news/src/nsNewsUtils.cpp index 233f1f55b10..d20ac4acbc3 100644 --- a/mailnews/news/src/nsNewsUtils.cpp +++ b/mailnews/news/src/nsNewsUtils.cpp @@ -40,13 +40,23 @@ nsGetNewsRoot(nsFileSpec &result) if (gNewsRoot == nsnull) { NS_WITH_SERVICE(nsIMsgMailSession, session, kMsgMailSessionCID, &rv); - + + nsCOMPtr accountManager; + rv = session->GetAccountManager(getter_AddRefs(accountManager)); + if (NS_SUCCEEDED(rv)) { - nsCOMPtr server; - rv = session->GetCurrentServer(getter_AddRefs(server)); + nsCOMPtr servers; + rv = accountManager->FindServersByHostname("news.mozilla.org", + nsINntpIncomingServer::GetIID(), + getter_AddRefs(servers)); - if (NS_SUCCEEDED(rv)) + if (NS_SUCCEEDED(rv) && servers->Count() > 0) { + nsCOMPtr server; + server = do_QueryInterface(servers->ElementAt(0)); + + if (server) rv = server->GetLocalPath(&gNewsRoot); + } } } /* if (gNewsRoot == nsnull) .. */ @@ -66,7 +76,7 @@ nsNewsURI2Path(const char* rootURI, const char* uriStr, nsFileSpec& pathResult) return NS_ERROR_FAILURE; if ((PL_strcmp(rootURI, kNewsRootURI) == 0) || - (PL_strcmp(rootURI, kNewsMessageRootURI) == 0)) { + (PL_strcmp(rootURI, kNewsMessageRootURI) == 0)) { rv = nsGetNewsRoot(pathResult); } else {