nsCOMPtr<nsIChannel> channel (do_QueryInterface(aRequest)); if (channel) { nsCOMPtr<nsIURI> uri; channel->GetURI(getter_AddRefs(uri)); nsCOMPtr<nsIMsgMailNewsUrl> mailUrl = do_QueryInterface(uri); if (mailUrl) mailUrl->SetMsgHeaderSink(NS_STATIC_CAST(nsIMsgHeaderSink*, this)); }
NS_IMETHODIMP TokenStreamListener::OnStartRequest(nsIRequest *aRequest, nsISupports *aContext){    mLeftOverCount = 0;    if (!mTokenizer)        return NS_ERROR_OUT_OF_MEMORY;    if (!mBuffer)    {        mBuffer = new char[mBufferSize];        if (!mBuffer)            return NS_ERROR_OUT_OF_MEMORY;    }    return NS_OK;}