QI url to the right type for nsIMsgMailNewsurl methods.

This commit is contained in:
mscott%netscape.com 1999-06-22 21:19:51 +00:00
Родитель 6d5b6565ad
Коммит 10ac55c56d
2 изменённых файлов: 17 добавлений и 12 удалений

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

@ -167,18 +167,19 @@ nsImapIncomingServer::GetImapConnectionAndLoadUrl(nsIEventQueue*
rv = CreateImapConnection(aClientEventQueue, aImapUrl, &aProtocol);
if (NS_FAILED(rv)) return rv;
if (aUrlListener)
aImapUrl->RegisterListener(aUrlListener);
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(aImapUrl, &rv);
if (NS_SUCCEEDED(rv) && mailnewsurl && aUrlListener)
mailnewsurl->RegisterListener(aUrlListener);
if (aProtocol)
{
rv = aProtocol->LoadUrl(aImapUrl, aConsumer);
rv = aProtocol->LoadUrl(mailnewsurl, aConsumer);
// *** jt - in case of the time out situation or the connection gets
// terminated by some unforseen problems let's give it a second chance
// to run the url
if (NS_FAILED(rv))
{
rv = aProtocol->LoadUrl(aImapUrl, aConsumer);
rv = aProtocol->LoadUrl(mailnewsurl, aConsumer);
}
else
{
@ -196,7 +197,7 @@ nsImapIncomingServer::GetImapConnectionAndLoadUrl(nsIEventQueue*
}
if (aURL)
{
*aURL = aImapUrl;
*aURL = mailnewsurl;
NS_IF_RELEASE(*aURL);
}
@ -232,7 +233,9 @@ nsImapIncomingServer::LoadNextQueuedUrl()
&protocolInstance);
if (NS_SUCCEEDED(rv) && protocolInstance)
{
rv = protocolInstance->LoadUrl(aImapUrl, aConsumer);
nsCOMPtr<nsIURL> url = do_QueryInterface(aImapUrl, &rv);
if (NS_SUCCEEDED(rv) && url)
rv = protocolInstance->LoadUrl(url, aConsumer);
m_urlQueue->RemoveElementAt(0);
m_urlConsumers.RemoveElementAt(0);
}

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

@ -66,6 +66,7 @@
#include "nsIRDFResource.h"
#include "nsCOMPtr.h"
#include "nsMsgBaseCID.h"
#include "nsIMsgMailNewsUrl.h"
#ifdef XP_PC
#define NETLIB_DLL "netlib.dll"
@ -503,9 +504,9 @@ nsresult nsIMAP4TestDriver::OnRunIMAPCommand()
if (NS_SUCCEEDED(rv) && m_url)
{
m_url->SetImapLog(this);
rv = m_url->SetSpec(m_urlString); // reset spec
m_url->RegisterListener(this);
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_url);
rv = mailnewsurl->SetSpec(m_urlString); // reset spec
mailnewsurl->RegisterListener(this);
}
@ -633,13 +634,14 @@ nsresult nsIMAP4TestDriver::OnTestUrlParsing()
else
urlSpec = PR_smprintf("imap://%s", hostName);
imapUrl->SetSpec("imap://nsmail-2.mcom.com:143/test");
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(imapUrl);
mailnewsurl->SetSpec("imap://nsmail-2.mcom.com:143/test");
const char * urlHost = nsnull;
PRUint32 urlPort = 0;
imapUrl->GetHost(&urlHost);
imapUrl->GetHostPort(&urlPort);
mailnewsurl->GetHost(&urlHost);
mailnewsurl->GetHostPort(&urlPort);
printf("Host name test: %s\n", PL_strcmp(urlHost, hostName) == 0 ? "PASSED." : "FAILED!");
if (port > 0) // did the user try to test the port?