rv = imapServer->GetRootFolderPath(&gImapRoot); if (NS_FAILED(rv)) printf("nsGetImapRoot: Couldn't get root\n"); NS_RELEASE(imapServer);
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);
nsGetImapRoot(nsFileSpec &result){  nsresult rv = NS_OK;         // temporary stuff. for now - should get everything from the mail session  if (gImapRoot == nsnull) {    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;      }