зеркало из https://github.com/mozilla/pjs.git
switch to using new GetLocalPath call and nsCOMPtr
This commit is contained in:
Родитель
b8b0d1a092
Коммит
8a44f192c0
|
@ -20,6 +20,7 @@
|
|||
#include "nsNewsUtils.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "prsystem.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
// stuff for temporary root folder hack
|
||||
#include "nsIMsgMailSession.h"
|
||||
|
@ -38,31 +39,17 @@ nsGetNewsRoot(nsFileSpec &result)
|
|||
nsresult rv = NS_OK;
|
||||
|
||||
if (gNewsRoot == nsnull) {
|
||||
nsIMsgMailSession *session;
|
||||
rv = nsServiceManager::GetService(kMsgMailSessionCID,
|
||||
nsIMsgMailSession::GetIID(),
|
||||
(nsISupports **)&session);
|
||||
NS_WITH_SERVICE(nsIMsgMailSession, session, kMsgMailSessionCID, &rv);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIMsgIncomingServer *server;
|
||||
rv = session->GetCurrentServer(&server);
|
||||
if (NS_FAILED(rv)) printf("nsGetNewsRoot: Couldn't get current server\n");
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsINntpIncomingServer *nntpServer;
|
||||
rv = server->QueryInterface(nsINntpIncomingServer::GetIID(),
|
||||
(void **)&nntpServer);
|
||||
if (NS_FAILED(rv)) printf("nsGetNewsRoot: Couldn't get nntp server\n");
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = nntpServer->GetRootFolderPath(&gNewsRoot);
|
||||
if (NS_FAILED(rv)) printf("nsGetNewsRoot: Couldn't get root\n");
|
||||
NS_RELEASE(nntpServer);
|
||||
}
|
||||
NS_RELEASE(server);
|
||||
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||
rv = session->GetCurrentServer(getter_AddRefs(server));
|
||||
|
||||
}
|
||||
nsServiceManager::ReleaseService(kMsgMailSessionCID, session);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = server->GetLocalPath(&gNewsRoot);
|
||||
}
|
||||
} /* if (gNewsRoot == nsnull) .. */
|
||||
|
||||
result = gNewsRoot;
|
||||
return rv;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче