getting imap root folder directory from prefs instead of hard coded string

git-svn-id: svn://10.0.0.236/trunk@28828 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
jefft%netscape.com
1999-04-23 13:55:53 +00:00
parent 177ba59ee8
commit 1006885608

View File

@@ -36,6 +36,7 @@
#include "nsIMsgIncomingServer.h"
#include "nsIPop3IncomingServer.h"
#include "nsINntpIncomingServer.h"
#include "nsIImapIncomingServer.h"
static NS_DEFINE_CID(kMsgMailSessionCID, NS_MSGMAILSESSION_CID);
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
@@ -1483,7 +1484,7 @@ nsresult nsMsgFolder::NotifyItemDeleted(nsISupports *item)
static char *gMailboxRoot = nsnull;
static char *gNewsRoot = nsnull;
static const char *gImapRoot = nsnull;
static char *gImapRoot = nsnull;
nsresult
nsGetNewsRoot(nsFileSpec &result)
@@ -1528,7 +1529,30 @@ nsGetImapRoot(nsFileSpec &result)
// temporary stuff. for now - should get everything from the mail session
if (gImapRoot == nsnull) {
gImapRoot = PL_strdup("/tmp");
nsIMsgMailSession *session;
rv = nsServiceManager::GetService(kMsgMailSessionCID,
nsIMsgMailSession::GetIID(),
(nsISupports **)&session);
if (NS_SUCCEEDED(rv)) {
nsIMsgIncomingServer *server;
rv = session->GetCurrentServer(&server);
if (NS_FAILED(rv)) printf("nsGetImapRoot: Couldn't get current server\n");
if (NS_SUCCEEDED(rv)) {
nsIImapIncomingServer *imapServer;
rv = server->QueryInterface(nsIImapIncomingServer::GetIID(),
(void **)&imapServer);
if (NS_FAILED(rv)) printf("nsGetImapRoot: Couldn't get imap server\n");
if (NS_SUCCEEDED(rv)) {
rv = imapServer->GetRootFolderPath(&gImapRoot);
if (NS_FAILED(rv)) printf("nsGetImapRoot: Couldn't get root\n");
NS_RELEASE(imapServer);
}
NS_RELEASE(server);
}
nsServiceManager::ReleaseService(kMsgMailSessionCID, session);
}
}
result = gImapRoot;
return rv;