Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Typedefs | Functions
mimemoz2.h File Reference
#include "prtypes.h"
#include "nsStreamConverter.h"
#include "nsIMimeEmitter.h"
#include "nsIURI.h"
#include "mozITXTToHTMLConv.h"
#include "nsIMsgSend.h"
#include "nsIMimeConverter.h"
#include "mimei.h"
#include "nsIPrefBranch.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _nsMIMESession
struct  mime_stream_data
struct  mime_draft_data

Defines

#define MAX_WRITE_READY   (((unsigned) (~0) << 1) >> 1) /* must be <= than MAXINT!!!!! */

Typedefs

typedef struct _nsMIMESession
typedef unsigned int(* MKSessionWriteReadyFunc )(nsMIMESession *stream)
typedef int(* MKSessionWriteFunc )(nsMIMESession *stream, const char *str, PRInt32 len)
typedef void(* MKSessionCompleteFunc )(nsMIMESession *stream)
typedef void(* MKSessionAbortFunc )(nsMIMESession *stream, int status)

Functions

voidmime_bridge_create_display_stream (nsIMimeEmitter *newEmitter, nsStreamConverter *newPluginObj2, nsIURI *uri, nsMimeOutputType format_out, PRUint32 whattodo, nsIChannel *aChannel)
nsIMimeEmitterGetMimeEmitter (MimeDisplayOptions *opt)
nsresult mimeSetNewURL (nsMIMESession *stream, char *url)
nsresult mimeEmitterAddAttachmentField (MimeDisplayOptions *opt, const char *field, const char *value)
nsresult mimeEmitterAddHeaderField (MimeDisplayOptions *opt, const char *field, const char *value)
nsresult mimeEmitterAddAllHeaders (MimeDisplayOptions *opt, const char *allheaders, const PRInt32 allheadersize)
nsresult mimeEmitterStartAttachment (MimeDisplayOptions *opt, const char *name, const char *contentType, const char *url, PRBool aIsExternalAttachment)
nsresult mimeEmitterEndAttachment (MimeDisplayOptions *opt)
nsresult mimeEmitterEndAllAttachments (MimeDisplayOptions *opt)
nsresult mimeEmitterStartBody (MimeDisplayOptions *opt, PRBool bodyOnly, const char *msgID, const char *outCharset)
nsresult mimeEmitterEndBody (MimeDisplayOptions *opt)
nsresult mimeEmitterEndHeader (MimeDisplayOptions *opt)
nsresult mimeEmitterStartHeader (MimeDisplayOptions *opt, PRBool rootMailHeader, PRBool headerOnly, const char *msgID, const char *outCharset)
nsresult mimeEmitterUpdateCharacterSet (MimeDisplayOptions *opt, const char *aCharset)
nsIPrefBranchGetPrefBranch (MimeDisplayOptions *opt)
mozITXTToHTMLConvGetTextConverter (MimeDisplayOptions *opt)
nsresult HTML2Plaintext (const nsString &inString, nsString &outString, PRUint32 flags, PRUint32 wrapCol)
nsresult HTMLSanitize (const nsString &inString, nsString &outString, PRUint32 flags, const nsAString &allowedTags)
char * MimeGetStringByID (PRInt32 stringID)
nsresult nsMimeNewURI (nsIURI **aInstancePtrResult, const char *aSpec, nsIURI *aBase)
nsresult SetMailCharacterSetToMsgWindow (MimeObject *obj, const char *aCharacterSet)
nsresult GetMailNewsFont (MimeObject *obj, PRBool styleFixed, PRInt32 *fontPixelSize, PRInt32 *fontSizePercentage, nsCString &fontLang)

Class Documentation

struct _nsMIMESession

Definition at line 85 of file mimemoz2.h.

Class Members
MKSessionAbortFunc abort
MKSessionCompleteFunc complete
void * data_object
PRBool is_multipart
MKSessionWriteReadyFunc is_write_ready
char * name
MKSessionWriteFunc put_block
void * window_id
struct mime_stream_data

Definition at line 117 of file mimemoz2.h.

Collaboration diagram for mime_stream_data:
Class Members
nsIChannel * channel
PRBool firstCheck
nsMimeOutputType format_out
MimeHeaders * headers
nsMIMESession * istream
MimeObject * obj
MimeDisplayOptions * options
char * orig_url_name
nsIMimeEmitter * output_emitter
void * pluginObj2
char * url_name
struct mime_draft_data

Definition at line 137 of file mimemoz2.h.

Collaboration diagram for mime_draft_data:
Class Members
nsMsgAttachedFile * attachments
PRInt32 attachments_count
nsMsgAttachedFile * curAttachment
MimeDecoderData * decoder_data
nsMimeOutputType format_out
PRBool forwardInline
MimeHeaders * headers
nsCOMPtr< nsIMsgIdentity > identity
char * mailcharset
nsMsgAttachedFile * messageBody
MimeObject * obj
MimeDisplayOptions * options
char * originalMsgURI
nsMIMESession * stream
nsIFileSpec * tmpFileSpec
nsOutputFileStream * tmpFileStream
char * url_name

Define Documentation

#define MAX_WRITE_READY   (((unsigned) (~0) << 1) >> 1) /* must be <= than MAXINT!!!!! */

Definition at line 73 of file mimemoz2.h.


Typedef Documentation

typedef struct _nsMIMESession

Definition at line 67 of file mimemoz2.h.

typedef void(* MKSessionAbortFunc)(nsMIMESession *stream, int status)

Definition at line 82 of file mimemoz2.h.

typedef void(* MKSessionCompleteFunc)(nsMIMESession *stream)

Definition at line 79 of file mimemoz2.h.

typedef int(* MKSessionWriteFunc)(nsMIMESession *stream, const char *str, PRInt32 len)

Definition at line 76 of file mimemoz2.h.

typedef unsigned int(* MKSessionWriteReadyFunc)(nsMIMESession *stream)

Definition at line 71 of file mimemoz2.h.


Function Documentation

nsresult GetMailNewsFont ( MimeObject obj,
PRBool  styleFixed,
PRInt32 fontPixelSize,
PRInt32 fontSizePercentage,
nsCString fontLang 
)

Definition at line 2084 of file mimemoz2.cpp.

{
  nsresult rv = NS_OK;

  nsIPrefBranch *prefBranch = GetPrefBranch(obj->options);
  if (prefBranch) {
    MimeInlineText  *text = (MimeInlineText *) obj;
    nsCAutoString charset;

    // get a charset
    if (!text->initializeCharset)
      ((MimeInlineTextClass*)&mimeInlineTextClass)->initialize_charset(obj);

    if (!text->charset || !(*text->charset))
      charset.Assign("us-ascii");
    else
      charset.Assign(text->charset);

    nsCOMPtr<nsICharsetConverterManager> charSetConverterManager2;
    nsCOMPtr<nsIAtom> langGroupAtom;
    nsCAutoString prefStr;

    ToLowerCase(charset);

    charSetConverterManager2 = do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &rv);
    if ( NS_FAILED(rv))
      return rv;

    // get a language, e.g. x-western, ja
    rv = charSetConverterManager2->GetCharsetLangGroup(charset.get(), getter_AddRefs(langGroupAtom));
    if (NS_FAILED(rv))
      return rv;
    rv = langGroupAtom->ToUTF8String(fontLang);
    if (NS_FAILED(rv))
      return rv;

    // get a font size from pref
    prefStr.Assign(!styleFixed ? "font.size.variable." : "font.size.fixed.");
    prefStr.Append(fontLang);
    rv = prefBranch->GetIntPref(prefStr.get(), fontPixelSize);
    if (NS_FAILED(rv))
      return rv;

    nsCOMPtr<nsIPrefBranch> prefDefBranch;
    nsCOMPtr<nsIPrefService> prefSvc(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
    if(prefSvc)
      rv = prefSvc->GetDefaultBranch("", getter_AddRefs(prefDefBranch));

    if(!prefDefBranch)
      return rv;

    // get original font size
    PRInt32 originalSize;
    rv = prefDefBranch->GetIntPref(prefStr.get(), &originalSize);
    if (NS_FAILED(rv))
      return rv;

    // calculate percentage
    *fontSizePercentage = originalSize ? 
                          (PRInt32)((float)*fontPixelSize / (float)originalSize * 100) : 0;

  }

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1714 of file mimemoz2.cpp.

{
  mime_stream_data  *msd = (mime_stream_data *)opt->stream_closure;
  if (!msd) 
    return NULL;

  nsIMimeEmitter     *ptr = (nsIMimeEmitter *)(msd->output_emitter);
  return ptr;
}

Here is the call graph for this function:

Definition at line 1373 of file mimemoz2.cpp.

{
  if (!opt) 
    return nsnull;

  return opt->m_prefBranch;
}

Here is the caller graph for this function:

Definition at line 1383 of file mimemoz2.cpp.

{
  if (!opt) 
    return nsnull;

  return opt->conv;
}

Here is the caller graph for this function:

nsresult HTML2Plaintext ( const nsString inString,
nsString outString,
PRUint32  flags,
PRUint32  wrapCol 
)

Definition at line 2164 of file mimemoz2.cpp.

{
  nsresult rv = NS_OK;

#if DEBUG_BenB
  printf("Converting HTML to plaintext\n");
  char* charstar = ToNewUTF8String(inString);
  printf("HTML source is:\n--------------------\n%s--------------------\n",
         charstar);
  delete[] charstar;
#endif

  // Create a parser
  nsCOMPtr<nsIParser> parser = do_CreateInstance(kParserCID);
  NS_ENSURE_TRUE(parser, NS_ERROR_FAILURE);

  // Create the appropriate output sink
  nsCOMPtr<nsIContentSink> sink =
                               do_CreateInstance(NS_PLAINTEXTSINK_CONTRACTID);
  NS_ENSURE_TRUE(sink, NS_ERROR_FAILURE);

  nsCOMPtr<nsIHTMLToTextSink> textSink(do_QueryInterface(sink));
  NS_ENSURE_TRUE(textSink, NS_ERROR_FAILURE);

  textSink->Initialize(&outString, flags, wrapCol);

  parser->SetContentSink(sink);
  nsCOMPtr<nsIDTD> dtd = do_CreateInstance(kNavDTDCID);
  NS_ENSURE_TRUE(dtd, NS_ERROR_FAILURE);

  parser->RegisterDTD(dtd);

  rv = parser->Parse(inString, 0, NS_LITERAL_CSTRING("text/html"),
                     PR_FALSE, PR_TRUE);

  // Aah! How can NS_ERROR and NS_ABORT_IF_FALSE be no-ops in release builds???
  if (NS_FAILED(rv))
  {
    NS_ERROR("Parse() failed!");
    return rv;
  }

#if DEBUG_BenB
  charstar = ToNewUTF8String(outString);
  printf("Plaintext is:\n--------------------\n%s--------------------\n",
         charstar);
  delete[] charstar;
#endif

  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult HTMLSanitize ( const nsString inString,
nsString outString,
PRUint32  flags,
const nsAString &  allowedTags 
)

Definition at line 2228 of file mimemoz2.cpp.

{
  nsresult rv = NS_OK;

#if DEBUG_BenB
  printf("Sanitizing HTML\n");
  char* charstar = ToNewUTF8String(inString);
  printf("Original HTML is:\n--------------------\n%s--------------------\n",
         charstar);
  delete[] charstar;
#endif

  // Create a parser
  nsCOMPtr<nsIParser> parser = do_CreateInstance(kParserCID);
  NS_ENSURE_TRUE(parser, NS_ERROR_FAILURE);

  // Create the appropriate output sink
  nsCOMPtr<nsIContentSink> sink =
                    do_CreateInstance(MOZ_SANITIZINGHTMLSERIALIZER_CONTRACTID);
  NS_ENSURE_TRUE(sink, NS_ERROR_FAILURE);

  nsCOMPtr<mozISanitizingHTMLSerializer> sanSink(do_QueryInterface(sink));
  NS_ENSURE_TRUE(sanSink, NS_ERROR_FAILURE);

  sanSink->Initialize(&outString, flags, allowedTags);

  parser->SetContentSink(sink);
  nsCOMPtr<nsIDTD> dtd = do_CreateInstance(kNavDTDCID);
  NS_ENSURE_TRUE(dtd, NS_ERROR_FAILURE);

  parser->RegisterDTD(dtd);

  rv = parser->Parse(inString, 0, NS_LITERAL_CSTRING("text/html"),
                     PR_FALSE, PR_TRUE);
  if (NS_FAILED(rv))
  {
    NS_ERROR("Parse() failed!");
    return rv;
  }

#if DEBUG_BenB
  charstar = ToNewUTF8String(outString);
  printf("Sanitized HTML is:\n--------------------\n%s--------------------\n",
         charstar);
  delete[] charstar;
#endif

  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void* mime_bridge_create_display_stream ( nsIMimeEmitter newEmitter,
nsStreamConverter newPluginObj2,
nsIURI uri,
nsMimeOutputType  format_out,
PRUint32  whattodo,
nsIChannel aChannel 
)

Definition at line 1479 of file mimemoz2.cpp.

{
  int                       status = 0;
  MimeObject                *obj;
  struct mime_stream_data   *msd;
  nsMIMESession             *stream = 0;
  
  if (!uri)
    return nsnull;

  msd = PR_NEWZAP(struct mime_stream_data);
  if (!msd) 
    return NULL;

  // Assign the new mime emitter - will handle output operations
  msd->output_emitter = newEmitter;
  msd->firstCheck = PR_TRUE;

  // Store the URL string for this decode operation
  nsCAutoString urlString;
  nsresult rv;

  // Keep a hold of the channel...
  msd->channel = aChannel;
  rv = uri->GetSpec(urlString);
  if (NS_SUCCEEDED(rv))
  {
    if (!urlString.IsEmpty())
    {
      msd->url_name = ToNewCString(urlString);
      if (!(msd->url_name))
      {
        PR_FREEIF(msd);
        return NULL;
      }
      nsCOMPtr<nsIMsgMessageUrl> msgUrl = do_QueryInterface(uri);
      if (msgUrl)
          msgUrl->GetOriginalSpec(&msd->orig_url_name);
    }
  }
  
  msd->format_out = format_out;       // output format
  msd->pluginObj2 = newPluginObj2;    // the plugin object pointer 
  
  msd->options = new MimeDisplayOptions;
  if (!msd->options)
  {
    PR_Free(msd);
    return 0;
  }
//  memset(msd->options, 0, sizeof(*msd->options));
  msd->options->format_out = format_out;     // output format

  msd->options->m_prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
  if (NS_FAILED(rv))
  {
    PR_FREEIF(msd);
    return nsnull;
  }

  // Need the text converter...
  rv = CallCreateInstance(MOZ_TXTTOHTMLCONV_CONTRACTID, &(msd->options->conv));
  if (NS_FAILED(rv))
  {
    msd->options->m_prefBranch = 0;
    PR_FREEIF(msd);
    return nsnull;
  }

  //
  // Set the defaults, based on the context, and the output-type.
  //
  MIME_HeaderType = MimeHeadersAll;
  msd->options->write_html_p = PR_TRUE;
  switch (format_out) 
  {
    case nsMimeOutput::nsMimeMessageSplitDisplay:   // the wrapper HTML output to produce the split header/body display
    case nsMimeOutput::nsMimeMessageHeaderDisplay:  // the split header/body display
    case nsMimeOutput::nsMimeMessageBodyDisplay:    // the split header/body display
      msd->options->fancy_headers_p = PR_TRUE;
      msd->options->output_vcard_buttons_p = PR_TRUE;
      msd->options->fancy_links_p = PR_TRUE;
      break;

    case nsMimeOutput::nsMimeMessageSaveAs:         // Save As operations
    case nsMimeOutput::nsMimeMessageQuoting:        // all HTML quoted/printed output
    case nsMimeOutput::nsMimeMessagePrintOutput:
      msd->options->fancy_headers_p = PR_TRUE;
      msd->options->fancy_links_p = PR_TRUE;
      break;

    case nsMimeOutput::nsMimeMessageBodyQuoting:        // only HTML body quoted output
      MIME_HeaderType = MimeHeadersNone;
      break;

    case nsMimeOutput::nsMimeMessageAttach:           // handling attachment storage
        msd->options->write_html_p = PR_FALSE;
        break;
    case nsMimeOutput::nsMimeMessageRaw:              // the raw RFC822 data (view source) and attachments
    case nsMimeOutput::nsMimeMessageDraftOrTemplate:  // Loading drafts & templates
    case nsMimeOutput::nsMimeMessageEditorTemplate:   // Loading templates into editor
    case nsMimeOutput::nsMimeMessageFilterSniffer:    // generating an output that can be scan by a message filter
      break;

    case nsMimeOutput::nsMimeMessageDecrypt:
      msd->options->decrypt_p = PR_TRUE;
      msd->options->write_html_p = PR_FALSE;
      break;
  }

  // Now, get the libmime prefs...
  
  MIME_WrapLongLines = PR_TRUE;
  MIME_VariableWidthPlaintext = PR_TRUE;
  msd->options->force_user_charset = PR_FALSE;

  if (msd->options->m_prefBranch)
  {
    msd->options->m_prefBranch->GetBoolPref("mail.wrap_long_lines", &MIME_WrapLongLines);
    msd->options->m_prefBranch->GetBoolPref("mail.fixed_width_messages", &MIME_VariableWidthPlaintext);
      // 
      // Charset overrides takes place here
      //
      // We have a bool pref (mail.force_user_charset) to deal with attachments.
      // 1) If true - libmime does NO conversion and just passes it through to raptor
      // 2) If false, then we try to use the charset of the part and if not available, 
      //    the charset of the root message 
      //
    msd->options->m_prefBranch->GetBoolPref("mail.force_user_charset", &(msd->options->force_user_charset));
    msd->options->m_prefBranch->GetBoolPref("mail.inline_attachments", &(msd->options->show_attachment_inline_p));
  }
  /* This pref is written down in with the
     opposite sense of what we like to use... */
  MIME_VariableWidthPlaintext = !MIME_VariableWidthPlaintext;

  msd->options->wrap_long_lines_p = MIME_WrapLongLines;
  msd->options->headers = MIME_HeaderType;
  
  // We need to have the URL to be able to support the various 
  // arguments
  status = mime_parse_url_options(msd->url_name, msd->options);
  if (status < 0)
  {
    PR_FREEIF(msd->options->part_to_load);
    PR_Free(msd->options);
    PR_Free(msd);
    return 0;
  }
 
  if (msd->options->headers == MimeHeadersMicro &&
     (msd->url_name == NULL || (strncmp(msd->url_name, "news:", 5) != 0 &&
              strncmp(msd->url_name, "snews:", 6) != 0)) )
    msd->options->headers = MimeHeadersMicroPlus;

  msd->options->url = msd->url_name;
  msd->options->output_init_fn        = mime_output_init_fn;
  
  msd->options->output_fn             = mime_output_fn;

  msd->options->whattodo          = whattodo;
  msd->options->charset_conversion_fn = mime_convert_charset;
  msd->options->rfc1522_conversion_p  = PR_TRUE;
  msd->options->file_type_fn          = mime_file_type;
  msd->options->stream_closure        = msd;
  msd->options->passwd_prompt_fn      = 0;
  
  msd->options->image_begin           = mime_image_begin;
  msd->options->image_end             = mime_image_end;
  msd->options->make_image_html       = mime_image_make_image_html;
  msd->options->image_write_buffer    = mime_image_write_buffer;
  
  msd->options->variable_width_plaintext_p = MIME_VariableWidthPlaintext;

  // If this is a part, then we should emit the HTML to render the data
  // (i.e. embedded images)
  if (msd->options->part_to_load && msd->options->format_out != nsMimeOutput::nsMimeMessageBodyDisplay)
    msd->options->write_html_p = PR_FALSE;

  obj = mime_new ((MimeObjectClass *)&mimeMessageClass, (MimeHeaders *) NULL, MESSAGE_RFC822);
  if (!obj)
  {
    delete msd->options;
    PR_Free(msd);
    return 0;
  }

  obj->options = msd->options;
  msd->obj = obj;
  
  /* Both of these better not be true at the same time. */
  PR_ASSERT(! (obj->options->decrypt_p && obj->options->write_html_p));
  
  stream = PR_NEW(nsMIMESession);
  if (!stream)
  {
    delete msd->options;
    PR_Free(msd);
    PR_Free(obj);
    return 0;
  }
  
  memset (stream, 0, sizeof (*stream));  
  stream->name           = "MIME Conversion Stream";
  stream->complete       = mime_display_stream_complete;
  stream->abort          = mime_display_stream_abort;
  stream->put_block      = mime_display_stream_write;
  stream->data_object    = msd;
  
  status = obj->clazz->initialize(obj);
  if (status >= 0)
    status = obj->clazz->parse_begin(obj);
  if (status < 0)
  {
    PR_Free(stream);
    delete msd->options;
    PR_Free(msd);
    PR_Free(obj);
    return 0;
  }
  
  return stream;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult mimeEmitterAddAllHeaders ( MimeDisplayOptions opt,
const char *  allheaders,
const PRInt32  allheadersize 
)

Definition at line 1784 of file mimemoz2.cpp.

{
  // Check for draft processing...
  if (NoEmitterProcessing(opt->format_out))
    return NS_OK;

  mime_stream_data  *msd = GetMSD(opt);
  if (!msd) 
    return NS_ERROR_FAILURE;

  if (msd->output_emitter)
  {
    nsIMimeEmitter *emitter = (nsIMimeEmitter *)msd->output_emitter;
    return emitter->AddAllHeaders(allheaders, allheadersize);
  }

  return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult mimeEmitterAddAttachmentField ( MimeDisplayOptions opt,
const char *  field,
const char *  value 
)

Definition at line 1744 of file mimemoz2.cpp.

{
  // Check for draft processing...
  if (NoEmitterProcessing(opt->format_out))
    return NS_OK;

  mime_stream_data  *msd = GetMSD(opt);
  if (!msd) 
    return NS_ERROR_FAILURE;

  if (msd->output_emitter)
  {
    nsIMimeEmitter *emitter = (nsIMimeEmitter *)msd->output_emitter;
    return emitter->AddAttachmentField(field, value);
  }

  return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult mimeEmitterAddHeaderField ( MimeDisplayOptions opt,
const char *  field,
const char *  value 
)

Definition at line 1764 of file mimemoz2.cpp.

{
  // Check for draft processing...
  if (NoEmitterProcessing(opt->format_out))
    return NS_OK;

  mime_stream_data  *msd = GetMSD(opt);
  if (!msd) 
    return NS_ERROR_FAILURE;

  if (msd->output_emitter)
  {
    nsIMimeEmitter *emitter = (nsIMimeEmitter *)msd->output_emitter;
    return emitter->AddHeaderField(field, value);
  }

  return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1848 of file mimemoz2.cpp.

{
  // Check for draft processing...
  if (NoEmitterProcessing(opt->format_out))
    return NS_OK;

  mime_stream_data  *msd = GetMSD(opt);
  if (!msd) 
    return NS_ERROR_FAILURE;

  if (msd->output_emitter)
  {
    nsIMimeEmitter *emitter = (nsIMimeEmitter *)msd->output_emitter;
    if (emitter)
      return emitter->EndAllAttachments();
    else
      return NS_OK;
  }

  return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1825 of file mimemoz2.cpp.

{
  // Check for draft processing...
  if (NoEmitterProcessing(opt->format_out))
    return NS_OK;

  mime_stream_data  *msd = GetMSD(opt);
  if (!msd) 
    return NS_ERROR_FAILURE;

  if (msd->output_emitter)
  {
    nsIMimeEmitter *emitter = (nsIMimeEmitter *)msd->output_emitter;
    if (emitter)
      return emitter->EndAttachment();
    else
      return NS_OK;
  }

  return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1891 of file mimemoz2.cpp.

{
  // Check for draft processing...
  if (NoEmitterProcessing(opt->format_out))
    return NS_OK;

  mime_stream_data  *msd = GetMSD(opt);
  if (!msd) 
    return NS_ERROR_FAILURE;

  if (msd->output_emitter)
  {
    nsIMimeEmitter *emitter = (nsIMimeEmitter *)msd->output_emitter;
    return emitter->EndBody();
  }

  return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1911 of file mimemoz2.cpp.

{
  // Check for draft processing...
  if (NoEmitterProcessing(opt->format_out))
    return NS_OK;

  mime_stream_data  *msd = GetMSD(opt);
  if (!msd) 
    return NS_ERROR_FAILURE;

  if (msd->output_emitter)
  {
    nsIMimeEmitter *emitter = (nsIMimeEmitter *)msd->output_emitter;
    return emitter->EndHeader();
  }

  return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult mimeEmitterStartAttachment ( MimeDisplayOptions opt,
const char *  name,
const char *  contentType,
const char *  url,
PRBool  aIsExternalAttachment 
)

Definition at line 1804 of file mimemoz2.cpp.

{
  // Check for draft processing...
  if (NoEmitterProcessing(opt->format_out))
    return NS_OK;

  mime_stream_data  *msd = GetMSD(opt);
  if (!msd) 
    return NS_ERROR_FAILURE;

  if (msd->output_emitter)
  {
    nsIMimeEmitter *emitter = (nsIMimeEmitter *)msd->output_emitter;
    return emitter->StartAttachment(name, contentType, url, aIsExternalAttachment);
  }

  return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult mimeEmitterStartBody ( MimeDisplayOptions opt,
PRBool  bodyOnly,
const char *  msgID,
const char *  outCharset 
)

Definition at line 1871 of file mimemoz2.cpp.

{
  // Check for draft processing...
  if (NoEmitterProcessing(opt->format_out))
    return NS_OK;

  mime_stream_data  *msd = GetMSD(opt);
  if (!msd) 
    return NS_ERROR_FAILURE;

  if (msd->output_emitter)
  {
    nsIMimeEmitter *emitter = (nsIMimeEmitter *)msd->output_emitter;
    return emitter->StartBody(bodyOnly, msgID, outCharset);
  }

  return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult mimeEmitterStartHeader ( MimeDisplayOptions opt,
PRBool  rootMailHeader,
PRBool  headerOnly,
const char *  msgID,
const char *  outCharset 
)

Definition at line 1951 of file mimemoz2.cpp.

{
  // Check for draft processing...
  if (NoEmitterProcessing(opt->format_out))
    return NS_OK;

  mime_stream_data  *msd = GetMSD(opt);
  if (!msd) 
    return NS_ERROR_FAILURE;

  if (msd->output_emitter)
  {
    nsIMimeEmitter *emitter = (nsIMimeEmitter *)msd->output_emitter;
    return emitter->StartHeader(rootMailHeader, headerOnly, msgID, outCharset);
  }

  return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1931 of file mimemoz2.cpp.

{
  // Check for draft processing...
  if (NoEmitterProcessing(opt->format_out))
    return NS_OK;

  mime_stream_data  *msd = GetMSD(opt);
  if (!msd) 
    return NS_ERROR_FAILURE;

  if (msd->output_emitter)
  {
    nsIMimeEmitter *emitter = (nsIMimeEmitter *)msd->output_emitter;
    return emitter->UpdateCharacterSet(aCharset);
  }

  return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* MimeGetStringByID ( PRInt32  stringID)

Definition at line 1995 of file mimemoz2.cpp.

{
  char          *tempString = nsnull;
  const char    *resultString = "???";
  nsresult      res = NS_OK;

  if (!stringBundle)
  {
    char* propertyURL = NULL;

    propertyURL = MIME_URL;

    nsCOMPtr<nsIStringBundleService> sBundleService = 
             do_GetService(NS_STRINGBUNDLE_CONTRACTID, &res); 
    if (NS_SUCCEEDED(res) && (nsnull != sBundleService)) 
    {
      res = sBundleService->CreateBundle(propertyURL, getter_AddRefs(stringBundle));
    }
  }

  if (stringBundle)
  {
    nsXPIDLString v;
    res = stringBundle->GetStringFromID(stringID, getter_Copies(v));

    if (NS_SUCCEEDED(res)) 
      tempString = ToNewUTF8String(v);
  }

  if (!tempString)
    tempString = nsCRT::strdup(resultString);

  return tempString;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult mimeSetNewURL ( nsMIMESession *  stream,
char *  url 
)

Definition at line 1973 of file mimemoz2.cpp.

{
  if ( (!stream) || (!url) || (!*url) )
    return NS_ERROR_FAILURE;

  mime_stream_data  *msd = (mime_stream_data *)stream->data_object;
  if (!msd)
    return NS_ERROR_FAILURE;

  char *tmpPtr = nsCRT::strdup(url);
  if (!tmpPtr)
    return NS_ERROR_FAILURE;

  PR_FREEIF(msd->url_name);
  msd->url_name = nsCRT::strdup(tmpPtr);
  return NS_OK;
}

Here is the call graph for this function:

nsresult nsMimeNewURI ( nsIURI **  aInstancePtrResult,
const char *  aSpec,
nsIURI aBase 
)

Definition at line 668 of file mimemoz2.cpp.

{  
  nsresult  res;

  if (nsnull == aInstancePtrResult) 
    return NS_ERROR_NULL_POINTER;
  
  nsCOMPtr<nsIIOService> pService(do_GetService(kIOServiceCID, &res));
  if (NS_FAILED(res)) 
    return NS_ERROR_FACTORY_NOT_REGISTERED;

  return pService->NewURI(nsDependentCString(aSpec), nsnull, aBase, aInstancePtrResult);
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult SetMailCharacterSetToMsgWindow ( MimeObject obj,
const char *  aCharacterSet 
)

Definition at line 683 of file mimemoz2.cpp.

{
  nsresult rv = NS_OK;

  if (obj && obj->options)
  {
    mime_stream_data *msd = (mime_stream_data *) (obj->options->stream_closure);
    if (msd)
    {
      nsIChannel *channel = msd->channel;
      if (channel)
      {
        nsCOMPtr<nsIURI> uri;
        channel->GetURI(getter_AddRefs(uri));
        if (uri)
        {
          nsCOMPtr<nsIMsgMailNewsUrl> msgurl (do_QueryInterface(uri));
          if (msgurl)
          {
            nsCOMPtr<nsIMsgWindow> msgWindow;
            msgurl->GetMsgWindow(getter_AddRefs(msgWindow));
            if (msgWindow)
              rv = msgWindow->SetMailCharacterSet(!nsCRT::strcasecmp(aCharacterSet, "us-ascii") ?
                                                  "ISO-8859-1" :
                                                  aCharacterSet);
          }
        }
      }
    }
  }

  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function: