зеркало из https://github.com/mozilla/pjs.git
mail architecture cleanup (no bug - emptying my tree before next week's closure)
- get rid of GetAccountManager call (it's now a service) - move hacks GetCurrentIdentity and GetCurrentServer into the account manager for now - eliminate these calls from nsMsgMailSession - update all call sites (C++ and JS) r=mscott
This commit is contained in:
Родитель
f9865e541b
Коммит
8dfb58e0e1
|
@ -30,11 +30,10 @@
|
|||
#include "nsIAbCard.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsMsgBaseCID.h"
|
||||
#include "nsIMsgMailSession.h"
|
||||
#include "nsIMsgAccountManager.h"
|
||||
|
||||
static NS_DEFINE_CID(kHeaderParserCID, NS_MSGHEADERPARSER_CID);
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
static NS_DEFINE_CID(kCMsgMailSessionCID, NS_MSGMAILSESSION_CID);
|
||||
|
||||
nsresult NS_NewAbAutoCompleteSession(const nsIID &aIID, void ** aInstancePtrResult)
|
||||
{
|
||||
|
@ -62,11 +61,12 @@ nsAbAutoCompleteSession::nsAbAutoCompleteSession()
|
|||
|
||||
// temporary hack to get the current identity
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIMsgMailSession, mailSession, kCMsgMailSessionCID, &rv);
|
||||
NS_WITH_SERVICE(nsIMsgAccountManager, accountManager,
|
||||
NS_MSGACCOUNTMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr<nsIMsgIdentity> identity;
|
||||
rv = mailSession->GetCurrentIdentity(getter_AddRefs(identity));
|
||||
rv = accountManager->GetCurrentIdentity(getter_AddRefs(identity));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
char * email;
|
||||
|
|
|
@ -209,8 +209,7 @@ function onFinish() {
|
|||
function createAccount(hash) {
|
||||
|
||||
try {
|
||||
var mail = Components.classes["component://netscape/messenger/services/session"].getService(Components.interfaces.nsIMsgMailSession);
|
||||
var am = mail.accountManager;
|
||||
var am = Components.classes["component://netscape/messenger/account-manager"].getService(Components.interfaces.nsIMsgAccountManager);
|
||||
|
||||
|
||||
// workaround for lame-ass combo box bug
|
||||
|
|
|
@ -44,10 +44,6 @@ interface nsIMsgWindow;
|
|||
[scriptable, uuid(D5124440-D59E-11d2-806A-006008128C4E)]
|
||||
interface nsIMsgMailSession : nsISupports {
|
||||
|
||||
readonly attribute nsIMsgIdentity currentIdentity;
|
||||
readonly attribute nsIMsgIncomingServer currentServer;
|
||||
readonly attribute nsIMsgAccountManager accountManager;
|
||||
|
||||
attribute nsIMsgWindow temporaryMsgWindow;
|
||||
|
||||
void Shutdown();
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
var msgComposeService = Components.classes['component://netscape/messengercompose'].getService();
|
||||
msgComposeService = msgComposeService.QueryInterface(Components.interfaces.nsIMsgComposeService);
|
||||
var mailSession = Components.classes["component://netscape/messenger/services/session"].getService(Components.interfaces.nsIMsgMailSession);
|
||||
var accountManager = mailSession.accountManager;
|
||||
var accountManager = Components.classes["component://netscape/messenger/account-manager"].getService(Components.interfaces.nsIMsgAccountManager);
|
||||
|
||||
var RDF = Components.classes['component://netscape/rdf/rdf-service'].getService();
|
||||
RDF = RDF.QueryInterface(Components.interfaces.nsIRDFService);
|
||||
|
@ -196,9 +196,11 @@ function ChangeFolderByURI(uri, isThreaded, sortID)
|
|||
resource.QueryInterface(Components.interfaces.nsIMsgFolder);
|
||||
if (msgfolder.isServer)
|
||||
window.title = msgfolder.name;
|
||||
else
|
||||
else if (msgfolder.server)
|
||||
window.title = msgfolder.name + " on " +
|
||||
msgfolder.server.prettyName;
|
||||
else
|
||||
window.title = msgfolder.name;
|
||||
|
||||
gBeforeFolderLoadTime = new Date();
|
||||
|
||||
|
@ -214,6 +216,7 @@ function ChangeFolderByURI(uri, isThreaded, sortID)
|
|||
}
|
||||
catch(ex)
|
||||
{
|
||||
printf("Error loading with many headers to download\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -312,6 +315,7 @@ function SortColumn(node, sortKey)
|
|||
}
|
||||
catch(e)
|
||||
{
|
||||
dump("Sort failed: " + e + "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ var messengerProgID = "component://netscape/messenger";
|
|||
var statusFeedbackProgID = "component://netscape/messenger/statusfeedback";
|
||||
var messageViewProgID = "component://netscape/messenger/messageview";
|
||||
var mailSessionProgID = "component://netscape/messenger/services/session";
|
||||
var accountManagerProgID = "component://netscape/messenger/account-manager";
|
||||
var prefProgID = "component://netscape/preferences";
|
||||
var msgWindowProgID = "component://netscape/messenger/msgwindow";
|
||||
|
||||
|
@ -187,9 +188,8 @@ function saveWindowPosition()
|
|||
|
||||
function verifyAccounts() {
|
||||
try {
|
||||
var mail = Components.classes[mailSessionProgID].getService(Components.interfaces.nsIMsgMailSession);
|
||||
var am = Components.classes[accountManagerProgID].getService(Components.interfaces.nsIMsgAccountManager);
|
||||
|
||||
var am = mail.accountManager;
|
||||
var accounts = am.accounts;
|
||||
|
||||
// as long as we have some accounts, we're fine.
|
||||
|
|
|
@ -176,7 +176,7 @@ static nsresult ConvertDOMListToResourceArray(nsIDOMNodeList *nodeList, nsISuppo
|
|||
if(NS_FAILED(nodeList->Item(i, &node)))
|
||||
return rv;
|
||||
|
||||
if(NS_SUCCEEDED(rv = node->QueryInterface(nsCOMTypeInfo<nsIDOMXULElement>::GetIID(), (void**)&xulElement)))
|
||||
if(NS_SUCCEEDED(rv = node->QueryInterface(NS_GET_IID(nsIDOMXULElement), (void**)&xulElement)))
|
||||
{
|
||||
if(NS_SUCCEEDED(rv = xulElement->GetResource(&resource)) && resource)
|
||||
{
|
||||
|
@ -215,7 +215,7 @@ nsMessenger::~nsMessenger()
|
|||
//
|
||||
// nsISupports
|
||||
//
|
||||
NS_IMPL_ISUPPORTS(nsMessenger, nsCOMTypeInfo<nsIMessenger>::GetIID())
|
||||
NS_IMPL_ISUPPORTS(nsMessenger, NS_GET_IID(nsIMessenger))
|
||||
|
||||
//
|
||||
// nsIMsgAppCore
|
||||
|
@ -366,11 +366,13 @@ void nsMessenger::InitializeFolderRoot()
|
|||
nsresult rv;
|
||||
|
||||
// get the current identity from the mail session....
|
||||
NS_WITH_SERVICE(nsIMsgMailSession, mailSession, kCMsgMailSessionCID, &rv);
|
||||
NS_WITH_SERVICE(nsIMsgAccountManager, accountManager,
|
||||
NS_MSGACCOUNTMANAGER_PROGID, &rv)
|
||||
if (NS_FAILED(rv)) return;
|
||||
|
||||
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||
rv = mailSession->GetCurrentServer(getter_AddRefs(server));
|
||||
rv = accountManager->GetCurrentServer(getter_AddRefs(server));
|
||||
if (NS_FAILED(rv)) return;
|
||||
|
||||
nsCOMPtr<nsIFileSpec> folderRoot;
|
||||
if (NS_SUCCEEDED(rv) && server)
|
||||
|
@ -654,7 +656,7 @@ nsMessenger::SaveAs(const char* url, PRBool asFile, nsIMsgIdentity* identity)
|
|||
needDummyHeader =
|
||||
PL_strcasestr(aListener->m_templateUri, "mailbox") != nsnull;
|
||||
rv = aListener->QueryInterface(
|
||||
nsCOMTypeInfo<nsIUrlListener>::GetIID(),
|
||||
NS_GET_IID(nsIUrlListener),
|
||||
getter_AddRefs(urlListener));
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
|
@ -856,7 +858,7 @@ nsMessenger::GetRDFResourceForMessage(nsIDOMXULElement *tree,
|
|||
{
|
||||
rv = aEnumerator->CurrentItem(&aItem);
|
||||
if (rv != NS_OK) break;
|
||||
rv = aItem->QueryInterface(nsCOMTypeInfo<nsIMessage>::GetIID(), (void**)aSupport);
|
||||
rv = aItem->QueryInterface(NS_GET_IID(nsIMessage), (void**)aSupport);
|
||||
aItem->Release();
|
||||
if (rv == NS_OK && *aSupport) break;
|
||||
rv = aEnumerator->Next();
|
||||
|
@ -1280,7 +1282,7 @@ public:
|
|||
NS_IMETHOD OnStopSending(nsresult aStatus, const PRUnichar *aMsg, PRUint32 aTotalTried, PRUint32 aSuccessful);
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS(SendLaterListener, nsCOMTypeInfo<nsIMsgSendLaterListener>::GetIID());
|
||||
NS_IMPL_ISUPPORTS(SendLaterListener, NS_GET_IID(nsIMsgSendLaterListener));
|
||||
|
||||
SendLaterListener::SendLaterListener()
|
||||
{
|
||||
|
@ -1327,7 +1329,7 @@ nsMessenger::SendUnsentMessages()
|
|||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIMsgSendLater> pMsgSendLater;
|
||||
rv = nsComponentManager::CreateInstance(kMsgSendLaterCID, NULL,nsCOMTypeInfo<nsIMsgSendLater>::GetIID(),
|
||||
rv = nsComponentManager::CreateInstance(kMsgSendLaterCID, NULL,NS_GET_IID(nsIMsgSendLater),
|
||||
(void **)getter_AddRefs(pMsgSendLater));
|
||||
if (NS_SUCCEEDED(rv) && pMsgSendLater)
|
||||
{
|
||||
|
@ -1343,11 +1345,12 @@ nsMessenger::SendUnsentMessages()
|
|||
pMsgSendLater->AddListener(sendLaterListener);
|
||||
|
||||
// temporary hack to get the current identity
|
||||
NS_WITH_SERVICE(nsIMsgMailSession, mailSession, kCMsgMailSessionCID, &rv);
|
||||
NS_WITH_SERVICE(nsIMsgAccountManager, accountManager,
|
||||
NS_MSGACCOUNTMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
||||
nsCOMPtr<nsIMsgIdentity> identity;
|
||||
rv = mailSession->GetCurrentIdentity(getter_AddRefs(identity));
|
||||
rv = accountManager->GetCurrentIdentity(getter_AddRefs(identity));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
pMsgSendLater->SendUnsentMessages(identity, nsnull);
|
||||
|
@ -1362,7 +1365,7 @@ nsMessenger::LoadFirstDraft()
|
|||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIMsgDraft> pMsgDraft;
|
||||
|
||||
rv = nsComponentManager::CreateInstance(kMsgDraftCID, NULL, nsCOMTypeInfo<nsIMsgDraft>::GetIID(),
|
||||
rv = nsComponentManager::CreateInstance(kMsgDraftCID, NULL, NS_GET_IID(nsIMsgDraft),
|
||||
(void **)getter_AddRefs(pMsgDraft));
|
||||
if (NS_SUCCEEDED(rv) && pMsgDraft)
|
||||
{
|
||||
|
|
|
@ -79,7 +79,7 @@ nsMsgAccount::getPrefService() {
|
|||
if (m_prefs) return NS_OK;
|
||||
|
||||
return nsServiceManager::GetService(kPrefServiceCID,
|
||||
nsCOMTypeInfo<nsIPref>::GetIID(),
|
||||
NS_GET_IID(nsIPref),
|
||||
(nsISupports**)&m_prefs);
|
||||
}
|
||||
|
||||
|
@ -150,15 +150,12 @@ nsMsgAccount::createIncomingServer()
|
|||
#endif
|
||||
|
||||
// get the server from the account manager
|
||||
NS_WITH_SERVICE(nsIMsgMailSession,session, NS_MSGMAILSESSION_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIMsgAccountManager> am;
|
||||
rv = session->GetAccountManager(getter_AddRefs(am));
|
||||
NS_WITH_SERVICE(nsIMsgAccountManager, accountManager,
|
||||
NS_MSGACCOUNTMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||
rv = am->GetIncomingServer(serverKey, getter_AddRefs(server));
|
||||
rv = accountManager->GetIncomingServer(serverKey, getter_AddRefs(server));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
#ifdef DEBUG_alecf
|
||||
|
@ -238,16 +235,14 @@ nsMsgAccount::createIdentities()
|
|||
#endif
|
||||
|
||||
// get the server from the account manager
|
||||
NS_WITH_SERVICE(nsIMsgMailSession,session, NS_MSGMAILSESSION_PROGID, &rv);
|
||||
NS_WITH_SERVICE(nsIMsgAccountManager, accountManager,
|
||||
NS_MSGACCOUNTMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIMsgAccountManager> am;
|
||||
rv = session->GetAccountManager(getter_AddRefs(am));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// XXX todo: iterate through identities. for now, assume just one
|
||||
nsCOMPtr<nsIMsgIdentity> identity;
|
||||
rv = am->GetIdentity(identityKey, getter_AddRefs(identity));
|
||||
rv = accountManager->GetIdentity(identityKey, getter_AddRefs(identity));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = AddIdentity(identity);
|
||||
|
|
|
@ -144,12 +144,7 @@ nsMsgAccountManagerDataSource::Init()
|
|||
nsresult rv=NS_OK;
|
||||
|
||||
if (!mAccountManager) {
|
||||
NS_WITH_SERVICE(nsIMsgMailSession, mailSession,
|
||||
kMsgMailSessionCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// maybe the account manager should be a service too? not sure.
|
||||
rv = mailSession->GetAccountManager(getter_AddRefs(mAccountManager));
|
||||
mAccountManager = do_GetService(NS_MSGACCOUNTMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,22 +21,17 @@
|
|||
*/
|
||||
|
||||
#include "msgCore.h" // for pre-compiled headers
|
||||
//#include "nsIMsgIdentity.h"
|
||||
#include "nsIMsgAccountManager.h"
|
||||
//#include "nsIPop3IncomingServer.h"
|
||||
#include "nsMsgMailSession.h"
|
||||
#include "nsMsgLocalCID.h"
|
||||
#include "nsMsgBaseCID.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsMsgFolderCache.h"
|
||||
#include "nsIFileLocator.h"
|
||||
#include "nsFileLocations.h"
|
||||
#include "nsIMsgStatusFeedback.h"
|
||||
#include "nsIMsgWindow.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsMsgMailSession, nsCOMTypeInfo<nsIMsgMailSession>::GetIID());
|
||||
NS_IMPL_ISUPPORTS1(nsMsgMailSession, nsIMsgMailSession);
|
||||
|
||||
static NS_DEFINE_CID(kMsgAccountManagerCID, NS_MSGACCOUNTMANAGER_CID);
|
||||
static NS_DEFINE_IID(kIFileLocatorIID, NS_IFILELOCATOR_IID);
|
||||
static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID);
|
||||
|
||||
|
@ -70,59 +65,6 @@ nsresult nsMsgMailSession::Shutdown()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIMsgMailSession
|
||||
nsresult nsMsgMailSession::GetCurrentIdentity(nsIMsgIdentity ** aIdentity)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIMsgAccountManager> accountManager;
|
||||
rv = GetAccountManager(getter_AddRefs(accountManager));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIMsgAccount> defaultAccount;
|
||||
rv = accountManager->GetDefaultAccount(getter_AddRefs(defaultAccount));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = defaultAccount->GetDefaultIdentity(aIdentity);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
NS_ADDREF(*aIdentity);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsMsgMailSession::GetCurrentServer(nsIMsgIncomingServer ** aServer)
|
||||
{
|
||||
nsresult rv=NS_ERROR_UNEXPECTED;
|
||||
|
||||
nsCOMPtr<nsIMsgAccountManager> accountManager;
|
||||
rv = GetAccountManager(getter_AddRefs(accountManager));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIMsgAccount> defaultAccount;
|
||||
rv = accountManager->GetDefaultAccount(getter_AddRefs(defaultAccount));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
//if successful aServer will be addref'd by GetIncomingServer
|
||||
rv = defaultAccount->GetIncomingServer(aServer);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsMsgMailSession::GetAccountManager(nsIMsgAccountManager* *aAM)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAM);
|
||||
|
||||
nsresult rv;
|
||||
|
||||
NS_WITH_SERVICE(nsIMsgAccountManager, accountManager, kMsgAccountManagerCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
accountManager->LoadAccounts();
|
||||
|
||||
*aAM = accountManager;
|
||||
NS_IF_ADDREF(*aAM);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsMsgMailSession::GetTemporaryMsgWindow(nsIMsgWindow* *aMsgWindow)
|
||||
{
|
||||
if (!aMsgWindow) return NS_ERROR_NULL_POINTER;
|
||||
|
|
|
@ -18,8 +18,9 @@
|
|||
* Rights Reserved.
|
||||
*/
|
||||
|
||||
var mailSessionProgID = "component://netscape/messenger/services/session";
|
||||
var msgService = Components.classes[mailSessionProgID].getService(Components.interfaces.nsIMsgMailSession);
|
||||
var accountManagerProgID = "component://netscape/messenger/account-manager";
|
||||
var accountManager = Components.classes[accountManagerProgID].getService(Components.interfaces.nsIMsgAccountManager);
|
||||
|
||||
var msgComposeService = Components.classes["component://netscape/messengercompose"].getService();
|
||||
msgComposeService = msgComposeService.QueryInterface(Components.interfaces.nsIMsgComposeService);
|
||||
var msgCompose = null;
|
||||
|
@ -143,7 +144,7 @@ function ComposeStartup()
|
|||
{
|
||||
//TODO: what I need here is not the current selected identity but the default one.
|
||||
// For now GetCurrentIdentity gives back the first identity (not the selected one).
|
||||
identity = msgService.currentIdentity;
|
||||
identity = accountManager.currentIdentity;
|
||||
}
|
||||
identitySelect.value = identity.key;
|
||||
|
||||
|
@ -260,7 +261,6 @@ function MsgAccountWizard()
|
|||
|
||||
function MigratePrefsIfNecessary()
|
||||
{
|
||||
var accountManager = msgService.accountManager;
|
||||
var accounts = accountManager.accounts;
|
||||
|
||||
// as long as we have some accounts, we're fine.
|
||||
|
@ -530,7 +530,6 @@ function queryISupportsArray(supportsArray, iid) {
|
|||
|
||||
function GetIdentities()
|
||||
{
|
||||
var accountManager = msgService.accountManager;
|
||||
|
||||
var idSupports = accountManager.allIdentities;
|
||||
var identities = queryISupportsArray(idSupports,
|
||||
|
@ -558,8 +557,6 @@ function fillIdentitySelect(selectElement)
|
|||
|
||||
function getCurrentIdentity()
|
||||
{
|
||||
var accountManager = msgService.accountManager;
|
||||
|
||||
// fill in Identity combobox
|
||||
var identitySelect = document.getElementById("msgIdentity");
|
||||
var identityKey = identitySelect.value;
|
||||
|
@ -571,8 +568,6 @@ function getCurrentIdentity()
|
|||
|
||||
function getIdentityForKey(key)
|
||||
{
|
||||
var accountManager = msgService.accountManager;
|
||||
|
||||
return accountManager.getIdentity(key);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "nsIPref.h"
|
||||
#include "nsIMsgCopyService.h"
|
||||
#include "nsMsgBaseCID.h"
|
||||
#include "nsIMsgMailSession.h"
|
||||
#include "nsMsgFolderFlags.h"
|
||||
#include "nsIMsgFolder.h"
|
||||
#include "nsIMsgAccountManager.h"
|
||||
|
@ -42,7 +41,6 @@
|
|||
|
||||
static NS_DEFINE_CID(kStandardUrlCID, NS_STANDARDURL_CID);
|
||||
static NS_DEFINE_CID(kMsgCopyServiceCID,NS_MSGCOPYSERVICE_CID);
|
||||
static NS_DEFINE_CID(kCMsgMailSessionCID, NS_MSGMAILSESSION_CID);
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -291,12 +289,9 @@ LocateMessageFolder(nsIMsgIdentity *userIdentity,
|
|||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
// get the current mail session....
|
||||
NS_WITH_SERVICE(nsIMsgMailSession, mailSession, kCMsgMailSessionCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIMsgAccountManager> accountManager;
|
||||
rv = mailSession->GetAccountManager(getter_AddRefs(accountManager));
|
||||
// get the account manager
|
||||
NS_WITH_SERVICE(nsIMsgAccountManager, accountManager,
|
||||
NS_MSGACCOUNTMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// as long as it doesn't start with anyfolder://
|
||||
|
|
|
@ -269,12 +269,13 @@ HackUpAURIToPlayWith(void)
|
|||
nsresult rv = NS_OK;
|
||||
|
||||
// temporary hack to get the current identity
|
||||
NS_WITH_SERVICE(nsIMsgMailSession, mailSession, kCMsgMailSessionCID, &rv);
|
||||
NS_WITH_SERVICE(nsIMsgAccountManager, accountManager,
|
||||
NS_MSGACCOUNTMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIMsgIdentity> identity = nsnull;
|
||||
rv = mailSession->GetCurrentIdentity(getter_AddRefs(identity));
|
||||
rv = accountManager->GetCurrentIdentity(getter_AddRefs(identity));
|
||||
if (NS_FAILED(rv))
|
||||
return nsnull;
|
||||
|
||||
|
|
|
@ -42,12 +42,8 @@ nsGetImapServer(const char* username, const char* hostname,
|
|||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NS_WITH_SERVICE(nsIMsgMailSession, session, kMsgMailSessionCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
||||
nsCOMPtr<nsIMsgAccountManager> accountManager;
|
||||
rv = session->GetAccountManager(getter_AddRefs(accountManager));
|
||||
NS_WITH_SERVICE(nsIMsgAccountManager, accountManager,
|
||||
NS_MSGACCOUNTMANAGER_PROGID, &rv);
|
||||
if(NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||
|
|
|
@ -50,10 +50,8 @@ nsGetMailboxServer(const char *username, const char *hostname, nsIMsgIncomingSer
|
|||
nsUnescape(NS_CONST_CAST(char*,username));
|
||||
nsUnescape(NS_CONST_CAST(char*,hostname));
|
||||
// retrieve the AccountManager
|
||||
NS_WITH_SERVICE(nsIMsgMailSession, session, kMsgMailSessionCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr<nsIMsgAccountManager> accountManager;
|
||||
rv = session->GetAccountManager(getter_AddRefs(accountManager));
|
||||
NS_WITH_SERVICE(nsIMsgAccountManager, accountManager,
|
||||
NS_MSGACCOUNTMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// find all local mail "no servers" matching the given hostname
|
||||
|
|
|
@ -47,11 +47,9 @@ static NS_DEFINE_CID(kCMailDB, NS_MAILDB_CID);
|
|||
// this is totally lame and MUST be removed by M6
|
||||
// the real fix is to attach the URI to the URL as it runs through netlib
|
||||
// then grab it and use it on the other side
|
||||
#include "nsIMsgMailSession.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsMsgBaseCID.h"
|
||||
|
||||
static NS_DEFINE_CID(kMsgMailSessionCID, NS_MSGMAILSESSION_CID);
|
||||
#include "nsIMsgAccountManager.h"
|
||||
|
||||
static char *nsMailboxGetURI(const char *nativepath)
|
||||
{
|
||||
|
@ -59,11 +57,8 @@ static char *nsMailboxGetURI(const char *nativepath)
|
|||
nsresult rv;
|
||||
char *uri = nsnull;
|
||||
|
||||
NS_WITH_SERVICE(nsIMsgMailSession, session, kMsgMailSessionCID, &rv);
|
||||
if (NS_FAILED(rv)) return nsnull;
|
||||
|
||||
nsCOMPtr<nsIMsgAccountManager> accountManager;
|
||||
rv = session->GetAccountManager(getter_AddRefs(accountManager));
|
||||
NS_WITH_SERVICE(nsIMsgAccountManager, accountManager,
|
||||
NS_MSGACCOUNTMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) return nsnull;
|
||||
|
||||
nsCOMPtr<nsISupportsArray> serverArray;
|
||||
|
|
|
@ -463,12 +463,10 @@ nsresult nsNNTPProtocol::Initialize(void)
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// retrieve the AccountManager
|
||||
NS_WITH_SERVICE(nsIMsgMailSession, session, kCMsgMailSessionCID, &rv);
|
||||
NS_WITH_SERVICE(nsIMsgAccountManager, accountManager,
|
||||
NS_MSGACCOUNTMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr<nsIMsgAccountManager> accountManager;
|
||||
rv = session->GetAccountManager(getter_AddRefs(accountManager));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
||||
// find the news host
|
||||
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||
rv = accountManager->FindServer(m_userName,
|
||||
|
|
|
@ -25,8 +25,7 @@
|
|||
#include "nsIServiceManager.h"
|
||||
#include "prsystem.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
#include "nsIMsgMailSession.h"
|
||||
#include "nsIMsgAccountManager.h"
|
||||
#include "nsIMsgIncomingServer.h"
|
||||
#include "nsINntpIncomingServer.h"
|
||||
#include "nsMsgBaseCID.h"
|
||||
|
@ -36,8 +35,6 @@
|
|||
#define DEBUG_NEWS 1
|
||||
#endif
|
||||
|
||||
static NS_DEFINE_CID(kMsgMailSessionCID, NS_MSGMAILSESSION_CID);
|
||||
|
||||
static nsresult
|
||||
nsGetNewsServer(const char* username, const char *hostname,
|
||||
nsIMsgIncomingServer** aResult)
|
||||
|
@ -48,11 +45,9 @@ nsGetNewsServer(const char* username, const char *hostname,
|
|||
nsresult rv = NS_OK;
|
||||
|
||||
// retrieve the AccountManager
|
||||
NS_WITH_SERVICE(nsIMsgMailSession, session, kMsgMailSessionCID, &rv);
|
||||
NS_WITH_SERVICE(nsIMsgAccountManager, accountManager,
|
||||
NS_MSGACCOUNTMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr<nsIMsgAccountManager> accountManager;
|
||||
rv = session->GetAccountManager(getter_AddRefs(accountManager));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// find the news host
|
||||
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||
|
|
Загрузка…
Ссылка в новой задаче