Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions
nsMimeConverter Class Reference

#include <nsMimeConverter.h>

Inheritance diagram for nsMimeConverter:
Inheritance graph
[legend]
Collaboration diagram for nsMimeConverter:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsMimeConverter ()
virtual ~nsMimeConverter ()
NS_DECL_ISUPPORTS NS_IMETHOD DecodeMimeHeader (const char *header, char **decodedString, const char *default_charset=0, PRBool override_charset=PR_FALSE, PRBool eatContinuations=PR_TRUE)
NS_IMETHOD DecodeMimeHeader (const char *header, PRUnichar **decodedString, const char *default_charset=0, PRBool override_charset=PR_FALSE, PRBool eatContinuations=PR_TRUE)
NS_IMETHOD DecodeMimeHeader (const char *header, nsAString &decodedString, const char *default_charset=nsnull, PRBool override_charset=PR_FALSE, PRBool eatContinuations=PR_TRUE)
NS_IMETHOD EncodeMimePartIIStr (const char *header, PRBool structured, const char *mailCharset, PRInt32 fieldnamelen, PRInt32 encodedWordSize, char **encodedString)
NS_IMETHOD EncodeMimePartIIStr_UTF8 (const char *header, PRBool structured, const char *mailCharset, PRInt32 fieldnamelen, PRInt32 encodedWordSize, char **encodedString)
NS_IMETHOD B64EncoderInit (nsresult(*PR_CALLBACK output_fn)(const char *buf, PRInt32 size, void *closure), void *closure, MimeEncoderData **returnEncoderData)
NS_IMETHOD QPEncoderInit (nsresult(*PR_CALLBACK output_fn)(const char *buf, PRInt32 size, void *closure), void *closure, MimeEncoderData **returnEncoderData)
NS_IMETHOD UUEncoderInit (char *filename, nsresult(*PR_CALLBACK output_fn)(const char *buf, PRInt32 size, void *closure), void *closure, MimeEncoderData **returnEncoderData)
NS_IMETHOD EncoderDestroy (MimeEncoderData *data, PRBool abort_p)
NS_IMETHOD EncoderWrite (MimeEncoderData *data, const char *buffer, PRInt32 size, PRInt32 *written)
string encodeMimePartIIStr (in string header, in boolean structured, in string mailCharset, in long fieldnamelen, in long encodedWordSize)
string encodeMimePartIIStr_UTF8 (in string header, in boolean structured, in string mailCharset, in long fieldnamelen, in long encodedWordSize)

Detailed Description

Definition at line 61 of file nsMimeConverter.h.


Constructor & Destructor Documentation

Definition at line 63 of file nsMimeConverter.cpp.

{
}

Definition at line 67 of file nsMimeConverter.cpp.

{
}

Member Function Documentation

nsresult nsMimeConverter::B64EncoderInit ( nsresult(*)(const char *buf, PRInt32 size, void *closure output_fn,
void closure,
MimeEncoderData **  returnEncoderData 
) [virtual]

Implements nsIMimeConverter.

Definition at line 169 of file nsMimeConverter.cpp.

{
MimeEncoderData   *ptr;

  ptr = MimeB64EncoderInit(output_fn, closure);
  if (ptr)
  {
    *returnEncoderData = ptr;
    return NS_OK;
  }
  else
    return NS_ERROR_OUT_OF_MEMORY;
}

Here is the call graph for this function:

nsresult nsMimeConverter::DecodeMimeHeader ( const char *  header,
char **  decodedString,
const char *  default_charset = 0,
PRBool  override_charset = PR_FALSE,
PRBool  eatContinuations = PR_TRUE 
) [virtual]

Implements nsIMimeConverter.

Definition at line 72 of file nsMimeConverter.cpp.

{
  *decodedString = MIME_DecodeMimeHeader(header, default_charset, 
                                          override_charset,
                                          eatContinuations);
  return NS_OK;
}

Here is the call graph for this function:

nsresult nsMimeConverter::DecodeMimeHeader ( const char *  header,
PRUnichar **  decodedString,
const char *  default_charset = 0,
PRBool  override_charset = PR_FALSE,
PRBool  eatContinuations = PR_TRUE 
) [virtual]

Implements nsIMimeConverter.

Definition at line 86 of file nsMimeConverter.cpp.

{
  char *decodedCstr = nsnull;
  nsresult res = NS_OK;

  // apply MIME decode.
  decodedCstr = MIME_DecodeMimeHeader(header, default_charset,
                                      override_charset, eatContinuations);
  if (nsnull == decodedCstr) {
    *decodedString = ToNewUnicode(NS_ConvertUTF8toUCS2(header));
  } else {
    *decodedString = ToNewUnicode(NS_ConvertUTF8toUCS2(decodedCstr));
    PR_FREEIF(decodedCstr);
  }
  if (!(*decodedString))
    res = NS_ERROR_OUT_OF_MEMORY;
  return res;
}

Here is the call graph for this function:

nsresult nsMimeConverter::DecodeMimeHeader ( const char *  header,
nsAString &  decodedString,
const char *  default_charset = nsnull,
PRBool  override_charset = PR_FALSE,
PRBool  eatContinuations = PR_TRUE 
) [virtual]

Implements nsIMimeConverter.

Definition at line 111 of file nsMimeConverter.cpp.

{
  char *decodedCstr = nsnull;

  // apply MIME decode.
  decodedCstr = MIME_DecodeMimeHeader(header, default_charset,
                                      override_charset, eatContinuations);
  if (nsnull == decodedCstr) {
    CopyUTF8toUTF16(header, decodedString);
  } else {
    CopyUTF8toUTF16(decodedCstr, decodedString);
    PR_FREEIF(decodedCstr);
  }

  return NS_OK;
}

Here is the call graph for this function:

string nsIMimeConverter::encodeMimePartIIStr ( in string  header,
in boolean  structured,
in string  mailCharset,
in long  fieldnamelen,
in long  encodedWordSize 
) [inherited]
nsresult nsMimeConverter::EncodeMimePartIIStr ( const char *  header,
PRBool  structured,
const char *  mailCharset,
PRInt32  fieldnamelen,
PRInt32  encodedWordSize,
char **  encodedString 
)

Definition at line 133 of file nsMimeConverter.cpp.

{

  // Encoder needs utf-8 string.
  nsAutoString tempUnicodeString;
  nsresult rv = ConvertToUnicode(mailCharset, header, tempUnicodeString);
  NS_ENSURE_SUCCESS(rv, rv);
  rv = EncodeMimePartIIStr_UTF8(NS_ConvertUCS2toUTF8(tempUnicodeString).get(), structured, mailCharset, fieldnamelen, encodedWordSize, encodedString);
  return rv;
}

Here is the call graph for this function:

string nsIMimeConverter::encodeMimePartIIStr_UTF8 ( in string  header,
in boolean  structured,
in string  mailCharset,
in long  fieldnamelen,
in long  encodedWordSize 
) [inherited]
nsresult nsMimeConverter::EncodeMimePartIIStr_UTF8 ( const char *  header,
PRBool  structured,
const char *  mailCharset,
PRInt32  fieldnamelen,
PRInt32  encodedWordSize,
char **  encodedString 
)

Definition at line 150 of file nsMimeConverter.cpp.

{
  char *retString = MIME_EncodeMimePartIIStr(header, structured, mailCharset, fieldnamelen, encodedWordSize);
  if (retString == NULL)
    return NS_ERROR_FAILURE;
  else
  {
    *encodedString = retString;
    return NS_OK;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMimeConverter::EncoderDestroy ( MimeEncoderData data,
PRBool  abort_p 
) [virtual]

Implements nsIMimeConverter.

Definition at line 218 of file nsMimeConverter.cpp.

{
  MimeEncoderDestroy(data, abort_p);
  return NS_OK;
}

Here is the call graph for this function:

nsresult nsMimeConverter::EncoderWrite ( MimeEncoderData data,
const char *  buffer,
PRInt32  size,
PRInt32 written 
) [virtual]

Implements nsIMimeConverter.

Definition at line 225 of file nsMimeConverter.cpp.

{
  PRInt32   writeCount;
  writeCount = MimeEncoderWrite(data, buffer, size);
  *written = writeCount;
  return NS_OK;
}

Here is the call graph for this function:

nsresult nsMimeConverter::QPEncoderInit ( nsresult(*)(const char *buf, PRInt32 size, void *closure output_fn,
void closure,
MimeEncoderData **  returnEncoderData 
) [virtual]

Implements nsIMimeConverter.

Definition at line 185 of file nsMimeConverter.cpp.

{
MimeEncoderData   *ptr;

  ptr = MimeQPEncoderInit(output_fn, closure);
  if (ptr)
  {
    *returnEncoderData = ptr;
    return NS_OK;
  }
  else
    return NS_ERROR_OUT_OF_MEMORY;
}

Here is the call graph for this function:

nsresult nsMimeConverter::UUEncoderInit ( char *  filename,
nsresult(*)(const char *buf, PRInt32 size, void *closure output_fn,
void closure,
MimeEncoderData **  returnEncoderData 
) [virtual]

Implements nsIMimeConverter.

Definition at line 201 of file nsMimeConverter.cpp.

{
MimeEncoderData   *ptr;

  ptr = MimeUUEncoderInit(filename, output_fn, closure);
  if (ptr)
  {
    *returnEncoderData = ptr;
    return NS_OK;
  }
  else
    return NS_ERROR_OUT_OF_MEMORY;
}

Here is the call graph for this function:


The documentation for this class was generated from the following files: