updating to new necko interfaces

This commit is contained in:
dougt%netscape.com 2001-01-25 21:44:59 +00:00
Родитель a6c292c82f
Коммит 8ac0f6da84
42 изменённых файлов: 384 добавлений и 470 удалений

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

@ -37,6 +37,7 @@
#include "nsAbSyncPostEngine.h"
#include "nsIIOService.h"
#include "nsIChannel.h"
#include "nsIStreamContentInfo.h"
#include "nsNetUtil.h"
#include "nsMimeTypes.h"
#include "nsIHTTPChannel.h"
@ -342,7 +343,7 @@ NS_IMETHODIMP
nsAbSyncPostEngine::DoContent(const char * aContentType,
nsURILoadCommand aCommand,
const char * aWindowTarget,
nsIChannel * aOpenedChannel,
nsIRequest *request,
nsIStreamListener ** aContentHandler,
PRBool * aAbortProcess)
{
@ -391,7 +392,7 @@ nsAbSyncPostEngine::StillRunning(PRBool *running)
// Methods for nsIStreamListener...
nsresult
nsAbSyncPostEngine::OnDataAvailable(nsIChannel * aChannel, nsISupports * ctxt, nsIInputStream *aIStream,
nsAbSyncPostEngine::OnDataAvailable(nsIRequest *request, nsISupports * ctxt, nsIInputStream *aIStream,
PRUint32 sourceOffset, PRUint32 aLength)
{
PRUint32 readLen = aLength;
@ -417,7 +418,7 @@ nsAbSyncPostEngine::OnDataAvailable(nsIChannel * aChannel, nsISupports * ctxt, n
// Methods for nsIStreamObserver
nsresult
nsAbSyncPostEngine::OnStartRequest(nsIChannel *aChannel, nsISupports *ctxt)
nsAbSyncPostEngine::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
{
if (mAuthenticationRunning)
NotifyListenersOnStartAuthOperation();
@ -427,7 +428,7 @@ nsAbSyncPostEngine::OnStartRequest(nsIChannel *aChannel, nsISupports *ctxt)
}
nsresult
nsAbSyncPostEngine::OnStopRequest(nsIChannel *aChannel, nsISupports * /* ctxt */, nsresult aStatus, const PRUnichar* aMsg)
nsAbSyncPostEngine::OnStopRequest(nsIRequest *request, nsISupports * /* ctxt */, nsresult aStatus, const PRUnichar* aMsg)
{
#ifdef NS_DEBUG_rhp
printf("nsAbSyncPostEngine::OnStopRequest()\n");
@ -441,18 +442,22 @@ nsAbSyncPostEngine::OnStopRequest(nsIChannel *aChannel, nsISupports * /* ctxt */
mStillRunning = PR_FALSE;
// Check the content type!
if (aChannel)
nsCOMPtr<nsIStreamContentInfo> contentInfo = do_QueryInterface(request);
if (contentInfo)
{
char *contentType = nsnull;
char *charset = nsnull;
if (NS_SUCCEEDED(aChannel->GetContentType(&contentType)) && contentType)
if (NS_SUCCEEDED(contentInfo->GetContentType(&contentType)) && contentType)
{
if (PL_strcasecmp(contentType, UNKNOWN_CONTENT_TYPE))
{
mContentType = contentType;
}
}
nsCOMPtr<nsIChannel> aChannel;
request->GetParent(getter_AddRefs(aChannel));
if (!aChannel) return NS_ERROR_FAILURE;
nsCOMPtr<nsIHTTPChannel> httpChannel = do_QueryInterface(aChannel);
if (httpChannel)
@ -706,8 +711,8 @@ nsAbSyncPostEngine::FireURLRequest(nsIURI *aURL, const char *postData)
httpChannel->SetRequestMethod(method);
if (NS_SUCCEEDED(rv = NS_NewPostDataStream(getter_AddRefs(postStream), PR_FALSE, postData, 0)))
httpChannel->SetUploadStream(postStream);
httpChannel->AsyncRead(this, nsnull);
httpChannel->AsyncRead(this, nsnull, 0, -1, getter_AddRefs(mRequest));
return NS_OK;
}
@ -846,9 +851,8 @@ nsAbSyncPostEngine::CancelAbSync()
}
else
{
nsCOMPtr<nsIHTTPChannel> httpChannel = do_QueryInterface(mChannel);
if (httpChannel)
rv = httpChannel->Cancel(NS_BINDING_ABORTED);
if (mRequest)
rv = mRequest->Cancel(NS_BINDING_ABORTED);
}
return rv;

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

@ -109,7 +109,7 @@ private:
PRBool mAuthenticationRunning;
nsCOMPtr<nsIAbSyncMojo> mSyncMojo;
nsCOMPtr<nsIChannel> mChannel;
nsCOMPtr<nsIRequest> mRequest;
char *mSyncProtocolRequest;
char *mSyncProtocolRequestPrefix;

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

@ -341,7 +341,7 @@ const nsMsgBiffState nsMsgBiffState_Unknown = 2; // We dunno whether there is ne
nsIMsgDBHdr GetMessageHeader(in nsMsgKey msgKey);
boolean shouldStoreMsgOffline(in nsMsgKey msgKey);
boolean hasMsgOffline(in nsMsgKey msgKey);
nsIFileChannel getOfflineFileChannel(in nsMsgKey msgKey);
nsIFileChannel getOfflineFileChannel(in nsMsgKey msgKey, out PRUint32 offset, out PRUint32 size);
void DownloadMessagesForOffline(in nsISupportsArray messages);
nsIMsgFolder getChildWithURI(in string uri, in boolean deep);

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

@ -131,14 +131,14 @@ NS_IMETHODIMP nsCopyMessageStreamListener::EndMessage(nsMsgKey key)
}
NS_IMETHODIMP nsCopyMessageStreamListener::OnDataAvailable(nsIChannel * /* aChannel */, nsISupports *ctxt, nsIInputStream *aIStream, PRUint32 sourceOffset, PRUint32 aLength)
NS_IMETHODIMP nsCopyMessageStreamListener::OnDataAvailable(nsIRequest * /* request */, nsISupports *ctxt, nsIInputStream *aIStream, PRUint32 sourceOffset, PRUint32 aLength)
{
nsresult rv;
rv = mDestination->CopyData(aIStream, aLength);
return rv;
}
NS_IMETHODIMP nsCopyMessageStreamListener::OnStartRequest(nsIChannel * aChannel, nsISupports *ctxt)
NS_IMETHODIMP nsCopyMessageStreamListener::OnStartRequest(nsIRequest * request, nsISupports *ctxt)
{
nsCOMPtr<nsIMessage> message;
nsresult rv = NS_OK;
@ -154,7 +154,7 @@ NS_IMETHODIMP nsCopyMessageStreamListener::OnStartRequest(nsIChannel * aChannel,
return rv;
}
NS_IMETHODIMP nsCopyMessageStreamListener::OnStopRequest(nsIChannel * aChannel, nsISupports *ctxt, nsresult aStatus, const PRUnichar *aMsg)
NS_IMETHODIMP nsCopyMessageStreamListener::OnStopRequest(nsIRequest* request, nsISupports *ctxt, nsresult aStatus, const PRUnichar *aMsg)
{
nsresult rv = NS_OK;
nsCOMPtr<nsIURI> uri = do_QueryInterface(ctxt, &rv);

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

@ -1573,7 +1573,7 @@ nsSaveAsListener::OnStopCopy(nsresult aStatus)
}
NS_IMETHODIMP
nsSaveAsListener::OnStartRequest(nsIChannel* aChannel, nsISupports* aSupport)
nsSaveAsListener::OnStartRequest(nsIRequest* request, nsISupports* aSupport)
{
nsresult rv = NS_OK;
if (m_fileSpec)
@ -1590,7 +1590,7 @@ nsSaveAsListener::OnStartRequest(nsIChannel* aChannel, nsISupports* aSupport)
}
NS_IMETHODIMP
nsSaveAsListener::OnStopRequest(nsIChannel* aChannel, nsISupports* aSupport,
nsSaveAsListener::OnStopRequest(nsIRequest* request, nsISupports* aSupport,
nsresult status, const PRUnichar* aMsg)
{
nsresult rv = NS_OK;
@ -1688,7 +1688,7 @@ nsSaveAsListener::OnStopRequest(nsIChannel* aChannel, nsISupports* aSupport,
}
NS_IMETHODIMP
nsSaveAsListener::OnDataAvailable(nsIChannel* aChannel,
nsSaveAsListener::OnDataAvailable(nsIRequest* request,
nsISupports* aSupport,
nsIInputStream* inStream,
PRUint32 srcOffset,

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

@ -281,7 +281,7 @@ nsFolderCompactState::GetMessage(nsIMessage **message)
NS_IMETHODIMP
nsFolderCompactState::OnStartRequest(nsIChannel *channel, nsISupports *ctxt)
nsFolderCompactState::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
{
nsresult rv = NS_ERROR_FAILURE;
NS_ASSERTION(m_fileStream, "Fatal, null m_fileStream...\n");
@ -296,7 +296,7 @@ nsFolderCompactState::OnStartRequest(nsIChannel *channel, nsISupports *ctxt)
}
NS_IMETHODIMP
nsFolderCompactState::OnStopRequest(nsIChannel *channel, nsISupports *ctxt,
nsFolderCompactState::OnStopRequest(nsIRequest *request, nsISupports *ctxt,
nsresult status,
const PRUnichar *errorMsg)
{
@ -355,7 +355,7 @@ done:
}
NS_IMETHODIMP
nsFolderCompactState::OnDataAvailable(nsIChannel *channel, nsISupports *ctxt,
nsFolderCompactState::OnDataAvailable(nsIRequest *request, nsISupports *ctxt,
nsIInputStream *inStr,
PRUint32 sourceOffset, PRUint32 count)
{
@ -397,7 +397,7 @@ nsOfflineStoreCompactState::InitDB(nsIMsgDatabase *db)
}
NS_IMETHODIMP
nsOfflineStoreCompactState::OnStopRequest(nsIChannel *channel, nsISupports *ctxt,
nsOfflineStoreCompactState::OnStopRequest(nsIRequest *request, nsISupports *ctxt,
nsresult status,
const PRUnichar *errorMsg)
{

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

@ -72,7 +72,7 @@ public:
virtual ~nsOfflineStoreCompactState(void);
virtual nsresult InitDB(nsIMsgDatabase *db);
NS_IMETHOD OnStopRequest(nsIChannel *channel, nsISupports *ctxt,
NS_IMETHOD OnStopRequest(nsIRequest *request, nsISupports *ctxt,
nsresult status, const PRUnichar *errorMsg);
NS_IMETHODIMP FinishCompact();

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

@ -95,7 +95,7 @@ nsMsgPrintEngine::OnStartDocumentLoad(nsIDocumentLoader *aLoader, nsIURI *aURL,
}
NS_IMETHODIMP
nsMsgPrintEngine::OnEndDocumentLoad(nsIDocumentLoader *loader, nsIChannel *aChannel, PRUint32 aStatus)
nsMsgPrintEngine::OnEndDocumentLoad(nsIDocumentLoader *loader, nsIRequest *request, PRUint32 aStatus)
{
// Now, fire off the print operation!
nsresult rv = NS_ERROR_FAILURE;
@ -106,10 +106,13 @@ nsMsgPrintEngine::OnEndDocumentLoad(nsIDocumentLoader *loader, nsIChannel *aChan
PR_FREEIF(msg);
NS_ASSERTION(mDocShell,"can't print, there is no docshell");
if ( (!mDocShell) || (!aChannel) )
if ( (!mDocShell) || (!request) )
{
return StartNextPrintOperation();
}
nsCOMPtr<nsIChannel> aChannel;
request->GetParent(getter_AddRefs(aChannel));
if (!aChannel) return NS_ERROR_FAILURE;
// Make sure this isn't just "about:blank" finishing....
nsCOMPtr<nsIURI> originalURI = nsnull;
@ -157,25 +160,25 @@ nsMsgPrintEngine::OnEndDocumentLoad(nsIDocumentLoader *loader, nsIChannel *aChan
}
NS_IMETHODIMP
nsMsgPrintEngine::OnStartURLLoad(nsIDocumentLoader *aLoader, nsIChannel *channel)
nsMsgPrintEngine::OnStartURLLoad(nsIDocumentLoader *aLoader, nsIRequest *request)
{
return NS_OK;
}
NS_IMETHODIMP
nsMsgPrintEngine::OnProgressURLLoad(nsIDocumentLoader *aLoader, nsIChannel *aChannel, PRUint32 aProgress, PRUint32 aProgressMax)
nsMsgPrintEngine::OnProgressURLLoad(nsIDocumentLoader *aLoader, nsIRequest *request, PRUint32 aProgress, PRUint32 aProgressMax)
{
return NS_OK;
}
NS_IMETHODIMP
nsMsgPrintEngine::OnStatusURLLoad(nsIDocumentLoader *loader, nsIChannel *channel, nsString & aMsg)
nsMsgPrintEngine::OnStatusURLLoad(nsIDocumentLoader *loader, nsIRequest *request, nsString & aMsg)
{
return NS_OK;
}
NS_IMETHODIMP
nsMsgPrintEngine::OnEndURLLoad(nsIDocumentLoader *aLoader, nsIChannel *aChannel, PRUint32 aStatus)
nsMsgPrintEngine::OnEndURLLoad(nsIDocumentLoader *aLoader, nsIRequest *request, PRUint32 aStatus)
{
return NS_OK;
}

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

@ -353,15 +353,15 @@ nsMsgStatusFeedback::NotifyStopMeteors(nsITimer* aTimer)
m_meteorsSpinning = PR_FALSE;
}
NS_IMETHODIMP nsMsgStatusFeedback::OnProgress(nsIChannel* channel, nsISupports* ctxt,
NS_IMETHODIMP nsMsgStatusFeedback::OnProgress(nsIRequest *request, nsISupports* ctxt,
PRUint32 aProgress, PRUint32 aProgressMax)
{
// XXX: What should the nsIWebProgress be?
return OnProgressChange(nsnull, channel, aProgress, aProgressMax,
return OnProgressChange(nsnull, request, aProgress, aProgressMax,
aProgress /* current total progress */, aProgressMax /* max total progress */);
}
NS_IMETHODIMP nsMsgStatusFeedback::OnStatus(nsIChannel* channel, nsISupports* ctxt,
NS_IMETHODIMP nsMsgStatusFeedback::OnStatus(nsIRequest *request, nsISupports* ctxt,
nsresult aStatus, const PRUnichar* aStatusArg)
{
nsresult rv;

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

@ -398,7 +398,7 @@ NS_IMETHODIMP nsMsgWindow::GetProtocolHandler(nsIURI * /* aURI */, nsIProtocolHa
}
NS_IMETHODIMP nsMsgWindow::DoContent(const char *aContentType, nsURILoadCommand aCommand, const char *aWindowTarget,
nsIChannel *aChannel, nsIStreamListener **aContentHandler, PRBool *aAbortProcess)
nsIRequest *request, nsIStreamListener **aContentHandler, PRBool *aAbortProcess)
{
if (aContentType)
{
@ -408,6 +408,10 @@ NS_IMETHODIMP nsMsgWindow::DoContent(const char *aContentType, nsURILoadCommand
nsCOMPtr<nsIURIContentListener> ctnListener = do_QueryInterface(messageWindowDocShell);
if (ctnListener)
{
nsCOMPtr<nsIChannel> aChannel;
request->GetParent(getter_AddRefs(aChannel));
if (!aChannel) return NS_ERROR_FAILURE;
// get the url for the channel...let's hope it is a mailnews url so we can set our msg hdr sink on it..
// right now, this is the only way I can think of to force the msg hdr sink into the mime converter so it can
// get too it later...
@ -419,7 +423,7 @@ NS_IMETHODIMP nsMsgWindow::DoContent(const char *aContentType, nsURILoadCommand
if (mailnewsUrl)
mailnewsUrl->SetMsgWindow(this);
}
return ctnListener->DoContent(aContentType, aCommand, aWindowTarget, aChannel, aContentHandler, aAbortProcess);
return ctnListener->DoContent(aContentType, aCommand, aWindowTarget, request, aContentHandler, aAbortProcess);
}
}
return NS_OK;

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

@ -581,10 +581,12 @@ nsresult nsMsgDBFolder::GetOfflineStoreInputStream(nsIInputStream **stream)
return rv;
}
NS_IMETHODIMP nsMsgDBFolder::GetOfflineFileChannel(nsMsgKey msgKey, nsIFileChannel **aFileChannel)
NS_IMETHODIMP nsMsgDBFolder::GetOfflineFileChannel(nsMsgKey msgKey, PRUint32 *offset, PRUint32 *size, nsIFileChannel **aFileChannel)
{
NS_ENSURE_ARG(aFileChannel);
*offset = *size = 0;
nsresult rv;
rv = nsComponentManager::CreateInstance(NS_LOCALFILECHANNEL_CONTRACTID, nsnull,
@ -606,12 +608,8 @@ NS_IMETHODIMP nsMsgDBFolder::GetOfflineFileChannel(nsMsgKey msgKey, nsIFileChann
rv = mDatabase->GetMsgHdrForKey(msgKey, getter_AddRefs(hdr));
if (hdr && NS_SUCCEEDED(rv))
{
PRUint32 messageOffset;
PRUint32 messageSize;
hdr->GetMessageOffset(&messageOffset);
hdr->GetOfflineMessageSize(&messageSize);
(*aFileChannel)->SetTransferOffset(messageOffset);
(*aFileChannel)->SetTransferCount(messageSize);
hdr->GetMessageOffset(offset);
hdr->GetOfflineMessageSize(size);
}
}
}
@ -643,8 +641,8 @@ nsresult nsMsgDBFolder::GetOfflineStoreOutputStream(nsIOutputStream **outputStre
rv = fileChannel->Init(localStore, PR_CREATE_FILE | PR_RDWR, 0);
if (NS_FAILED(rv))
return rv;
fileChannel->SetTransferOffset(fileSize);
rv = fileChannel->OpenOutputStream(outputStream);
//bad see dougt fileChannel->SetTransferOffset(fileSize);
//bad see dougt rv = fileChannel->OpenOutputStream(outputStream);
if (NS_FAILED(rv))
return rv;
}
@ -690,7 +688,6 @@ nsresult nsMsgDBFolder::CreatePlatformLeafNameForDisk(const char *userLeafName,
// (c) does not already exist on the disk
// then we simply return nsCRT::strdup(userLeafName)
// Otherwise we mangle it
// mangledPath is the entire path to the newly mangled leaf name
nsCAutoString mangledLeaf(userLeafName);

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

@ -93,7 +93,7 @@ public:
NS_IMETHOD SetGettingNewMessages(PRBool gettingNewMessages);
NS_IMETHOD ShouldStoreMsgOffline(nsMsgKey msgKey, PRBool *result);
NS_IMETHOD GetOfflineFileChannel(nsMsgKey msgKey, nsIFileChannel **aFileChannel);
NS_IMETHOD GetOfflineFileChannel(nsMsgKey msgKey, PRUint32 *offset, PRUint32 *size, nsIFileChannel **_retval);
NS_IMETHOD HasMsgOffline(nsMsgKey msgKey, PRBool *result);
NS_IMETHOD DownloadMessagesForOffline(nsISupportsArray *messages);
NS_IMETHOD GetRetentionSettings(nsIMsgRetentionSettings **settings);

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

@ -37,7 +37,12 @@
static NS_DEFINE_CID(kNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID);
static NS_DEFINE_CID(kSocketTransportServiceCID, NS_SOCKETTRANSPORTSERVICE_CID);
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
NS_IMPL_ISUPPORTS3(nsMsgProtocol, nsIStreamListener, nsIStreamObserver, nsIChannel)
NS_IMPL_ISUPPORTS5(nsMsgProtocol,
nsIStreamListener,
nsIStreamObserver,
nsIChannel,
nsIRequest,
nsIStreamContentInfo)
nsMsgProtocol::nsMsgProtocol(nsIURI * aURL)
{
@ -136,7 +141,7 @@ nsresult nsMsgProtocol::SetupTransportState()
if (!m_socketIsOpen && m_channel)
{
rv = m_channel->OpenOutputStream(getter_AddRefs(m_outputStream));
rv = m_channel->OpenOutputStream(0, -1, getter_AddRefs(m_outputStream));
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to create an output stream");
// we want to open the stream
@ -154,10 +159,11 @@ nsresult nsMsgProtocol::CloseSocket()
m_outputStream = null_nsCOMPtr();
// we need to call Cancel so that we remove the socket transport from the mActiveTransportList. see bug #30648
if (m_channel) {
rv = m_channel->Cancel(NS_BINDING_ABORTED);
if (m_request) {
rv = m_request->Cancel(NS_BINDING_ABORTED);
}
m_channel = null_nsCOMPtr();
m_request = 0;
m_channel = 0;
return rv;
}
@ -187,14 +193,14 @@ PRInt32 nsMsgProtocol::SendData(nsIURI * aURL, const char * dataBuffer, PRBool a
// Whenever data arrives from the connection, core netlib notifices the protocol by calling
// OnDataAvailable. We then read and process the incoming data from the input stream.
NS_IMETHODIMP nsMsgProtocol::OnDataAvailable(nsIChannel * /* aChannel */, nsISupports *ctxt, nsIInputStream *inStr, PRUint32 sourceOffset, PRUint32 count)
NS_IMETHODIMP nsMsgProtocol::OnDataAvailable(nsIRequest *request, nsISupports *ctxt, nsIInputStream *inStr, PRUint32 sourceOffset, PRUint32 count)
{
// right now, this really just means turn around and churn through the state machine
nsCOMPtr<nsIURI> uri = do_QueryInterface(ctxt);
return ProcessProtocolState(uri, inStr, sourceOffset, count);
}
NS_IMETHODIMP nsMsgProtocol::OnStartRequest(nsIChannel * aChannel, nsISupports *ctxt)
NS_IMETHODIMP nsMsgProtocol::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
{
nsresult rv = NS_OK;
nsCOMPtr <nsIMsgMailNewsUrl> aMsgUrl = do_QueryInterface(ctxt, &rv);
@ -202,7 +208,7 @@ NS_IMETHODIMP nsMsgProtocol::OnStartRequest(nsIChannel * aChannel, nsISupports *
{
rv = aMsgUrl->SetUrlState(PR_TRUE, NS_OK);
if (m_loadGroup)
m_loadGroup->AddChannel(NS_STATIC_CAST(nsIChannel *, this), nsnull /* context isupports */);
m_loadGroup->AddRequest(NS_STATIC_CAST(nsIRequest *, this), nsnull /* context isupports */);
}
// if we are set up as a channel, we should notify our channel listener that we are starting...
@ -219,7 +225,7 @@ NS_IMETHODIMP nsMsgProtocol::OnStartRequest(nsIChannel * aChannel, nsISupports *
}
// stop binding is a "notification" informing us that the stream associated with aURL is going away.
NS_IMETHODIMP nsMsgProtocol::OnStopRequest(nsIChannel * aChannel, nsISupports *ctxt, nsresult aStatus, const PRUnichar* aMsg)
NS_IMETHODIMP nsMsgProtocol::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult aStatus, const PRUnichar* aMsg)
{
nsresult rv = NS_OK;
@ -234,7 +240,7 @@ NS_IMETHODIMP nsMsgProtocol::OnStopRequest(nsIChannel * aChannel, nsISupports *c
{
rv = msgUrl->SetUrlState(PR_FALSE, aStatus);
if (m_loadGroup)
m_loadGroup->RemoveChannel(NS_STATIC_CAST(nsIChannel *, this), nsnull, aStatus, nsnull);
m_loadGroup->RemoveRequest(NS_STATIC_CAST(nsIRequest *, this), nsnull, aStatus, nsnull);
// !NS_BINDING_ABORTED because we don't want to see an alert if the user
// cancelled the operation. also, we'll get here because we call Cancel()
@ -314,17 +320,8 @@ nsresult nsMsgProtocol::LoadUrl(nsIURI * aURL, nsISupports * aConsumer)
nsCOMPtr<nsISupports> urlSupports = do_QueryInterface(aURL);
if (m_channel)
{
// XXX should these errors be returned?:
if (m_startPosition > 0)
{
rv = m_channel->SetTransferOffset(m_startPosition);
NS_ASSERTION(NS_SUCCEEDED(rv), "SetTransferOffset failed");
}
rv = m_channel->SetTransferCount(m_readCount);
NS_ASSERTION(NS_SUCCEEDED(rv), "SetTransferCount failed");
// put us in a state where we are always notified of incoming data
rv = m_channel->AsyncRead(this /* stream observer */, urlSupports);
rv = m_channel->AsyncRead(this, urlSupports, m_startPosition, m_readCount, getter_AddRefs(m_request));
NS_ASSERTION(NS_SUCCEEDED(rv), "AsyncRead failed");
m_socketIsOpen = PR_TRUE; // mark the channel as open
}
@ -378,19 +375,20 @@ NS_IMETHODIMP nsMsgProtocol::SetURI(nsIURI* aURI)
return NS_OK;
}
NS_IMETHODIMP nsMsgProtocol::OpenInputStream(nsIInputStream **_retval)
NS_IMETHODIMP nsMsgProtocol::OpenInputStream(PRUint32 transferOffset, PRUint32 transferCount, nsIInputStream **_retval)
{
NS_NOTREACHED("OpenInputStream");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsMsgProtocol::OpenOutputStream(nsIOutputStream **_retval)
NS_IMETHODIMP nsMsgProtocol::OpenOutputStream(PRUint32 transferOffset, PRUint32 transferCount, nsIOutputStream **_retval)
{
NS_NOTREACHED("OpenOutputStream");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsMsgProtocol::AsyncRead(nsIStreamListener *listener, nsISupports *ctxt)
NS_IMETHODIMP nsMsgProtocol::AsyncRead(nsIStreamListener *listener, nsISupports *ctxt,
PRUint32 transferOffset, PRUint32 transferCount, nsIRequest **_retval)
{
// set the stream listener and then load the url
m_channelContext = ctxt;
@ -417,7 +415,8 @@ NS_IMETHODIMP nsMsgProtocol::AsyncRead(nsIStreamListener *listener, nsISupports
return LoadUrl(m_url, nsnull);
}
NS_IMETHODIMP nsMsgProtocol::AsyncWrite(nsIStreamProvider *provider, nsISupports *ctxt)
NS_IMETHODIMP nsMsgProtocol::AsyncWrite(nsIInputStream *a, nsIStreamObserver*b, nsISupports *ctxt,
PRUint32 transferOffset, PRUint32 transferCount, nsIRequest **_retval)
{
NS_NOTREACHED("AsyncWrite");
return NS_ERROR_NOT_IMPLEMENTED;
@ -468,83 +467,6 @@ nsMsgProtocol::SetContentLength(PRInt32 aContentLength)
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsMsgProtocol::GetTransferOffset(PRUint32 *aTransferOffset)
{
NS_NOTREACHED("GetTransferOffset");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsMsgProtocol::SetTransferOffset(PRUint32 aTransferOffset)
{
NS_NOTREACHED("SetTransferOffset");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsMsgProtocol::GetTransferCount(PRInt32 *aTransferCount)
{
NS_NOTREACHED("GetTransferCount");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsMsgProtocol::SetTransferCount(PRInt32 aTransferCount)
{
NS_NOTREACHED("SetTransferCount");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsMsgProtocol::GetBufferSegmentSize(PRUint32 *aBufferSegmentSize)
{
NS_NOTREACHED("GetBufferSegmentSize");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsMsgProtocol::SetBufferSegmentSize(PRUint32 aBufferSegmentSize)
{
NS_NOTREACHED("SetBufferSegmentSize");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsMsgProtocol::GetBufferMaxSize(PRUint32 *aBufferMaxSize)
{
NS_NOTREACHED("GetBufferMaxSize");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsMsgProtocol::SetBufferMaxSize(PRUint32 aBufferMaxSize)
{
NS_NOTREACHED("SetBufferMaxSize");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsMsgProtocol::GetLocalFile(nsIFile* *file)
{
NS_NOTREACHED("GetLocalFile");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsMsgProtocol::GetPipeliningAllowed(PRBool *aPipeliningAllowed)
{
*aPipeliningAllowed = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP
nsMsgProtocol::SetPipeliningAllowed(PRBool aPipeliningAllowed)
{
NS_NOTREACHED("SetPipeliningAllowed");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsMsgProtocol::GetOwner(nsISupports * *aPrincipal)
{
*aPrincipal = mOwner;
@ -605,8 +527,8 @@ nsMsgProtocol::GetSecurityInfo(nsISupports * *aSecurityInfo)
NS_IMETHODIMP nsMsgProtocol::GetName(PRUnichar* *result)
{
if (m_channel)
return m_channel->GetName(result);
if (m_request)
return m_request->GetName(result);
NS_NOTREACHED("nsMsgProtocol::GetName");
return NS_ERROR_NOT_IMPLEMENTED;
}
@ -619,8 +541,8 @@ NS_IMETHODIMP nsMsgProtocol::IsPending(PRBool *result)
NS_IMETHODIMP nsMsgProtocol::GetStatus(nsresult *status)
{
if (m_channel)
return m_channel->GetStatus(status);
if (m_request)
return m_request->GetStatus(status);
*status = NS_ERROR_FAILURE;
return *status;
@ -628,12 +550,12 @@ NS_IMETHODIMP nsMsgProtocol::GetStatus(nsresult *status)
NS_IMETHODIMP nsMsgProtocol::Cancel(nsresult status)
{
NS_ASSERTION(m_channel,"no channel");
if (!m_channel) {
NS_ASSERTION(m_request,"no channel");
if (!m_request) {
return NS_ERROR_FAILURE;
}
return m_channel->Cancel(status);
return m_request->Cancel(status);
}
NS_IMETHODIMP nsMsgProtocol::Suspend()
@ -648,6 +570,18 @@ NS_IMETHODIMP nsMsgProtocol::Resume()
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsMsgProtocol::GetParent(nsISupports * *aParent)
{
NS_ADDREF(*aParent=(nsISupports*)(nsIChannel*)this);
return NS_OK;
}
NS_IMETHODIMP nsMsgProtocol::SetParent(nsISupports * aParent)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult nsMsgProtocol::PostMessage(nsIURI* url, nsIFileSpec *fileSpec)
{
if (!url || !fileSpec) return NS_ERROR_NULL_POINTER;

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

@ -33,6 +33,7 @@
#include "nsIFileSpec.h"
#include "nsIInterfaceRequestor.h"
#include "nsIProgressEventSink.h"
#include "nsIStreamContentInfo.h"
class nsIPrompt;
class nsIMsgMailNewsUrl;
@ -42,7 +43,11 @@ class nsIMsgMailNewsUrl;
// it unifies the core networking code for the protocols. My hope is that
// this will make unification with Necko easier as we'll only have to change
// this class and not all of the mailnews protocols.
class NS_MSG_BASE nsMsgProtocol : public nsIStreamListener, public nsIChannel
class NS_MSG_BASE nsMsgProtocol
: public nsIStreamListener,
public nsIChannel,
public nsIRequest,
public nsIStreamContentInfo
{
public:
nsMsgProtocol(nsIURI * aURL);
@ -52,6 +57,7 @@ public:
// nsIChannel support
NS_DECL_NSICHANNEL
NS_DECL_NSIREQUEST
NS_DECL_NSISTREAMCONTENTINFO
NS_DECL_NSISTREAMLISTENER
NS_DECL_NSISTREAMOBSERVER
@ -102,7 +108,9 @@ protected:
// Ouput stream for writing commands to the socket
nsCOMPtr<nsIChannel> m_channel;
nsCOMPtr<nsIOutputStream> m_outputStream; // this will be obtained from the transport interface
nsCOMPtr<nsIRequest> m_request;
nsCOMPtr<nsIOutputStream> m_outputStream; // this will be obtained from the transport interface
PRBool m_socketIsOpen; // mscott: we should look into keeping this state in the nsSocketTransport...
// I'm using it to make sure I open the socket the first time a URL is loaded into the connection

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

@ -1173,12 +1173,12 @@ QuotingOutputStreamListener::ConvertToPlainText(PRBool formatflowed /* = PR_FALS
return rv;
}
NS_IMETHODIMP QuotingOutputStreamListener::OnStartRequest(nsIChannel * /* aChannel */, nsISupports * /* ctxt */)
NS_IMETHODIMP QuotingOutputStreamListener::OnStartRequest(nsIRequest *request, nsISupports * /* ctxt */)
{
return NS_OK;
}
NS_IMETHODIMP QuotingOutputStreamListener::OnStopRequest(nsIChannel *aChannel, nsISupports * /* ctxt */, nsresult status, const PRUnichar * /* errorMsg */)
NS_IMETHODIMP QuotingOutputStreamListener::OnStopRequest(nsIRequest *request, nsISupports * /* ctxt */, nsresult status, const PRUnichar * /* errorMsg */)
{
nsresult rv = NS_OK;
nsAutoString aCharset;
@ -1373,7 +1373,7 @@ NS_IMETHODIMP QuotingOutputStreamListener::OnStopRequest(nsIChannel *aChannel, n
return rv;
}
NS_IMETHODIMP QuotingOutputStreamListener::OnDataAvailable(nsIChannel * /* aChannel */,
NS_IMETHODIMP QuotingOutputStreamListener::OnDataAvailable(nsIRequest *request,
nsISupports *ctxt, nsIInputStream *inStr,
PRUint32 sourceOffset, PRUint32 count)
{

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

@ -42,15 +42,19 @@ nsMsgComposeContentHandler::~nsMsgComposeContentHandler()
}
NS_IMETHODIMP nsMsgComposeContentHandler::HandleContent(const char * aContentType, const char * aCommand,
const char * aWindowTarget, nsISupports * aWindowContext, nsIChannel * aChannel)
const char * aWindowTarget, nsISupports * aWindowContext, nsIRequest *request)
{
nsresult rv = NS_OK;
if (!aChannel)
if (!request)
return NS_ERROR_NULL_POINTER;
// First of all, get the content type and make sure it is a content type we know how to handle!
if (nsCRT::strcasecmp(aContentType, "x-application-mailto") == 0) {
nsCOMPtr<nsIURI> aUri;
nsCOMPtr<nsIChannel> aChannel;
request->GetParent(getter_AddRefs(aChannel));
if(!aChannel) return NS_ERROR_FAILURE;
rv = aChannel->GetURI(getter_AddRefs(aUri));
if (aUri)
{

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

@ -220,7 +220,8 @@ nsMsgQuote::QuoteMessage(const PRUnichar *msgURI, PRBool quoteHeaders, nsIStream
if (NS_FAILED(rv)) return rv;
// now try to open the channel passing in our display consumer as the listener
rv = mQuoteChannel->AsyncRead(convertedListener, ctxt);
nsCOMPtr<nsIRequest> request;
rv = mQuoteChannel->AsyncRead(convertedListener, ctxt, 0, -1, getter_AddRefs(request));
ReleaseMessageServiceFromURI(aMsgUri, msgService);
return rv;

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

@ -141,7 +141,7 @@ nsMsgSendLater::~nsMsgSendLater()
// Stream is done...drive on!
nsresult
nsMsgSendLater::OnStopRequest(nsIChannel *channel, nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg)
nsMsgSendLater::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg)
{
nsresult rv;
@ -179,6 +179,10 @@ nsMsgSendLater::OnStopRequest(nsIChannel *channel, nsISupports *ctxt, nsresult s
}
else
{
nsCOMPtr<nsIChannel> channel;
request->GetParent(getter_AddRefs(channel));
if(!channel) return NS_ERROR_FAILURE;
// extract the prompt object to use for the alert from the url....
nsCOMPtr<nsIURI> uri;
nsCOMPtr<nsIPrompt> promptObject;
@ -260,7 +264,7 @@ nsMsgSendLater::BuildNewBuffer(const char* aBuf, PRUint32 aCount, PRUint32 *tota
// Got data?
nsresult
nsMsgSendLater::OnDataAvailable(nsIChannel *channel, nsISupports *ctxt, nsIInputStream *inStr, PRUint32 sourceOffset, PRUint32 count)
nsMsgSendLater::OnDataAvailable(nsIRequest *request, nsISupports *ctxt, nsIInputStream *inStr, PRUint32 sourceOffset, PRUint32 count)
{
// This is a little bit tricky since we have to chop random
// buffers into lines and deliver the lines...plus keeping the
@ -316,7 +320,7 @@ nsMsgSendLater::OnDataAvailable(nsIChannel *channel, nsISupports *ctxt, nsIInput
}
nsresult
nsMsgSendLater::OnStartRequest(nsIChannel *channel, nsISupports *ctxt)
nsMsgSendLater::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
{
return NS_OK;
}

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

@ -386,7 +386,7 @@ const char * nsSmtpProtocol::GetUserDomainName()
////////////////////////////////////////////////////////////////////////////////////////////
// stop binding is a "notification" informing us that the stream associated with aURL is going away.
NS_IMETHODIMP nsSmtpProtocol::OnStopRequest(nsIChannel * /* aChannel */, nsISupports *ctxt, nsresult aStatus, const PRUnichar *aMsg)
NS_IMETHODIMP nsSmtpProtocol::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult aStatus, const PRUnichar *aMsg)
{
nsMsgProtocol::OnStopRequest(nsnull, ctxt, aStatus, aMsg);

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

@ -119,7 +119,7 @@ public:
////////////////////////////////////////////////////////////////////////////////////////
// stop binding is a "notification" informing us that the stream associated with aURL is going away.
NS_IMETHOD OnStopRequest(nsIChannel * aChannel, nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg);
NS_IMETHOD OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg);
private:
// logon redirection related variables and methods

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

@ -244,14 +244,15 @@ NS_IMETHODIMP nsSmtpService::GetDefaultPort(PRInt32 *aDefaultPort)
// But we need to have a channel to return for nsSmtpService::NewChannel
// that can simulate a real channel such that the uri loader can then get the
// content type for the channel.
class nsMailtoChannel : public nsIChannel
class nsMailtoChannel : public nsIChannel, public nsIRequest, public nsIStreamContentInfo
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSICHANNEL
NS_DECL_NSIREQUEST
NS_DECL_NSISTREAMCONTENTINFO
nsMailtoChannel(nsIURI * aURI);
virtual ~nsMailtoChannel();
@ -324,24 +325,26 @@ NS_IMETHODIMP nsMailtoChannel::SetURI(nsIURI* aURI)
return NS_OK;
}
NS_IMETHODIMP nsMailtoChannel::OpenInputStream(nsIInputStream **_retval)
NS_IMETHODIMP nsMailtoChannel::OpenInputStream(PRUint32 transferOffset, PRUint32 transferCount, nsIInputStream **_retval)
{
NS_NOTREACHED("OpenInputStream");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsMailtoChannel::OpenOutputStream(nsIOutputStream **_retval)
NS_IMETHODIMP nsMailtoChannel::OpenOutputStream(PRUint32 transferOffset, PRUint32 transferCount, nsIOutputStream **_retval)
{
NS_NOTREACHED("OpenOutputStream");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsMailtoChannel::AsyncRead(nsIStreamListener *listener, nsISupports *ctxt)
NS_IMETHODIMP nsMailtoChannel::AsyncRead(nsIStreamListener *listener, nsISupports *ctxt,
PRUint32 transferOffset, PRUint32 transferCount, nsIRequest **_retval)
{
return listener->OnStartRequest(this, ctxt);
}
NS_IMETHODIMP nsMailtoChannel::AsyncWrite(nsIStreamProvider *provider, nsISupports *ctxt)
NS_IMETHODIMP nsMailtoChannel::AsyncWrite(nsIInputStream *fromStream, nsIStreamObserver *observer, nsISupports *ctxt,
PRUint32 transferOffset, PRUint32 transferCount, nsIRequest **_retval)
{
NS_NOTREACHED("AsyncWrite");
return NS_ERROR_NOT_IMPLEMENTED;
@ -382,83 +385,6 @@ nsMailtoChannel::SetContentLength(PRInt32 aContentLength)
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsMailtoChannel::GetTransferOffset(PRUint32 *aTransferOffset)
{
NS_NOTREACHED("GetTransferOffset");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsMailtoChannel::SetTransferOffset(PRUint32 aTransferOffset)
{
NS_NOTREACHED("SetTransferOffset");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsMailtoChannel::GetTransferCount(PRInt32 *aTransferCount)
{
NS_NOTREACHED("GetTransferCount");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsMailtoChannel::SetTransferCount(PRInt32 aTransferCount)
{
NS_NOTREACHED("SetTransferCount");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsMailtoChannel::GetBufferSegmentSize(PRUint32 *aBufferSegmentSize)
{
NS_NOTREACHED("GetBufferSegmentSize");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsMailtoChannel::SetBufferSegmentSize(PRUint32 aBufferSegmentSize)
{
NS_NOTREACHED("SetBufferSegmentSize");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsMailtoChannel::GetBufferMaxSize(PRUint32 *aBufferMaxSize)
{
NS_NOTREACHED("GetBufferMaxSize");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsMailtoChannel::SetBufferMaxSize(PRUint32 aBufferMaxSize)
{
NS_NOTREACHED("SetBufferMaxSize");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsMailtoChannel::GetLocalFile(nsIFile* *file)
{
NS_NOTREACHED("GetLocalFile");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsMailtoChannel::GetPipeliningAllowed(PRBool *aPipeliningAllowed)
{
*aPipeliningAllowed = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP
nsMailtoChannel::SetPipeliningAllowed(PRBool aPipeliningAllowed)
{
NS_NOTREACHED("SetPipeliningAllowed");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsMailtoChannel::GetOwner(nsISupports * *aPrincipal)
{
NS_NOTREACHED("GetOwner");
@ -511,6 +437,17 @@ NS_IMETHODIMP nsMailtoChannel::Resume()
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute nsISupports parent; */
NS_IMETHODIMP nsMailtoChannel::GetParent(nsISupports * *aParent)
{
NS_ADDREF(*aParent=(nsISupports*)(nsIChannel*)this);
return NS_OK;
}
NS_IMETHODIMP nsMailtoChannel::SetParent(nsISupports * aParent)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
// the smtp service is also the protocol handler for mailto urls....

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

@ -40,6 +40,7 @@
#include "nsMimeTypes.h"
#include "nsIHTTPChannel.h"
#include "nsIWebProgress.h"
#include "nsIStreamContentInfo.h"
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
@ -161,7 +162,7 @@ NS_IMETHODIMP
nsURLFetcher::DoContent(const char * aContentType,
nsURILoadCommand aCommand,
const char * aWindowTarget,
nsIChannel * aOpenedChannel,
nsIRequest *request,
nsIStreamListener ** aContentHandler,
PRBool * aAbortProcess)
{
@ -229,7 +230,7 @@ nsURLFetcher::StillRunning(PRBool *running)
// Methods for nsIStreamListener...
nsresult
nsURLFetcher::OnDataAvailable(nsIChannel * aChannel, nsISupports * ctxt, nsIInputStream *aIStream,
nsURLFetcher::OnDataAvailable(nsIRequest *request, nsISupports * ctxt, nsIInputStream *aIStream,
PRUint32 sourceOffset, PRUint32 aLength)
{
PRUint32 readLen = aLength;
@ -262,13 +263,13 @@ nsURLFetcher::OnDataAvailable(nsIChannel * aChannel, nsISupports * ctxt, nsIInpu
// Methods for nsIStreamObserver
nsresult
nsURLFetcher::OnStartRequest(nsIChannel *aChannel, nsISupports *ctxt)
nsURLFetcher::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
{
return NS_OK;
}
nsresult
nsURLFetcher::OnStopRequest(nsIChannel *aChannel, nsISupports * /* ctxt */, nsresult aStatus, const PRUnichar* aMsg)
nsURLFetcher::OnStopRequest(nsIRequest *request, nsISupports * /* ctxt */, nsresult aStatus, const PRUnichar* aMsg)
{
#ifdef NS_DEBUG_rhp
printf("nsURLFetcher::OnStopRequest()\n");
@ -293,29 +294,31 @@ nsURLFetcher::OnStopRequest(nsIChannel *aChannel, nsISupports * /* ctxt */, nsre
mOutStream = nsnull;
}
// Check the content type!
if (aChannel)
char *contentType = nsnull;
char *charset = nsnull;
nsCOMPtr<nsIStreamContentInfo> contentInfo = do_QueryInterface(request);
if (contentInfo && NS_SUCCEEDED(contentInfo->GetContentType(&contentType)) && contentType)
{
char *contentType = nsnull;
char *charset = nsnull;
if (NS_SUCCEEDED(aChannel->GetContentType(&contentType)) && contentType)
if (PL_strcasecmp(contentType, UNKNOWN_CONTENT_TYPE))
{
if (PL_strcasecmp(contentType, UNKNOWN_CONTENT_TYPE))
{
mContentType = contentType;
}
mContentType = contentType;
}
}
nsCOMPtr<nsIHTTPChannel> httpChannel = do_QueryInterface(aChannel);
if (httpChannel)
nsCOMPtr<nsIChannel> aChannel;
request->GetParent(getter_AddRefs(aChannel));
if(!aChannel) return NS_ERROR_FAILURE;
nsCOMPtr<nsIHTTPChannel> httpChannel = do_QueryInterface(aChannel);
if (httpChannel)
{
if (NS_SUCCEEDED(httpChannel->GetCharset(&charset)) && charset)
{
if (NS_SUCCEEDED(httpChannel->GetCharset(&charset)) && charset)
{
mCharset = charset;
}
mCharset = charset;
}
}
}
// Now if there is a callback, we need to call it...
if (mCallback)
@ -401,10 +404,7 @@ nsURLFetcher::OnStateChange(nsIWebProgress *aProgress, nsIRequest *aRequest,
// the url....
if (NS_FAILED(aStatus))
{
nsCOMPtr<nsIChannel> channel (do_QueryInterface(aRequest));
OnStopRequest(channel, nsnull, aStatus, nsnull);
}
OnStopRequest(aRequest, nsnull, aStatus, nsnull);
return NS_OK;
}

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

@ -101,7 +101,7 @@ nsURLFetcher::StillRunning(PRBool *running)
* @return The return value is currently ignored.
*/
nsresult
nsURLFetcher::OnDataAvailable(nsIChannel * aChannel, nsISupports * ctxt, nsIInputStream *aIStream,
nsURLFetcher::OnDataAvailable(nsIRequest *request, nsISupports * ctxt, nsIInputStream *aIStream,
PRUint32 sourceOffset, PRUint32 aLength)
{
nsresult rc = NS_OK;
@ -135,7 +135,7 @@ nsURLFetcher::OnDataAvailable(nsIChannel * aChannel, nsISupports * ctxt, nsIInpu
* used to cancel the URL load..
*/
nsresult
nsURLFetcher::OnStartRequest(nsIChannel * aChannel, nsISupports * ctxt)
nsURLFetcher::OnStartRequest(nsIRequest *request, nsISupports * ctxt)
{
return NS_OK;
}
@ -152,7 +152,7 @@ nsURLFetcher::OnStartRequest(nsIChannel * aChannel, nsISupports * ctxt)
* @return The return value is currently ignored.
*/
nsresult
nsURLFetcher::OnStopRequest(nsIChannel * /* aChannel */, nsISupports * /* ctxt */, nsresult aStatus, const PRUnichar* aMsg)
nsURLFetcher::OnStopRequest(nsIRequest *request, nsISupports * /* ctxt */, nsresult aStatus, const PRUnichar* aMsg)
{
#ifdef NS_DEBUG_rhp
printf("nsURLFetcher::OnStopRequest()\n");
@ -197,8 +197,8 @@ nsURLFetcher::FireURLRequest(nsIURI *aURL, nsOutputFileStream *fOut,
nsCOMPtr<nsIChannel> channel;
rv = service->NewChannelFromURI(aURL, getter_AddRefs(channel));
if (NS_FAILED(rv)) return rv;
rv = channel->AsyncRead(this, nsnull);
nsCOMPtr<nsIRequest> request;
rv = channel->AsyncRead(this, nsnull, 0, -1, getter_AddRefs(request));
if (NS_FAILED(rv)) return rv;
mURL = dont_QueryInterface(aURL);

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

@ -63,7 +63,7 @@ public:
* @param length The amount of data that was just pushed into the stream.
* @return The return value is currently ignored.
*/
NS_IMETHOD OnDataAvailable(nsIChannel * aChannel, nsISupports * ctxt, nsIInputStream *aIStream,
NS_IMETHOD OnDataAvailable(nsIRequest *request, nsISupports * ctxt, nsIInputStream *aIStream,
PRUint32 sourceOffset, PRUint32 aLength);
@ -75,7 +75,7 @@ public:
* @return The return value is currently ignored. In the future it may be
* used to cancel the URL load..
*/
NS_IMETHOD OnStartRequest(nsIChannel * aChannel, nsISupports * aCtxt);
NS_IMETHOD OnStartRequest(nsIRequest *request, nsISupports * aCtxt);
/**
* Notify the observer that the URL has finished loading. This method is
@ -88,7 +88,7 @@ public:
* @param msg A text string describing the error.
* @return The return value is currently ignored.
*/
NS_IMETHOD OnStopRequest(nsIChannel * /* aChannel */, nsISupports * /* ctxt */, nsresult aStatus, const PRUnichar* aMsg);
NS_IMETHOD OnStopRequest(nsIRequest *request, nsISupports * /* ctxt */, nsresult aStatus, const PRUnichar* aMsg);

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

@ -476,7 +476,10 @@ nsImapIncomingServer::LoadNextQueuedUrl(PRBool *aResult)
if (NS_SUCCEEDED(aImapUrl->GetMockChannel(getter_AddRefs(mockChannel))) && mockChannel)
{
mockChannel->GetStatus(&rv);
nsCOMPtr<nsIRequest> request = do_QueryInterface(mockChannel);
if (!request)
return NS_ERROR_FAILURE;
request->GetStatus(&rv);
if (!NS_SUCCEEDED(rv))
{
nsresult res;

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

@ -913,7 +913,7 @@ NS_IMETHODIMP nsImapMailFolder::EmptyTrash(nsIMsgWindow *msgWindow,
if (empytingOnExit)
{
nsCOMPtr<nsIImapIncomingServer> imapServer;
nsresult rv = GetImapIncomingServer(getter_AddRefs(imapServer));
rv = GetImapIncomingServer(getter_AddRefs(imapServer));
if (NS_SUCCEEDED(rv) && imapServer)
{
@ -3389,18 +3389,18 @@ nsImapMailFolder::SetContentModified(nsIImapUrl *aImapUrl, nsImapContentModified
// to hook up the mock channel and other stuff when downloading messages for offline use.
// But we don't really need to do anything with these notifications because we use
// the nsIImapMesageSink interfaces ParseAdoptedMessageLine and NormalEndMsgWriteStream
NS_IMETHODIMP nsImapMailFolder::OnDataAvailable(nsIChannel * /* aChannel */, nsISupports *ctxt, nsIInputStream *aIStream, PRUint32 sourceOffset, PRUint32 aLength)
NS_IMETHODIMP nsImapMailFolder::OnDataAvailable(nsIRequest * /* request */, nsISupports *ctxt, nsIInputStream *aIStream, PRUint32 sourceOffset, PRUint32 aLength)
{
nsresult rv = NS_OK;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::OnStartRequest(nsIChannel * aChannel, nsISupports *ctxt)
NS_IMETHODIMP nsImapMailFolder::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
{
return NS_OK;
}
NS_IMETHODIMP nsImapMailFolder::OnStopRequest(nsIChannel * aChannel, nsISupports *ctxt, nsresult aStatus, const PRUnichar *aMsg)
NS_IMETHODIMP nsImapMailFolder::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult aStatus, const PRUnichar *aMsg)
{
return NS_OK;
}
@ -3951,7 +3951,9 @@ nsresult nsImapMailFolder::DisplayStatusMsg(nsIImapUrl *aImapUrl, const PRUnicha
mockChannel->GetProgressEventSink(getter_AddRefs(progressSink));
if (progressSink)
{
progressSink->OnStatus(mockChannel, nsnull, NS_OK, msg); // XXX i18n message
nsCOMPtr<nsIRequest> request = do_QueryInterface(mockChannel);
if (!request) return NS_ERROR_FAILURE;
progressSink->OnStatus(request, nsnull, NS_OK, msg); // XXX i18n message
}
}
return NS_OK;
@ -4014,9 +4016,12 @@ nsImapMailFolder::PercentProgress(nsIImapProtocol* aProtocol,
mockChannel->GetProgressEventSink(getter_AddRefs(progressSink));
if (progressSink)
{
progressSink->OnProgress(mockChannel, nsnull, aInfo->currentProgress, aInfo->maxProgress);
nsCOMPtr<nsIRequest> request = do_QueryInterface(mockChannel);
if (!request) return NS_ERROR_FAILURE;
progressSink->OnProgress(request, nsnull, aInfo->currentProgress, aInfo->maxProgress);
if (aInfo->message)
progressSink->OnStatus(mockChannel, nsnull, NS_OK, aInfo->message); // XXX i18n message
progressSink->OnStatus(request, nsnull, NS_OK, aInfo->message); // XXX i18n message
}

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

@ -600,7 +600,7 @@ nsresult nsImapProtocol::SetupWithUrl(nsIURI * aURL, nsISupports* aConsumer)
rv = socketService->CreateTransportOfType(connectionType, hostName, port, nsnull, -1, 0, 0, getter_AddRefs(m_channel));
if (NS_SUCCEEDED(rv))
rv = m_channel->OpenOutputStream(getter_AddRefs(m_outputStream));
rv = m_channel->OpenOutputStream(0, -1, getter_AddRefs(m_outputStream));
}
} // if m_runningUrl
@ -997,7 +997,8 @@ PRBool nsImapProtocol::ProcessCurrentURL()
if (!TestFlag(IMAP_CONNECTION_IS_OPEN) && m_channel)
{
m_channel->AsyncRead(this /* stream observer */, nsnull);
nsCOMPtr<nsIRequest> request;
m_channel->AsyncRead(this /* stream observer */, nsnull, 0, -1, getter_AddRefs(request));
SetFlag(IMAP_CONNECTION_IS_OPEN);
}
#ifdef DEBUG_bienvenu
@ -1029,9 +1030,10 @@ PRBool nsImapProtocol::ProcessCurrentURL()
// if we are set up as a channel, we should notify our channel listener that we are starting...
// so pass in ourself as the channel and not the underlying socket or file channel the protocol
// happens to be using
if (m_channelListener)
m_channelListener->OnStartRequest(m_mockChannel, m_channelContext);
if (m_channelListener) {
nsCOMPtr<nsIRequest> request = do_QueryInterface(m_mockChannel);
m_channelListener->OnStartRequest(request, m_channelContext);
}
// mscott - I believe whenever we get here that we will also have
// a connection. Why? Because when we load the url we open the
// connection if it isn't open already....However, if we haven't received
@ -1116,9 +1118,13 @@ PRBool nsImapProtocol::ProcessCurrentURL()
// if we are set up as a channel, we should notify our channel listener that we are starting...
// so pass in ourself as the channel and not the underlying socket or file channel the protocol
// happens to be using
if (m_channelListener)
rv = m_channelListener->OnStopRequest(m_mockChannel, m_channelContext, NS_OK, nsnull);
if (m_channelListener)
{
nsCOMPtr<nsIRequest> request = do_QueryInterface(m_mockChannel);
if (!request) return NS_ERROR_FAILURE;
rv = m_channelListener->OnStopRequest(request, m_channelContext, NS_OK, nsnull);
}
m_lastActiveTime = PR_Now(); // ** jt -- is this the best place for time stamp
SetFlag(IMAP_CLEAN_UP_URL_STATE);
if (NS_SUCCEEDED(rv) && GetConnectionStatus() >= 0 && GetServerStateParser().LastCommandSuccessful()
@ -1182,7 +1188,7 @@ void nsImapProtocol::ParseIMAPandCheckForNewMail(const char* commandString, PRBo
/////////////////////////////////////////////////////////////////////////////////////////////
// we suppport the nsIStreamListener interface
////////////////////////////////////////////////////////////////////////////////////////////
NS_IMETHODIMP nsImapProtocol::OnDataAvailable(nsIChannel * /* aChannel */, nsISupports *ctxt, nsIInputStream *aIStream, PRUint32 aSourceOffset, PRUint32 aLength)
NS_IMETHODIMP nsImapProtocol::OnDataAvailable(nsIRequest *request, nsISupports *ctxt, nsIInputStream *aIStream, PRUint32 aSourceOffset, PRUint32 aLength)
{
nsresult res = NS_OK;
@ -1206,7 +1212,7 @@ NS_IMETHODIMP nsImapProtocol::OnDataAvailable(nsIChannel * /* aChannel */, nsISu
return res;
}
NS_IMETHODIMP nsImapProtocol::OnStartRequest(nsIChannel * /* aChannel */, nsISupports *ctxt)
NS_IMETHODIMP nsImapProtocol::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
{
// we used to change the url state here......but OnStartRequest only gets called
// once....when the connnection is first build from necko...So we'll set the url
@ -1223,7 +1229,7 @@ NS_IMETHODIMP nsImapProtocol::OnStartRequest(nsIChannel * /* aChannel */, nsISup
}
// stop binding is a "notification" informing us that the stream associated with aURL is going away.
NS_IMETHODIMP nsImapProtocol::OnStopRequest(nsIChannel * /* aChannel */, nsISupports *ctxt, nsresult aStatus, const PRUnichar* aMsg)
NS_IMETHODIMP nsImapProtocol::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult aStatus, const PRUnichar* aMsg)
{
PRBool killThread = PR_FALSE;
@ -2799,8 +2805,11 @@ nsImapProtocol::PostLineDownLoadEvent(msg_line_info *downloadLineDontDelete)
{
nsresult rv = m_channelOutputStream->Write(line, PL_strlen(line), &count);
if (NS_SUCCEEDED(rv))
m_channelListener->OnDataAvailable(m_mockChannel, m_channelContext, m_channelInputStream, 0, count);
// here is where we should echo the line to the local folder copy of an online message
{
nsCOMPtr<nsIRequest> request = do_QueryInterface(m_mockChannel);
m_channelListener->OnDataAvailable(request, m_channelContext, m_channelInputStream, 0, count);
}
// here is where we should echo the line to the local folder copy of an online message
}
if (m_imapMessageSink)
m_imapMessageSink->GetNotifyDownloadedLines(&echoLineToMessageSink);
@ -3488,8 +3497,11 @@ PRBool nsImapProtocol::DeathSignalReceived()
// ignore mock channel status if we've been pseudo interrupted
// ### need to make sure we clear pseudo interrupted status appropriately.
if (!GetPseudoInterrupted() && m_mockChannel)
m_mockChannel->GetStatus(&returnValue);
{
nsCOMPtr<nsIRequest> request = do_QueryInterface(m_mockChannel);
if (request)
request->GetStatus(&returnValue);
}
if (NS_SUCCEEDED(returnValue)) // check the other way of cancelling.
{
PR_EnterMonitor(m_threadDeathMonitor);
@ -6687,23 +6699,23 @@ nsresult nsImapCacheStreamListener::Init(nsIStreamListener * aStreamListener, ns
}
NS_IMETHODIMP
nsImapCacheStreamListener::OnStartRequest(nsIChannel * aChannel, nsISupports * aCtxt)
nsImapCacheStreamListener::OnStartRequest(nsIRequest *request, nsISupports * aCtxt)
{
nsCOMPtr <nsILoadGroup> loadGroup;
mChannelToUse->GetLoadGroup(getter_AddRefs(loadGroup));
if (loadGroup)
loadGroup->AddChannel(mChannelToUse, nsnull /* context isupports */);
return mListener->OnStartRequest(mChannelToUse, aCtxt);
loadGroup->AddRequest(request, nsnull /* context isupports */);
return mListener->OnStartRequest(request, aCtxt);
}
NS_IMETHODIMP
nsImapCacheStreamListener::OnStopRequest(nsIChannel * aChannel, nsISupports * aCtxt, nsresult aStatus, const PRUnichar* aMsg)
nsImapCacheStreamListener::OnStopRequest(nsIRequest *request, nsISupports * aCtxt, nsresult aStatus, const PRUnichar* aMsg)
{
nsresult rv = mListener->OnStopRequest(mChannelToUse, aCtxt, aStatus, aMsg);
nsresult rv = mListener->OnStopRequest(request, aCtxt, aStatus, aMsg);
nsCOMPtr <nsILoadGroup> loadGroup;
mChannelToUse->GetLoadGroup(getter_AddRefs(loadGroup));
if (loadGroup)
loadGroup->RemoveChannel(mChannelToUse, nsnull, aStatus, nsnull);
loadGroup->RemoveRequest(request, nsnull, aStatus, nsnull);
mListener = nsnull;
mChannelToUse = nsnull;
@ -6711,9 +6723,9 @@ nsImapCacheStreamListener::OnStopRequest(nsIChannel * aChannel, nsISupports * aC
}
NS_IMETHODIMP
nsImapCacheStreamListener::OnDataAvailable(nsIChannel * aChannel, nsISupports * aCtxt, nsIInputStream * aInStream, PRUint32 aSourceOffset, PRUint32 aCount)
nsImapCacheStreamListener::OnDataAvailable(nsIRequest *request, nsISupports * aCtxt, nsIInputStream * aInStream, PRUint32 aSourceOffset, PRUint32 aCount)
{
return mListener->OnDataAvailable(mChannelToUse, aCtxt, aInStream, aSourceOffset, aCount);
return mListener->OnDataAvailable(request, aCtxt, aInStream, aSourceOffset, aCount);
}
NS_IMPL_THREADSAFE_ADDREF(nsImapMockChannel)
@ -6833,19 +6845,20 @@ NS_IMETHODIMP nsImapMockChannel::SetURI(nsIURI* aURI)
return NS_OK;
}
NS_IMETHODIMP nsImapMockChannel::OpenInputStream(nsIInputStream **_retval)
NS_IMETHODIMP nsImapMockChannel::OpenInputStream(PRUint32 transferOffset, PRUint32 transferCount, nsIInputStream **_retval)
{
NS_NOTREACHED("nsImapMockChannel::OpenInputStream");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsImapMockChannel::OpenOutputStream(nsIOutputStream **_retval)
NS_IMETHODIMP nsImapMockChannel::OpenOutputStream(PRUint32 transferOffset, PRUint32 transferCount, nsIOutputStream **_retval)
{
NS_NOTREACHED("nsImapMockChannel::OpenOutputStream");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsImapMockChannel::AsyncRead(nsIStreamListener *listener, nsISupports *ctxt)
NS_IMETHODIMP nsImapMockChannel::AsyncRead(nsIStreamListener *listener, nsISupports *ctxt,
PRUint32 transferOffset, PRUint32 transferCount, nsIRequest **_retval)
{
nsCOMPtr<nsICachedNetData> cacheEntry;
PRUint32 contentLength = 0;
@ -6925,7 +6938,8 @@ NS_IMETHODIMP nsImapMockChannel::AsyncRead(nsIStreamListener *listener, nsISuppo
nsImapCacheStreamListener * cacheListener = new nsImapCacheStreamListener();
NS_ADDREF(cacheListener);
cacheListener->Init(m_channelListener, NS_STATIC_CAST(nsIChannel *, this));
rv = cacheChannel->AsyncRead(cacheListener, m_channelContext);
nsCOMPtr<nsIRequest> request;
rv = cacheChannel->AsyncRead(cacheListener, m_channelContext, 0, -1, getter_AddRefs(request));
NS_RELEASE(cacheListener);
if (NS_SUCCEEDED(rv)) // ONLY if we succeeded in actually starting the read should we return
@ -6937,7 +6951,7 @@ NS_IMETHODIMP nsImapMockChannel::AsyncRead(nsIStreamListener *listener, nsISuppo
nsCOMPtr<nsISupports> securityInfo;
cacheEntry->GetSecurityInfo(getter_AddRefs(securityInfo));
SetSecurityInfo(securityInfo);
NS_ADDREF(*_retval = (nsIRequest*)this);
return rv;
}
}
@ -6958,7 +6972,8 @@ NS_IMETHODIMP nsImapMockChannel::AsyncRead(nsIStreamListener *listener, nsISuppo
// we want to create a file channel and read the msg from there.
nsCOMPtr<nsIFileChannel> fileChannel;
nsMsgKey msgKey = atoi(messageIdString);
rv = folder->GetOfflineFileChannel(msgKey, getter_AddRefs(fileChannel));
PRUint32 size, offset;
rv = folder->GetOfflineFileChannel(msgKey, &offset, &size, getter_AddRefs(fileChannel));
// get the file channel from the folder, somehow (through the message or
// folder sink?) We also need to set the transfer offset to the message offset
if (fileChannel && NS_SUCCEEDED(rv))
@ -6972,7 +6987,8 @@ NS_IMETHODIMP nsImapMockChannel::AsyncRead(nsIStreamListener *listener, nsISuppo
nsImapCacheStreamListener * cacheListener = new nsImapCacheStreamListener();
NS_ADDREF(cacheListener);
cacheListener->Init(m_channelListener, NS_STATIC_CAST(nsIChannel *, this));
rv = fileChannel->AsyncRead(cacheListener, m_channelContext);
nsCOMPtr<nsIRequest> request;
rv = fileChannel->AsyncRead(cacheListener, m_channelContext, offset, size, getter_AddRefs(request));
NS_RELEASE(cacheListener);
if (NS_SUCCEEDED(rv)) // ONLY if we succeeded in actually starting the read should we return
@ -6980,6 +6996,7 @@ NS_IMETHODIMP nsImapMockChannel::AsyncRead(nsIStreamListener *listener, nsISuppo
// if the msg is unread, we should mark it read on the server. This lets
// the code running this url we're loading from the cache, if it cares.
imapUrl->SetMsgLoadingFromCache(PR_TRUE);
NS_ADDREF(*_retval = (nsIRequest*)this);
return rv;
}
}
@ -7005,10 +7022,13 @@ NS_IMETHODIMP nsImapMockChannel::AsyncRead(nsIStreamListener *listener, nsISuppo
rv = pEventQService->GetThreadEventQueue(NS_CURRENT_THREAD, getter_AddRefs(queue));
if (NS_FAILED(rv)) return rv;
rv = imapServer->GetImapConnectionAndLoadUrl(queue, imapUrl, nsnull);
if(NS_SUCCEEDED(rv))
NS_ADDREF(*_retval = (nsIRequest*)this);
return rv;
}
NS_IMETHODIMP nsImapMockChannel::AsyncWrite(nsIStreamProvider *provider, nsISupports *ctxt)
NS_IMETHODIMP nsImapMockChannel::AsyncWrite(nsIInputStream *fromStream, nsIStreamObserver *observer, nsISupports *ctxt,
PRUint32 transferOffset, PRUint32 transferCount, nsIRequest **_retval)
{
NS_NOTREACHED("nsImapMockChannel::AsyncWrite");
return NS_ERROR_NOT_IMPLEMENTED;
@ -7055,83 +7075,6 @@ nsImapMockChannel::SetContentLength(PRInt32 aContentLength)
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsImapMockChannel::GetTransferOffset(PRUint32 *aTransferOffset)
{
NS_NOTREACHED("nsImapMockChannel::GetTransferOffset");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsImapMockChannel::SetTransferOffset(PRUint32 aTransferOffset)
{
NS_NOTREACHED("nsImapMockChannel::SetTransferOffset");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsImapMockChannel::GetTransferCount(PRInt32 *aTransferCount)
{
NS_NOTREACHED("nsImapMockChannel::GetTransferCount");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsImapMockChannel::SetTransferCount(PRInt32 aTransferCount)
{
NS_NOTREACHED("nsImapMockChannel::SetTransferCount");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsImapMockChannel::GetBufferSegmentSize(PRUint32 *aBufferSegmentSize)
{
NS_NOTREACHED("nsImapMockChannel::GetBufferSegmentSize");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsImapMockChannel::SetBufferSegmentSize(PRUint32 aBufferSegmentSize)
{
NS_NOTREACHED("nsImapMockChannel::SetBufferSegmentSize");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsImapMockChannel::GetBufferMaxSize(PRUint32 *aBufferMaxSize)
{
NS_NOTREACHED("nsImapMockChannel::GetBufferMaxSize");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsImapMockChannel::SetBufferMaxSize(PRUint32 aBufferMaxSize)
{
NS_NOTREACHED("nsImapMockChannel::SetBufferMaxSize");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsImapMockChannel::GetLocalFile(nsIFile* *file)
{
NS_NOTREACHED("GetLocalFile");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsImapMockChannel::GetPipeliningAllowed(PRBool *aPipeliningAllowed)
{
*aPipeliningAllowed = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP
nsImapMockChannel::SetPipeliningAllowed(PRBool aPipeliningAllowed)
{
NS_NOTREACHED("SetPipeliningAllowed");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsImapMockChannel::GetOwner(nsISupports * *aPrincipal)
{
*aPrincipal = mOwner;
@ -7185,6 +7128,18 @@ NS_IMETHODIMP nsImapMockChannel::Resume()
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute nsISupports parent; */
NS_IMETHODIMP nsImapMockChannel::GetParent(nsISupports * *aParent)
{
NS_ADDREF(*aParent=(nsISupports*)(nsIChannel*)this);
return NS_OK;
}
NS_IMETHODIMP nsImapMockChannel::SetParent(nsISupports * aParent)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsImapMockChannel::GetNotificationCallbacks(nsIInterfaceRequestor* *aNotificationCallbacks)
{

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

@ -62,6 +62,7 @@
#include "nsXPIDLString.h"
#include "nsIMsgWindow.h"
#include "nsIMsgLogonRedirector.h"
#include "nsIStreamContentInfo.h"
class nsIMAPMessagePartIDArray;
class nsIMsgIncomingServer;
@ -576,7 +577,7 @@ private:
//
// Threading concern: This class lives entirely in the UI thread.
class nsImapMockChannel : public nsIImapMockChannel
class nsImapMockChannel : public nsIImapMockChannel, public nsIRequest, public nsIStreamContentInfo
{
public:
@ -584,6 +585,7 @@ public:
NS_DECL_NSIIMAPMOCKCHANNEL
NS_DECL_NSICHANNEL
NS_DECL_NSIREQUEST
NS_DECL_NSISTREAMCONTENTINFO
nsImapMockChannel();
virtual ~nsImapMockChannel();

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

@ -671,8 +671,9 @@ nsresult nsImapService::FetchMimePart(nsIImapUrl * aImapUrl,
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsISupports> aCtxt = do_QueryInterface(url);
// now try to open the channel passing in our display consumer as the listener
rv = aChannel->AsyncRead(aStreamListener, aCtxt);
// now try to open the channel passing in our display consumer as the listener
nsCOMPtr<nsIRequest> request;
rv = aChannel->AsyncRead(aStreamListener, aCtxt, 0, -1, getter_AddRefs(request));
}
else // do what we used to do before
{
@ -1035,7 +1036,8 @@ nsImapService::FetchMessage(nsIImapUrl * aImapUrl,
nsCOMPtr<nsISupports> aCtxt = do_QueryInterface(url);
// now try to open the channel passing in our display consumer as the listener
rv = aChannel->AsyncRead(aStreamListener, aCtxt);
nsCOMPtr<nsIRequest> request;
rv = aChannel->AsyncRead(aStreamListener, aCtxt, 0, -1, getter_AddRefs(request));
}
else // do what we used to do before
{

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

@ -1123,7 +1123,8 @@ NS_IMETHODIMP nsImapUrl::AddChannelToLoadGroup()
if (loadGroup)
{
loadGroup->AddChannel(m_mockChannel, nsnull /* context isupports */);
nsCOMPtr<nsIRequest> request = do_QueryInterface(m_mockChannel);
loadGroup->AddRequest(request, nsnull /* context isupports */);
}
}
return NS_OK;
@ -1141,7 +1142,8 @@ NS_IMETHODIMP nsImapUrl::RemoveChannel(nsresult status)
GetLoadGroup(getter_AddRefs(loadGroup));
if (loadGroup)
{
loadGroup->RemoveChannel(m_mockChannel, nsnull, status, nsnull);
nsCOMPtr<nsIRequest> request = do_QueryInterface(m_mockChannel);
loadGroup->RemoveRequest(request, nsnull, status, nsnull);
}
// break deadly embrace between mock channel and url
SetMockChannel(nsnull);

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

@ -35,6 +35,7 @@
#include "nsIMessage.h"
#include "nsMsgDBCID.h"
#include "nsIMsgMailNewsUrl.h"
#include "nsIStreamContentInfo.h"
//#include "allxpstr.h"
#include "prtime.h"
@ -82,11 +83,14 @@ NS_IMETHODIMP nsMailboxProtocol::GetContentLength(PRInt32 * aContentLength)
{
// our file transport knows the entire length of the berkley mail folder
// so get it from there.
if (m_channel)
return m_channel->GetContentLength(aContentLength);
else
if (!m_request)
return NS_OK;
nsCOMPtr<nsIStreamContentInfo> info = do_QueryInterface(m_request);
if (info)
info->GetContentLength(aContentLength);
return NS_OK;
}
else if (m_runningUrl)
{
@ -144,7 +148,7 @@ void nsMailboxProtocol::Initialize(nsIURI * aURL)
// we suppport the nsIStreamListener interface
////////////////////////////////////////////////////////////////////////////////////////////
NS_IMETHODIMP nsMailboxProtocol::OnStartRequest(nsIChannel * aChannel, nsISupports *ctxt)
NS_IMETHODIMP nsMailboxProtocol::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
{
// extract the appropriate event sinks from the url and initialize them in our protocol data
// the URL should be queried for a nsINewsURL. If it doesn't support a news URL interface then
@ -152,19 +156,19 @@ NS_IMETHODIMP nsMailboxProtocol::OnStartRequest(nsIChannel * aChannel, nsISuppor
if (m_nextState == MAILBOX_READ_FOLDER && m_mailboxParser)
{
// we need to inform our mailbox parser that it's time to start...
m_mailboxParser->OnStartRequest(aChannel, ctxt);
m_mailboxParser->OnStartRequest(request, ctxt);
}
return nsMsgProtocol::OnStartRequest(aChannel, ctxt);
return nsMsgProtocol::OnStartRequest(request, ctxt);
}
// stop binding is a "notification" informing us that the stream associated with aURL is going away.
NS_IMETHODIMP nsMailboxProtocol::OnStopRequest(nsIChannel * aChannel, nsISupports *ctxt, nsresult aStatus, const PRUnichar *aMsg)
NS_IMETHODIMP nsMailboxProtocol::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult aStatus, const PRUnichar *aMsg)
{
if (m_nextState == MAILBOX_READ_FOLDER && m_mailboxParser)
{
// we need to inform our mailbox parser that there is no more incoming data...
m_mailboxParser->OnStopRequest(aChannel, ctxt, aStatus, nsnull);
m_mailboxParser->OnStopRequest(request, ctxt, aStatus, nsnull);
}
else if (m_nextState == MAILBOX_READ_MESSAGE)
{
@ -196,7 +200,7 @@ NS_IMETHODIMP nsMailboxProtocol::OnStopRequest(nsIChannel * aChannel, nsISupport
*/
if (aStatus == NS_BINDING_ABORTED)
aStatus = NS_OK;
nsMsgProtocol::OnStopRequest(aChannel, ctxt, aStatus, aMsg);
nsMsgProtocol::OnStopRequest(request, ctxt, aStatus, aMsg);
return CloseSocket();
}
@ -479,8 +483,8 @@ nsresult nsMailboxProtocol::ProcessProtocolState(nsIURI * url, nsIInputStream *
case MAILBOX_DONE:
case MAILBOX_ERROR_DONE:
{
nsCOMPtr <nsIMsgMailNewsUrl> url = do_QueryInterface(m_runningUrl);
url->SetUrlState(PR_FALSE, m_nextState == MAILBOX_DONE ?
nsCOMPtr <nsIMsgMailNewsUrl> anotherUrl = do_QueryInterface(m_runningUrl);
anotherUrl->SetUrlState(PR_FALSE, m_nextState == MAILBOX_DONE ?
NS_OK : NS_ERROR_FAILURE);
m_nextState = MAILBOX_FREE;
}

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

@ -76,8 +76,8 @@ public:
// we suppport the nsIStreamListener interface
////////////////////////////////////////////////////////////////////////////////////////
NS_IMETHOD OnStartRequest(nsIChannel * aChannel, nsISupports *ctxt);
NS_IMETHOD OnStopRequest(nsIChannel * aChannel, nsISupports *ctxt, nsresult aStatus, const PRUnichar *aMsg);
NS_IMETHOD OnStartRequest(nsIRequest *request, nsISupports *ctxt);
NS_IMETHOD OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult aStatus, const PRUnichar *aMsg);
NS_IMETHOD GetContentLength(PRInt32 * aContentLength);
private:
@ -127,3 +127,9 @@ private:
};
#endif // nsMailboxProtocol_h___

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

@ -62,7 +62,7 @@ NS_IMPL_ISUPPORTS_INHERITED(nsMsgMailboxParser, nsParseMailMessageState, nsIStre
// Whenever data arrives from the connection, core netlib notifices the protocol by calling
// OnDataAvailable. We then read and process the incoming data from the input stream.
NS_IMETHODIMP nsMsgMailboxParser::OnDataAvailable(nsIChannel * /* aChannel */, nsISupports *ctxt, nsIInputStream *aIStream, PRUint32 sourceOffset,
NS_IMETHODIMP nsMsgMailboxParser::OnDataAvailable(nsIRequest *request, nsISupports *ctxt, nsIInputStream *aIStream, PRUint32 sourceOffset,
PRUint32 aLength)
{
// right now, this really just means turn around and process the url
@ -73,7 +73,7 @@ NS_IMETHODIMP nsMsgMailboxParser::OnDataAvailable(nsIChannel * /* aChannel */, n
return rv;
}
NS_IMETHODIMP nsMsgMailboxParser::OnStartRequest(nsIChannel * /* aChannel */, nsISupports *ctxt)
NS_IMETHODIMP nsMsgMailboxParser::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
{
nsTime currentTime;
m_startTime = currentTime;
@ -143,7 +143,7 @@ NS_IMETHODIMP nsMsgMailboxParser::OnStartRequest(nsIChannel * /* aChannel */, ns
}
// stop binding is a "notification" informing us that the stream associated with aURL is going away.
NS_IMETHODIMP nsMsgMailboxParser::OnStopRequest(nsIChannel * /* aChannel */, nsISupports *ctxt, nsresult aStatus, const PRUnichar *aMsg)
NS_IMETHODIMP nsMsgMailboxParser::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult aStatus, const PRUnichar *aMsg)
{
DoneParsingFolder(aStatus);
// what can we do? we can close the stream?

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

@ -567,9 +567,9 @@ nsresult nsPop3Protocol::GetPassword(char ** aPassword, PRBool *okayValue)
}
// stop binding is a "notification" informing us that the stream associated with aURL is going away.
NS_IMETHODIMP nsPop3Protocol::OnStopRequest(nsIChannel * aChannel, nsISupports * aContext, nsresult aStatus, const PRUnichar* aMsg)
NS_IMETHODIMP nsPop3Protocol::OnStopRequest(nsIRequest *request, nsISupports * aContext, nsresult aStatus, const PRUnichar* aMsg)
{
nsresult rv = nsMsgProtocol::OnStopRequest(aChannel, aContext, aStatus, aMsg);
nsresult rv = nsMsgProtocol::OnStopRequest(request, aContext, aStatus, aMsg);
// turn off the server busy flag on stop request - we know we're done, right?
if (m_pop3Server)
{

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

@ -258,7 +258,7 @@ public:
nsresult GetPassword(char ** aPassword, PRBool *okayValue);
NS_IMETHOD OnStopRequest(nsIChannel * aChannel, nsISupports * aContext, nsresult aStatus, const PRUnichar* aMsg);
NS_IMETHOD OnStopRequest(nsIRequest *request, nsISupports * aContext, nsresult aStatus, const PRUnichar* aMsg);
NS_IMETHOD Cancel(nsresult status);
// for nsMsgLineBuffer
virtual PRInt32 HandleLine(char *line, PRUint32 line_length);

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

@ -45,6 +45,7 @@
#include "nsIMimeConverter.h"
#include "nsMsgMimeCID.h"
#include "prlog.h"
#include "nsIStreamContentInfo.h"
static PRLogModuleInfo * gMimeEmitterLogModule = nsnull;
@ -268,7 +269,9 @@ NS_IMETHODIMP nsMimeBaseEmitter::OnFull(nsIOutputStream* out)
PRUint32 bytesAvailable = 0;
rv = mInputStream->Available(&bytesAvailable);
NS_ASSERTION(NS_SUCCEEDED(rv), "Available failed");
rv = mOutListener->OnDataAvailable(mChannel, mURL, mInputStream, 0, bytesAvailable);
// DOUGT - where did the request come from??!
rv = mOutListener->OnDataAvailable(/*mChannel*/nsnull, mURL, mInputStream, 0, bytesAvailable);
}
else
rv = NS_ERROR_NULL_POINTER;
@ -519,7 +522,12 @@ nsMimeBaseEmitter::UpdateCharacterSet(const char *aCharset)
{
char *contentType = nsnull;
if (NS_SUCCEEDED(mChannel->GetContentType(&contentType)) && contentType)
// check if the channel supports direct content info
nsCOMPtr<nsIStreamContentInfo> contentInfo = do_QueryInterface(mChannel);
if (!contentInfo)
return NS_ERROR_FAILURE;
if (NS_SUCCEEDED(contentInfo->GetContentType(&contentType)) && contentType)
{
char *cPtr = (char *) PL_strcasestr(contentType, "charset=");
@ -544,7 +552,7 @@ nsMimeBaseEmitter::UpdateCharacterSet(const char *aCharset)
char *newContentType = (char *) PR_smprintf("%s; charset=%s", contentType, aCharset);
if (newContentType)
{
mChannel->SetContentType(newContentType);
contentInfo->SetContentType(newContentType);
PR_FREEIF(newContentType);
}
@ -850,7 +858,8 @@ nsMimeBaseEmitter::Complete()
PRUint32 bytesInStream;
nsresult rv2 = mInputStream->Available(&bytesInStream);
NS_ASSERTION(NS_SUCCEEDED(rv2), "Available failed");
rv2 = mOutListener->OnDataAvailable(mChannel, mURL, mInputStream, 0, bytesInStream);
// DOUGT - where did the request come from??!
rv2 = mOutListener->OnDataAvailable(/*mChannel*/nsnull, mURL, mInputStream, 0, bytesInStream);
NS_ASSERTION(NS_SUCCEEDED(rv2), "OnDataAvailable failed");
}

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

@ -28,6 +28,7 @@
#include "nsMimeTypes.h"
#include "nsMimeStringResources.h"
#include "nsCRT.h"
#include "nsIStreamContentInfo.h"
#define MIME_SUPERCLASS mimeLeafClass
MimeDefClass(MimeInlineImage, MimeInlineImageClass,
@ -135,7 +136,10 @@ MimeInlineImage_parse_begin (MimeObject *obj)
mime_stream_data *msd = (mime_stream_data *) (obj->options->stream_closure);
if ( (msd) && (msd->channel) )
{
msd->channel->SetContentType(obj->content_type);
// check to see if the channel allows this
nsCOMPtr<nsIStreamContentInfo> contentInfo = do_QueryInterface(msd->channel);
if (contentInfo)
contentInfo->SetContentType(obj->content_type);
}
}

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

@ -59,7 +59,7 @@
#include "nsICharsetConverterManager.h"
#include "nsICharsetAlias.h"
#include "nsMimeTypes.h"
#include "nsIStreamContentInfo.h"
#include "nsIIOService.h"
#include "nsIURI.h"
#include "nsIMsgWindow.h"
@ -1897,8 +1897,10 @@ ResetChannelCharset(MimeObject *obj)
char *ptr = PL_strstr(ct, "charset=");
if (ptr)
{
// First, setup the channel!
msd->channel->SetContentType(ct);
// check to see if the channel allows this
nsCOMPtr<nsIStreamContentInfo> contentInfo = do_QueryInterface(msd->channel);
if (contentInfo)
contentInfo->SetContentType(obj->content_type);
// Second, if this is a Save As operation, then we need to convert
// to override the output charset!

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

@ -48,7 +48,8 @@
#include "nsNetUtil.h"
#include "mozITXTToHTMLConv.h"
#include "nsIMsgMailNewsUrl.h"
#include "nsStreamConverter.h"
#include "nsIStreamContentInfo.h"
#define PREF_MAIL_DISPLAY_GLYPH "mail.display_glyph"
#define PREF_MAIL_DISPLAY_STRUCT "mail.display_struct"
@ -596,7 +597,11 @@ NS_IMETHODIMP nsStreamConverter::Init(nsIURI *aURI, nsIStreamListener * aOutList
GetContentType(getter_Copies(contentTypeToUse));
// mscott --> my theory is that we don't need this fake outgoing channel. Let's use the
// original channel and just set our content type ontop of the original channel...
aChannel->SetContentType(contentTypeToUse);
// check to see if the channel allows this
nsCOMPtr<nsIStreamContentInfo> contentInfo = do_QueryInterface(aChannel);
if (contentInfo)
contentInfo->SetContentType(contentTypeToUse);
//rv = NS_NewInputStreamChannel(getter_AddRefs(mOutgoingChannel), aURI, nsnull, contentTypeToUse, -1);
//if (NS_FAILED(rv))
@ -802,7 +807,7 @@ nsStreamConverter::SetIdentity(nsIMsgIdentity * aIdentity)
// networking library...
//
nsresult
nsStreamConverter::OnDataAvailable(nsIChannel * /* aChannel */, nsISupports *ctxt,
nsStreamConverter::OnDataAvailable(nsIRequest *request, nsISupports *ctxt,
nsIInputStream *aIStream,
PRUint32 sourceOffset,
PRUint32 aLength)
@ -872,7 +877,7 @@ char *output = "\
// called only once, at the beginning of a URL load.
//
nsresult
nsStreamConverter::OnStartRequest(nsIChannel * aChannel, nsISupports *ctxt)
nsStreamConverter::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
{
#ifdef DEBUG_rhp
printf("nsStreamConverter::OnStartRequest()\n");
@ -885,17 +890,22 @@ nsStreamConverter::OnStartRequest(nsIChannel * aChannel, nsISupports *ctxt)
// here's a little bit of hackery....
// since the mime converter is now between the channel
// and the
nsresult rv = NS_OK;
if (aChannel)
if (request)
{
nsXPIDLCString contentType;
GetContentType(getter_Copies(contentType));
aChannel->SetContentType(contentType);
nsCOMPtr<nsIStreamContentInfo> contentInfo = do_QueryInterface(request);
if (contentInfo)
{
nsXPIDLCString contentType;
GetContentType(getter_Copies(contentType));
if (contentInfo)
contentInfo->SetContentType(contentType);
}
}
// forward the start rquest to any listeners
if (mOutListener)
mOutListener->OnStartRequest(aChannel, ctxt);
mOutListener->OnStartRequest(request, ctxt);
return NS_OK;
}
@ -904,7 +914,7 @@ nsStreamConverter::OnStartRequest(nsIChannel * aChannel, nsISupports *ctxt)
// called once when the networking library has finished processing the
//
nsresult
nsStreamConverter::OnStopRequest(nsIChannel * aChannel, nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg)
nsStreamConverter::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg)
{
#ifdef DEBUG_rhp
printf("nsStreamConverter::OnStopRequest()\n");
@ -983,7 +993,7 @@ nsStreamConverter::OnStopRequest(nsIChannel * aChannel, nsISupports *ctxt, nsres
// forward on top request to any listeners
if (mOutListener)
mOutListener->OnStopRequest(/* mOutgoingChannel */ aChannel, ctxt, status, errorMsg);
mOutListener->OnStopRequest(request, ctxt, status, errorMsg);
mAlreadyKnowOutputType = PR_FALSE;
@ -1047,7 +1057,6 @@ NS_IMETHODIMP nsStreamConverter::AsyncConvertData(const PRUnichar *aFromType, co
nsCOMPtr<nsIURI> aUri;
aChannel->GetURI(getter_AddRefs(aUri));
return Init(aUri, aListener, aChannel);
}

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

@ -694,9 +694,9 @@ public:
nsNntpCacheStreamListener ();
virtual ~nsNntpCacheStreamListener();
nsresult Init(nsIStreamListener * aStreamListener, nsIChannel * aChannelToUse, nsIMsgMailNewsUrl *aRunningUrl);
nsresult Init(nsIStreamListener * aStreamListener, nsIChannel* channel, nsIMsgMailNewsUrl *aRunningUrl);
protected:
nsCOMPtr<nsIChannel> mChannelToUse;
nsCOMPtr<nsIChannel> mChannelToUse;
nsCOMPtr<nsIStreamListener> mListener;
nsCOMPtr<nsIMsgMailNewsUrl> mRunningUrl;
};
@ -718,36 +718,37 @@ nsNntpCacheStreamListener::nsNntpCacheStreamListener()
nsNntpCacheStreamListener::~nsNntpCacheStreamListener()
{}
nsresult nsNntpCacheStreamListener::Init(nsIStreamListener * aStreamListener, nsIChannel * aChannelToUse,
nsresult nsNntpCacheStreamListener::Init(nsIStreamListener * aStreamListener, nsIChannel* channel,
nsIMsgMailNewsUrl *aRunningUrl)
{
NS_ENSURE_ARG(aStreamListener);
NS_ENSURE_ARG(aChannelToUse);
NS_ENSURE_ARG(channel);
mChannelToUse = channel;
mChannelToUse = aChannelToUse;
mListener = aStreamListener;
mRunningUrl = aRunningUrl;
return NS_OK;
}
NS_IMETHODIMP
nsNntpCacheStreamListener::OnStartRequest(nsIChannel * aChannel, nsISupports * aCtxt)
nsNntpCacheStreamListener::OnStartRequest(nsIRequest *request, nsISupports * aCtxt)
{
nsCOMPtr <nsILoadGroup> loadGroup;
mChannelToUse->GetLoadGroup(getter_AddRefs(loadGroup));
if (loadGroup)
loadGroup->AddChannel(mChannelToUse, nsnull /* context isupports */);
return mListener->OnStartRequest(mChannelToUse, aCtxt);
loadGroup->AddRequest(request, nsnull /* context isupports */);
return mListener->OnStartRequest(request, aCtxt);
}
NS_IMETHODIMP
nsNntpCacheStreamListener::OnStopRequest(nsIChannel * aChannel, nsISupports * aCtxt, nsresult aStatus, const PRUnichar* aMsg)
nsNntpCacheStreamListener::OnStopRequest(nsIRequest *request, nsISupports * aCtxt, nsresult aStatus, const PRUnichar* aMsg)
{
nsresult rv = mListener->OnStopRequest(mChannelToUse, aCtxt, aStatus, aMsg);
nsresult rv = mListener->OnStopRequest(request, aCtxt, aStatus, aMsg);
nsCOMPtr <nsILoadGroup> loadGroup;
mChannelToUse->GetLoadGroup(getter_AddRefs(loadGroup));
if (loadGroup)
loadGroup->RemoveChannel(mChannelToUse, nsnull, aStatus, nsnull);
loadGroup->RemoveRequest(request, nsnull, aStatus, nsnull);
// clear out mem cache entry so we're not holding onto it.
if (mRunningUrl)
@ -759,13 +760,14 @@ nsNntpCacheStreamListener::OnStopRequest(nsIChannel * aChannel, nsISupports * aC
}
NS_IMETHODIMP
nsNntpCacheStreamListener::OnDataAvailable(nsIChannel * aChannel, nsISupports * aCtxt, nsIInputStream * aInStream, PRUint32 aSourceOffset, PRUint32 aCount)
nsNntpCacheStreamListener::OnDataAvailable(nsIRequest *request, nsISupports * aCtxt, nsIInputStream * aInStream, PRUint32 aSourceOffset, PRUint32 aCount)
{
return mListener->OnDataAvailable(mChannelToUse, aCtxt, aInStream, aSourceOffset, aCount);
return mListener->OnDataAvailable(request, aCtxt, aInStream, aSourceOffset, aCount);
}
NS_IMETHODIMP nsNNTPProtocol::AsyncRead(nsIStreamListener *listener, nsISupports *ctxt)
NS_IMETHODIMP nsNNTPProtocol::AsyncRead(nsIStreamListener *listener, nsISupports *ctxt,
PRUint32 transferOffset, PRUint32 transferCount, nsIRequest **_retval)
{
nsresult rv;
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsUrl = do_QueryInterface(m_runningURL, &rv);
@ -794,7 +796,8 @@ NS_IMETHODIMP nsNNTPProtocol::AsyncRead(nsIStreamListener *listener, nsISupports
nsMsgKey key = nsMsgKey_None;
rv = m_runningURL->GetMessageKey(&key);
nsCOMPtr<nsIFileChannel> fileChannel;
rv = folder->GetOfflineFileChannel(key, getter_AddRefs(fileChannel));
PRUint32 offset=0, size=0;
rv = folder->GetOfflineFileChannel(key, &offset, &size, getter_AddRefs(fileChannel));
// get the file channel from the folder, somehow (through the message or
// folder sink?) We also need to set the transfer offset to the message offset
if (fileChannel && NS_SUCCEEDED(rv))
@ -804,7 +807,8 @@ NS_IMETHODIMP nsNNTPProtocol::AsyncRead(nsIStreamListener *listener, nsISupports
nsNntpCacheStreamListener * cacheListener = new nsNntpCacheStreamListener();
NS_ADDREF(cacheListener);
cacheListener->Init(m_channelListener, NS_STATIC_CAST(nsIChannel *, this), mailnewsUrl);
rv = fileChannel->AsyncRead(cacheListener, m_channelContext);
nsCOMPtr<nsIRequest> request;
rv = fileChannel->AsyncRead(cacheListener, m_channelContext, offset, size, getter_AddRefs(request));
NS_RELEASE(cacheListener);
MarkCurrentMsgRead();
@ -840,10 +844,13 @@ NS_IMETHODIMP nsNNTPProtocol::AsyncRead(nsIStreamListener *listener, nsISupports
{
// we're going to fill up this cache entry,
// do we have a listener here?
nsIStreamListener *listener = m_channelListener;
rv = cacheEntry->InterceptAsyncRead(listener, 0, getter_AddRefs(m_channelListener));
nsIStreamListener *anotherListener = m_channelListener;
rv = cacheEntry->InterceptAsyncRead(anotherListener, 0, getter_AddRefs(m_channelListener));
nsCOMPtr<nsIRequest> request;
if (NS_SUCCEEDED(rv))
return nsMsgProtocol::AsyncRead(m_channelListener, ctxt);
return nsMsgProtocol::AsyncRead(m_channelListener, ctxt,
transferOffset, transferCount,
getter_AddRefs(request));
}
}
}
@ -860,7 +867,10 @@ NS_IMETHODIMP nsNNTPProtocol::AsyncRead(nsIStreamListener *listener, nsISupports
SetLoadGroup(m_loadGroup);
m_typeWanted = ARTICLE_WANTED;
cacheListener->Init(m_channelListener, NS_STATIC_CAST(nsIChannel *, this), mailnewsUrl);
rv = cacheChannel->AsyncRead(cacheListener, m_channelContext);
nsCOMPtr<nsIRequest> request;
rv = cacheChannel->AsyncRead(cacheListener, m_channelContext,
transferOffset, transferCount,
getter_AddRefs(request));
NS_RELEASE(cacheListener);
MarkCurrentMsgRead();
@ -875,7 +885,8 @@ NS_IMETHODIMP nsNNTPProtocol::AsyncRead(nsIStreamListener *listener, nsISupports
}
}
return nsMsgProtocol::AsyncRead(listener, ctxt);
nsCOMPtr<nsIRequest> parentRequest;
return nsMsgProtocol::AsyncRead(listener, ctxt, transferOffset, transferCount, getter_AddRefs(parentRequest));
}
nsresult nsNNTPProtocol::LoadUrl(nsIURI * aURL, nsISupports * aConsumer)
@ -1211,9 +1222,9 @@ nsresult nsNNTPProtocol::LoadUrl(nsIURI * aURL, nsISupports * aConsumer)
}
// stop binding is a "notification" informing us that the stream associated with aURL is going away.
NS_IMETHODIMP nsNNTPProtocol::OnStopRequest(nsIChannel * aChannel, nsISupports * aContext, nsresult aStatus, const PRUnichar* aMsg)
NS_IMETHODIMP nsNNTPProtocol::OnStopRequest(nsIRequest *request, nsISupports * aContext, nsresult aStatus, const PRUnichar* aMsg)
{
nsMsgProtocol::OnStopRequest(aChannel, aContext, aStatus, aMsg);
nsMsgProtocol::OnStopRequest(request, aContext, aStatus, aMsg);
// nsMsgProtocol::OnStopRequest() has called m_channelListener. There is
// no need to be called again in CloseSocket(). Let's clear it here.
@ -5402,7 +5413,7 @@ nsresult nsNNTPProtocol::CleanupAfterRunningUrl()
rv = m_channelListener->OnStopRequest(this, m_channelContext, NS_OK, nsnull);
if (m_loadGroup)
m_loadGroup->RemoveChannel(NS_STATIC_CAST(nsIChannel *, this), nsnull, NS_OK, nsnull);
m_loadGroup->RemoveRequest(NS_STATIC_CAST(nsIRequest *, this), nsnull, NS_OK, nsnull);
if (m_newsgroupList)
{
int status;

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

@ -162,13 +162,13 @@ public:
virtual ~nsNNTPProtocol();
// stop binding is a "notification" informing us that the stream associated with aURL is going away.
NS_IMETHOD OnStopRequest(nsIChannel * aChannel, nsISupports * aCtxt, nsresult aStatus, const PRUnichar* aMsg);
NS_IMETHOD OnStopRequest(nsIRequest *request, nsISupports * aCtxt, nsresult aStatus, const PRUnichar* aMsg);
char * m_ProxyServer; /* proxy server hostname */
NS_IMETHOD Cancel(nsresult status); // handle stop button
NS_IMETHOD GetContentType(char * *aContentType);
NS_IMETHOD AsyncRead(nsIStreamListener *listener, nsISupports *ctxt);
NS_IMETHOD AsyncRead(nsIStreamListener *listener, nsISupports *ctxt, PRUint32 transferOffset, PRUint32 transferCount, nsIRequest **_retval);
nsresult LoadUrl(nsIURI * aURL, nsISupports * aConsumer);
private:

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

@ -1594,9 +1594,13 @@ NS_IMETHODIMP nsNntpService::GetChromeUrlForTask(char **aChromeUrlForTask)
NS_IMETHODIMP
nsNntpService::HandleContent(const char * aContentType, const char * aCommand, const char * aWindowTarget, nsISupports * aWindowContext, nsIChannel * aChannel)
nsNntpService::HandleContent(const char * aContentType, const char * aCommand, const char * aWindowTarget, nsISupports * aWindowContext, nsIRequest *request)
{
nsresult rv = NS_OK;
if (!request) return NS_ERROR_NULL_POINTER;
nsCOMPtr<nsIChannel> aChannel;
request->GetParent(getter_AddRefs(aChannel));
if (!aChannel) return NS_ERROR_NULL_POINTER;
if (nsCRT::strcasecmp(aContentType, "x-application-newsgroup") == 0) {