Bug #44635 --> when replying or forwarding a message, we were passing in a bogus channel when we tried to fetch

the message for quoting purposes. As a result, the content type (which includes the charset information for the message)
was not getting set on the right channel. I changed things so we pass in the real channel and not a bogus one.

r=alecf
This commit is contained in:
mscott%netscape.com 2000-07-12 22:54:19 +00:00
parent 05af0d41aa
commit 2d4726af0f

View File

@ -182,33 +182,27 @@ nsMsgQuote::QuoteMessage(const PRUnichar *msgURI, PRBool quoteHeaders, nsIStream
nsCOMPtr<nsISupports> quoteSupport = do_QueryInterface(this);
// now we want to create a necko channel for this url and we want to open it
mQuoteChannel = null_nsCOMPtr();
rv = NS_NewInputStreamChannel(getter_AddRefs(mQuoteChannel), aURL, nsnull, nsnull, -1);
NS_WITH_SERVICE(nsIIOService, netService, kIOServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
rv = netService->NewChannelFromURI(aURL, getter_AddRefs(mQuoteChannel));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsISupports> ctxt = do_QueryInterface(aURL);
NS_WITH_SERVICE(nsIStreamConverterService, streamConverterService, kIStreamConverterServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
nsAutoString from, to;
from.AssignWithConversion(MESSAGE_RFC822);
to.AssignWithConversion("text/xul");
nsCOMPtr<nsIStreamListener> convertedListener;
rv = streamConverterService->AsyncConvertData(from.GetUnicode(),
to.GetUnicode(),
rv = streamConverterService->AsyncConvertData(NS_LITERAL_STRING(MESSAGE_RFC822),
NS_LITERAL_STRING("text/xul"),
mStreamListener,
quoteSupport,
getter_AddRefs(convertedListener));
if (NS_FAILED(rv)) return rv;
NS_WITH_SERVICE(nsIIOService, netService, kIOServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
// now we want to create a necko channel for this url and we want to open it
nsCOMPtr<nsIChannel> aChannel;
rv = netService->NewChannelFromURI(aURL, getter_AddRefs(aChannel));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsISupports> aCtxt = do_QueryInterface(aURL);
// now try to open the channel passing in our display consumer as the listener
rv = aChannel->AsyncRead(convertedListener, aCtxt);
rv = mQuoteChannel->AsyncRead(convertedListener, ctxt);
ReleaseMessageServiceFromURI(aMsgUri, msgService);
return rv;