mimeConverter->SetMimeOutputType(ptr->mQuoteHeaders? nsMimeOutput::nsMimeMessageQuoting : nsMimeOutput::nsMimeMessageBodyQuoting);
{ if (ptr->mQuoteHeaders) mimeConverter->SetMimeOutputType(nsMimeOutput::nsMimeMessageQuoting); else mimeConverter->SetMimeOutputType(nsMimeOutput::nsMimeMessageBodyQuoting); }
SaveQuoteMessageCompleteCallback(nsIURI *aURL, nsresult aExitCode, void *tagData){  nsresult        rv = NS_OK;  if (!tagData)  {    return NS_ERROR_INVALID_ARG;  }  nsMsgQuote *ptr = (nsMsgQuote *) tagData;  if (ptr->mMessageService)  {    ReleaseMessageServiceFromURI(ptr->mURI, ptr->mMessageService);    ptr->mMessageService = nsnull;  }  /* mscott - the NS_BINDING_ABORTED is a hack to get around a problem I have     with the necko code...it returns this and treats it as an error when	 it really isn't an error! I'm trying to get them to change this.   */  if (NS_FAILED(aExitCode) && aExitCode != NS_BINDING_ABORTED)  {    NS_RELEASE(ptr);    return aExitCode;  }  // Create a mime parser (nsIStreamConverter)!  nsCOMPtr<nsIStreamConverter2> mimeParser;  rv = nsComponentManager::CreateInstance(kStreamConverterCID,                                           NULL, nsCOMTypeInfo<nsIStreamConverter2>::GetIID(),                                           (void **) getter_AddRefs(mimeParser));   if (NS_FAILED(rv) || !mimeParser)  {    NS_RELEASE(ptr);    printf("Failed to create MIME stream converter...\n");    return rv;  }    // This is the producer stream that will deliver data from the disk file...  // ...someday, we'll just get streams from Necko.  // mscott --> the type for a nsCOMPtr needs to be an interface.  // but this class (which is only temporary anyway) is mixing and matching  // interface calls and implementation calls....so you really can't use a  // com ptr. to get around it, I'm using fileStream to make calls on the  // methods that aren't supported by the nsIInputStream and "in" for  // methods that are supported as part of the interface...  FileInputStreamImpl * fileStream = new FileInputStreamImpl();  nsCOMPtr<nsIInputStream> in = do_QueryInterface(fileStream);  if (!in || !fileStream)  {    NS_RELEASE(ptr);    printf("Failed to create nsIInputStream\n");    return NS_ERROR_OUT_OF_MEMORY;  }  if (NS_FAILED(fileStream->OpenDiskFile(*(ptr->mTmpFileSpec))))  {    NS_RELEASE(ptr);    printf("Unable to open input file\n");    return NS_ERROR_FAILURE;  }    // Set us as the output stream for HTML data from libmime...  nsCOMPtr<nsIMimeStreamConverter> mimeConverter = do_QueryInterface(mimeParser);  if (mimeConverter)	  mimeConverter->SetMimeOutputType(ptr->mQuoteHeaders? nsMimeOutput::nsMimeMessageQuoting :	  														nsMimeOutput::nsMimeMessageBodyQuoting);  if (NS_FAILED(mimeParser->Init(aURL, ptr->mStreamListener, nsnull /* the channel */)))  {    NS_RELEASE(ptr);    printf("Unable to set the output stream for the mime parser...\ncould be failure to create internal libmime data\n");    return NS_ERROR_UNEXPECTED;  }  // Assuming this is an RFC822 message...  mimeParser->OnStartRequest(nsnull, aURL);  // Just pump all of the data from the file into libmime...  while (NS_SUCCEEDED(fileStream->PumpFileStream()))  {    PRUint32    len;    in->GetLength(&len);    mimeParser->OnDataAvailable(nsnull, aURL, in, 0, len);  }  mimeParser->OnStopRequest(nsnull, aURL, NS_OK, nsnull);  in->Close();  ptr->mTmpFileSpec->Delete(PR_FALSE);  NS_RELEASE(ptr);  return NS_OK;}