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

View File

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