Changes to reflect the fact that GetServer is a method on nsIMsgMailNewsUrl now.

This commit is contained in:
mscott%netscape.com 1999-08-10 18:18:41 +00:00
Родитель 7eaad2995e
Коммит 14f702cb04
1 изменённых файлов: 25 добавлений и 25 удалений

Просмотреть файл

@ -30,6 +30,7 @@
#include "nsImapCore.h" #include "nsImapCore.h"
#include "nsImapProtocol.h" #include "nsImapProtocol.h"
#include "nsIMsgMailNewsUrl.h"
#include "nscore.h" #include "nscore.h"
#include "nsImapProxyEvent.h" #include "nsImapProxyEvent.h"
#include "nsIMAPHostSessionList.h" #include "nsIMAPHostSessionList.h"
@ -43,7 +44,7 @@
#include "nsXPIDLString.h" #include "nsXPIDLString.h"
#include "nsImapStringBundle.h" #include "nsImapStringBundle.h"
#include "nsCOMPtr.h"
PRLogModuleInfo *IMAP; PRLogModuleInfo *IMAP;
// netlib required files // netlib required files
@ -447,7 +448,10 @@ nsresult nsImapProtocol::SetupWithUrl(nsIURI * aURL, nsISupports* aConsumer)
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
if (!m_server) if (!m_server)
rv = m_runningUrl->GetServer(getter_AddRefs(m_server)); {
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsUrl = do_QueryInterface(m_runningUrl);
rv = mailnewsUrl->GetServer(getter_AddRefs(m_server));
}
if ( m_runningUrl && !m_channel /* and we don't have a transport yet */) if ( m_runningUrl && !m_channel /* and we don't have a transport yet */)
{ {
@ -493,6 +497,7 @@ void nsImapProtocol::ReleaseUrlState()
void nsImapProtocol::ImapThreadMain(void *aParm) void nsImapProtocol::ImapThreadMain(void *aParm)
{ {
nsImapProtocol *me = (nsImapProtocol *) aParm; nsImapProtocol *me = (nsImapProtocol *) aParm;
nsresult result = NS_OK;
NS_ASSERTION(me, "Yuk, me is null.\n"); NS_ASSERTION(me, "Yuk, me is null.\n");
PR_CEnterMonitor(aParm); PR_CEnterMonitor(aParm);
@ -504,22 +509,16 @@ void nsImapProtocol::ImapThreadMain(void *aParm)
return; return;
} }
// Wrap the PLQueue we're going to make in an nsIEventQueue
nsresult result = NS_OK;
NS_WITH_SERVICE(nsIEventQueueService, pEventQService, kEventQueueServiceCID, &result); NS_WITH_SERVICE(nsIEventQueueService, pEventQService, kEventQueueServiceCID, &result);
if (NS_FAILED(result))
return;
PLEventQueue* aPLQueue = PL_CreateEventQueue("ImapProtocolThread", result = pEventQService->CreateThreadEventQueue();
PR_GetCurrentThread());
pEventQService->GetThreadEventQueue(PR_GetCurrentThread(),getter_AddRefs(me->m_eventQueue));
if (NS_FAILED(result = pEventQService->CreateFromPLEventQueue(aPLQueue, getter_AddRefs(me->m_eventQueue))))
return;
NS_ASSERTION(me->m_eventQueue, NS_ASSERTION(me->m_eventQueue,
"Unable to create imap thread event queue.\n"); "Unable to create imap thread event queue.\n");
if (!me->m_eventQueue) if (NS_FAILED(result) || !me->m_eventQueue)
{ {
PR_CExitMonitor(me); PR_CExitMonitor(me);
return; return;
@ -806,6 +805,13 @@ void nsImapProtocol::ProcessCurrentURL()
{ {
PRBool logonFailed = FALSE; PRBool logonFailed = FALSE;
if (!TestFlag(IMAP_CONNECTION_IS_OPEN))
{
nsCOMPtr<nsISupports> sprts = do_QueryInterface (m_runningUrl);
m_channel->AsyncRead(0, -1, sprts,this /* stream observer */);
SetFlag(IMAP_CONNECTION_IS_OPEN);
}
// we used to check if the current running url was // we used to check if the current running url was
// Reinitialize the parser // Reinitialize the parser
GetServerStateParser().InitializeState(); GetServerStateParser().InitializeState();
@ -1092,12 +1098,6 @@ nsresult nsImapProtocol::LoadUrl(nsIURI * aURL, nsISupports * aConsumer)
// can get away with this. // can get away with this.
m_needNoop = (imapAction == nsIImapUrl::nsImapSelectFolder || imapAction == nsIImapUrl::nsImapDeleteAllMsgs); m_needNoop = (imapAction == nsIImapUrl::nsImapSelectFolder || imapAction == nsIImapUrl::nsImapDeleteAllMsgs);
if (!TestFlag(IMAP_CONNECTION_IS_OPEN))
{
m_channel->AsyncRead(0, -1, aURL,this /* stream observer */);
SetFlag(IMAP_CONNECTION_IS_OPEN);
}
// We now have a url to run so signal the monitor for url ready to be processed... // We now have a url to run so signal the monitor for url ready to be processed...
PR_EnterMonitor(m_urlReadyToRunMonitor); PR_EnterMonitor(m_urlReadyToRunMonitor);
m_nextUrlReadyToRun = PR_TRUE; m_nextUrlReadyToRun = PR_TRUE;
@ -1189,8 +1189,9 @@ NS_IMETHODIMP nsImapProtocol::CanHandleUrl(nsIImapUrl * aImapUrl,
PRBool isSelectedStateUrl = imapState == PRBool isSelectedStateUrl = imapState ==
nsIImapUrl::nsImapSelectedState; nsIImapUrl::nsImapSelectedState;
nsCOMPtr<nsIMsgMailNewsUrl> msgUrl = do_QueryInterface(aImapUrl);
nsCOMPtr<nsIMsgIncomingServer> server; nsCOMPtr<nsIMsgIncomingServer> server;
rv = aImapUrl->GetServer(getter_AddRefs(server)); rv = msgUrl->GetServer(getter_AddRefs(server));
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv))
{ {
// compare host/user between url and connection. // compare host/user between url and connection.
@ -5460,14 +5461,13 @@ PRBool nsImapProtocol::TryToLogon()
PRBool loginSucceeded = PR_FALSE; PRBool loginSucceeded = PR_FALSE;
char * password = nsnull; char * password = nsnull;
char * userName = nsnull; char * userName = nsnull;
nsresult rv = NS_OK;
// get the password and user name for the current incoming server... // get the password and user name for the current incoming server...
nsCOMPtr<nsIMsgIncomingServer> server; if (m_server)
nsresult rv = m_runningUrl->GetServer(getter_AddRefs(server));
if (NS_SUCCEEDED(rv) && server)
{ {
rv = server->GetPassword(&password); rv = m_server->GetPassword(&password);
rv = server->GetUsername(&userName); rv = m_server->GetUsername(&userName);
} }