Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions | Variables
nsSMIMEStub.cpp File Reference
#include "nsSMIMEStub.h"
#include "prlog.h"
#include "prmem.h"
#include "plstr.h"
#include "mimexpcom.h"
#include "mimecth.h"
#include "mimeobj.h"
#include "nsCRT.h"
#include "nsReadableUtils.h"
#include "nsIStringBundle.h"

Go to the source code of this file.

Defines

#define SMIME_PROPERTIES_URL   "chrome://messenger/locale/smime.properties"
#define SMIME_STR_NOT_SUPPORTED_ID   1000

Functions

static char * SMimeGetStringByID (PRInt32 aMsgId)
static int MimeInlineTextSMIMEStub_parse_line (char *, PRInt32, MimeObject *)
static int MimeInlineTextSMIMEStub_parse_eof (MimeObject *, PRBool)
static int MimeInlineTextSMIMEStub_parse_begin (MimeObject *obj)
 MimeDefClass (MimeInlineTextSMIMEStub, MimeInlineTextSMIMEStubClass, mimeInlineTextSMIMEStubClass, NULL)
MimeObjectClassMIME_SMimeCreateContentTypeHandlerClass (const char *content_type, contentTypeHandlerInitStruct *initStruct)
static int MimeInlineTextSMIMEStubClassInitialize (MimeInlineTextSMIMEStubClass *clazz)
int GenerateMessage (char **html)

Variables

static nsCOMPtr< nsIStringBundlestringBundle = nsnull

Define Documentation

#define SMIME_PROPERTIES_URL   "chrome://messenger/locale/smime.properties"

Definition at line 50 of file nsSMIMEStub.cpp.

Definition at line 51 of file nsSMIMEStub.cpp.


Function Documentation

int GenerateMessage ( char **  html)

Definition at line 141 of file nsSMIMEStub.cpp.

{
  nsCString temp;
  temp.Append("<BR><text=\"#000000\" bgcolor=\"#FFFFFF\" link=\"#FF0000\" vlink=\"#800080\" alink=\"#0000FF\">");
  temp.Append("<center><table BORDER=1 ><tr><td><CENTER>");

  char *tString = SMimeGetStringByID(SMIME_STR_NOT_SUPPORTED_ID);
  temp.Append(tString);
  PR_FREEIF(tString);

  temp.Append("</CENTER></td></tr></table></center><BR>");
  *html = ToNewCString(temp);
  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 113 of file nsSMIMEStub.cpp.

{
  MimeObjectClass *clazz = (MimeObjectClass *)&mimeInlineTextSMIMEStubClass;
  /* 
   * Must set the superclass by hand.
   */
  if (!COM_GetmimeInlineTextClass())
    return NULL;

  clazz->superclass = (MimeObjectClass *)COM_GetmimeInlineTextClass();
  initStruct->force_inline_display = PR_TRUE;
  return clazz;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 157 of file nsSMIMEStub.cpp.

{
  MimeInlineTextSMIMEStubClass *clazz;
  int status = ((MimeObjectClass*)COM_GetmimeLeafClass())->parse_begin(obj);
  
  if (status < 0) 
    return status;
  
  if (!obj->output_p) 
    return 0;
  if (!obj->options || !obj->options->write_html_p) 
    return 0;
  
  /* This is a fine place to write out any HTML before the real meat begins. */  

  // Initialize the clazz variable...
  clazz = ((MimeInlineTextSMIMEStubClass *) obj->clazz);
  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int MimeInlineTextSMIMEStub_parse_eof ( MimeObject obj,
PRBool  abort_p 
) [static]

Definition at line 198 of file nsSMIMEStub.cpp.

{
  int status = 0;
  char* html = NULL;
  
  if (obj->closed_p) return 0;

  /* Run parent method first, to flush out any buffered data. */
  status = ((MimeObjectClass*)COM_GetmimeInlineTextClass())->parse_eof(obj, abort_p);
  if (status < 0) 
    return status;

  if (  (obj->options) && 
        ((obj->options->format_out == nsMimeOutput::nsMimeMessageQuoting) ||
         (obj->options->format_out == nsMimeOutput::nsMimeMessageBodyQuoting))
     )
    return 0;

  status = GenerateMessage(&html);
  if (status < 0) 
    return status;
  
  status = COM_MimeObject_write(obj, html, PL_strlen(html), PR_TRUE);
  PR_FREEIF(html);
  if (status < 0) 
    return status;
 
  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int MimeInlineTextSMIMEStub_parse_line ( char *  line,
PRInt32  length,
MimeObject obj 
) [static]

Definition at line 178 of file nsSMIMEStub.cpp.

{
 /* 
  * This routine gets fed each line of data, one at a time. We just buffer
  * it all up, to be dealt with all at once at the end. 
  */  
  if (!obj->output_p) 
    return 0;
  if (!obj->options || !obj->options->output_fn) 
    return 0;

  if (!obj->options->write_html_p) 
  {
    return COM_MimeObject_write(obj, line, length, PR_TRUE);
  }
  
  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 129 of file nsSMIMEStub.cpp.

{
  MimeObjectClass *oclass = (MimeObjectClass *) clazz;
  NS_ASSERTION(!oclass->class_initialized, "1.1 <rhp@netscape.com> 28 Nov 1999 19:36");
  oclass->parse_begin = MimeInlineTextSMIMEStub_parse_begin;
  oclass->parse_line  = MimeInlineTextSMIMEStub_parse_line;
  oclass->parse_eof   = MimeInlineTextSMIMEStub_parse_eof;

  return 0;
}

Here is the call graph for this function:

static char* SMimeGetStringByID ( PRInt32  aMsgId) [static]

Definition at line 57 of file nsSMIMEStub.cpp.

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

#ifdef XP_MAC
nsCOMPtr<nsIStringBundle> stringBundle = nsnull;
#endif

       if (!stringBundle)
       {
              static const char propertyURL[] = SMIME_PROPERTIES_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)
       {
              PRUnichar *ptrv = nsnull;
              res = stringBundle->GetStringFromID(aMsgId, &ptrv);

              if (NS_FAILED(res)) 
      return nsCRT::strdup("???");
              else
    {
      nsAutoString v;
      v.Append(ptrv);
           PR_FREEIF(ptrv);
      tempString = ToNewUTF8String(v);
    }
       }

  if (!tempString)
    return nsCRT::strdup("???");
  else
    return tempString;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 54 of file nsSMIMEStub.cpp.