(not part of the build yet) a=cyeh.

Replace identity stuff with nsIMsgIncomingServer.
This commit is contained in:
mscott%netscape.com 1999-04-08 02:54:20 +00:00
parent 6fa3c842f8
commit d939c01e95
2 changed files with 23 additions and 23 deletions

View File

@ -46,7 +46,7 @@ nsImapUrl::nsImapUrl()
NS_INIT_REFCNT(); NS_INIT_REFCNT();
m_errorMessage = nsnull; m_errorMessage = nsnull;
m_identity = nsnull; m_server = nsnull;
// nsINetLibUrl specific state // nsINetLibUrl specific state
m_URL_s = nsnull; m_URL_s = nsnull;
@ -77,7 +77,7 @@ nsImapUrl::~nsImapUrl()
NS_IF_RELEASE(m_imapMessage); NS_IF_RELEASE(m_imapMessage);
NS_IF_RELEASE(m_imapExtension); NS_IF_RELEASE(m_imapExtension);
NS_IF_RELEASE(m_imapMiscellaneous); NS_IF_RELEASE(m_imapMiscellaneous);
NS_IF_RELEASE(m_identity); NS_IF_RELEASE(m_server);
NS_IF_RELEASE(m_urlListeners); NS_IF_RELEASE(m_urlListeners);
PR_FREEIF(m_errorMessage); PR_FREEIF(m_errorMessage);
@ -139,48 +139,48 @@ NS_IMETHODIMP nsImapUrl::QueryInterface(const nsIID &aIID, void** aInstancePtr)
// Begin nsIImapUrl specific support // Begin nsIImapUrl specific support
//////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////
NS_IMETHODIMP nsImapUrl::SetIdentity(nsIMsgIdentity * aMsgIdentity) NS_IMETHODIMP nsImapUrl::SetServer(nsIMsgIncomingServer * aServer)
{ {
if (aMsgIdentity) if (aServer)
{ {
NS_IF_RELEASE(m_identity); NS_IF_RELEASE(m_server);
m_identity = aMsgIdentity; m_server = aServer;
NS_ADDREF(m_identity); NS_ADDREF(m_server);
return NS_OK; return NS_OK;
} }
else else
return NS_ERROR_NULL_POINTER; return NS_ERROR_NULL_POINTER;
} }
NS_IMETHODIMP nsImapUrl::GetIdentity(nsIMsgIdentity **aMsgIdentity) NS_IMETHODIMP nsImapUrl::GetServer(nsIMsgIncomingServer **aServer)
{ {
nsresult rv = NS_OK; nsresult rv = NS_OK;
if (aMsgIdentity) // valid argument to return result in? if (aServer) // valid argument to return result in?
{ {
// if we weren't given an identity, let's be creative and go fetch the default current // if we weren't given an server, let's be creative and go fetch the default current
// identity. // server.
if (!m_identity) if (!m_server)
{ {
nsIMsgMailSession * session = nsnull; nsIMsgMailSession * session = nsnull;
rv = nsServiceManager::GetService(kMsgMailSessionCID, nsIMsgMailSession::GetIID(), rv = nsServiceManager::GetService(kMsgMailSessionCID, nsIMsgMailSession::GetIID(),
(nsISupports **) &session); (nsISupports **) &session);
if (NS_SUCCEEDED(rv) && session) if (NS_SUCCEEDED(rv) && session)
{ {
// store the identity in m_identity so we don't have to do this again. // store the server in m_server so we don't have to do this again.
rv = session->GetCurrentIdentity(&m_identity); rv = session->GetCurrentServer(&m_server);
nsServiceManager::ReleaseService(kMsgMailSessionCID, session); nsServiceManager::ReleaseService(kMsgMailSessionCID, session);
} }
} }
// if we were given an identity then use it. // if we were given a server then use it.
if (m_identity) if (m_server)
{ {
*aMsgIdentity = m_identity; *aServer = m_server;
NS_ADDREF(m_identity); NS_ADDREF(m_server);
} }
else else
*aMsgIdentity = nsnull; *aServer = nsnull;
} // if aMsgIdentity } // if aMsgIdentity
return rv; return rv;

View File

@ -22,7 +22,7 @@
#include "nsIImapUrl.h" #include "nsIImapUrl.h"
#include "nsIUrlListenerManager.h" #include "nsIUrlListenerManager.h"
#include "nsINetlibURL.h" /* this should be temporary until nunet project lands */ #include "nsINetlibURL.h" /* this should be temporary until nunet project lands */
#include "nsIMsgIdentity.h" #include "nsIMsgIncomingServer.h"
class nsImapUrl : public nsIImapUrl, public nsINetlibURL class nsImapUrl : public nsIImapUrl, public nsINetlibURL
{ {
@ -44,8 +44,8 @@ public:
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// we support the nsIImapUrl interface // we support the nsIImapUrl interface
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
NS_IMETHOD SetIdentity(nsIMsgIdentity * aMsgIdentity); NS_IMETHOD SetServer(nsIMsgIncomingServer * aServer);
NS_IMETHOD GetIdentity(nsIMsgIdentity ** aMsgIdentity); NS_IMETHOD GetServer(nsIMsgIncomingServer ** aServer);
NS_IMETHOD GetImapLog(nsIImapLog ** aImapLog); NS_IMETHOD GetImapLog(nsIImapLog ** aImapLog);
NS_IMETHOD SetImapLog(nsIImapLog * aImapLog); NS_IMETHOD SetImapLog(nsIImapLog * aImapLog);
@ -135,7 +135,7 @@ protected:
nsIImapExtension* m_imapExtension; nsIImapExtension* m_imapExtension;
nsIImapMiscellaneous* m_imapMiscellaneous; nsIImapMiscellaneous* m_imapMiscellaneous;
nsIMsgIdentity *m_identity; nsIMsgIncomingServer *m_server;
}; };
#endif /* nsImapUrl_h___ */ #endif /* nsImapUrl_h___ */