nsCAutoString decoderId(NS_LITERAL_CSTRING("@mozilla.org/image/decoder;2?type=") + nsDependentCString(content_type)); reg->IsContractIDRegistered(decoderId.get(), &isReg);
loader->SupportImageWithMimeType(content_type, &isReg);
mime_find_class (const char *content_type, MimeHeaders *hdrs,				 MimeDisplayOptions *opts, PRBool exact_match_p){  MimeObjectClass *clazz = 0;  MimeObjectClass *tempClass = 0;  contentTypeHandlerInitStruct  ctHandlerInfo;  /*   * What we do first is check for an external content handler plugin.   * This will actually extend the mime handling by calling a routine   * which will allow us to load an external content type handler  * for specific content types. If one is not found, we will drop back  * to the default handler.  */  if ((tempClass = mime_locate_external_content_handler(content_type, &ctHandlerInfo)) != NULL)  {    clazz = (MimeObjectClass *)tempClass;  }  else  {    if (!content_type || !*content_type ||      !nsCRT::strcasecmp(content_type, "text"))  /* with no / in the type */      clazz = (MimeObjectClass *)&mimeUntypedTextClass;          /* Subtypes of text...    */    else if (!nsCRT::strncasecmp(content_type,			"text/", 5))    {      if      (!nsCRT::strcasecmp(content_type+5,		"html"))        clazz = (MimeObjectClass *)&mimeInlineTextHTMLClass;      else if (!nsCRT::strcasecmp(content_type+5,		"enriched"))        clazz = (MimeObjectClass *)&mimeInlineTextEnrichedClass;      else if (!nsCRT::strcasecmp(content_type+5,		"richtext"))        clazz = (MimeObjectClass *)&mimeInlineTextRichtextClass;      else if      (!nsCRT::strcasecmp(content_type+5,		"rtf"))        clazz = (MimeObjectClass *)&mimeExternalObjectClass;      else if (!nsCRT::strcasecmp(content_type+5,		"plain"))      {        // Preliminary use the normal plain text        clazz = (MimeObjectClass *)&mimeInlineTextPlainClass;        PRBool disable_format_flowed = PR_FALSE;        nsIPref *pref = GetPrefServiceManager(opts);         if (pref)          (void)pref->GetBoolPref(                           "mailnews.display.disable_format_flowed_support",                           &disable_format_flowed);                if(!disable_format_flowed)        {          // Check for format=flowed, damn, it is already stripped away from          // the contenttype!          // Look in headers instead even though it's expensive and clumsy          // First find Content-Type:          char *content_type_row =            (hdrs             ? MimeHeaders_get(hdrs, HEADER_CONTENT_TYPE,                               PR_FALSE, PR_FALSE)             : 0);          // Then the format parameter if there is one.          // I would rather use a PARAM_FORMAT but I can't find the right          // place to put the define. The others seems to be in net.h          // but is that really really the right place? There is also          // a nsMimeTypes.h but that one isn't included. Bug?          char *content_type_format =            (content_type_row             ? MimeHeaders_get_parameter(content_type_row, "format", NULL, NULL)             : 0);          if (content_type_format && !nsCRT::strcasecmp(content_type_format,                                                           "flowed"))            clazz = (MimeObjectClass *)&mimeInlineTextPlainFlowedClass;          PR_FREEIF(content_type_format);          PR_FREEIF(content_type_row);        }      }      else if (!exact_match_p)        clazz = (MimeObjectClass *)&mimeInlineTextPlainClass;    }        /* Subtypes of multipart...    */    else if (!nsCRT::strncasecmp(content_type,			"multipart/", 10))    {      if      (!nsCRT::strcasecmp(content_type+10,	"alternative"))        clazz = (MimeObjectClass *)&mimeMultipartAlternativeClass;      else if (!nsCRT::strcasecmp(content_type+10,	"related"))        clazz = (MimeObjectClass *)&mimeMultipartRelatedClass;      else if (!nsCRT::strcasecmp(content_type+10,	"digest"))        clazz = (MimeObjectClass *)&mimeMultipartDigestClass;      else if (!nsCRT::strcasecmp(content_type+10,	"appledouble") ||        !nsCRT::strcasecmp(content_type+10,	"header-set"))        clazz = (MimeObjectClass *)&mimeMultipartAppleDoubleClass;      else if (!nsCRT::strcasecmp(content_type+10,	"parallel"))        clazz = (MimeObjectClass *)&mimeMultipartParallelClass;      else if (!nsCRT::strcasecmp(content_type+10,	"mixed"))        clazz = (MimeObjectClass *)&mimeMultipartMixedClass;#ifdef ENABLE_SMIME            else if (!nsCRT::strcasecmp(content_type+10,	"signed"))      {      /* Check that the "protocol" and "micalg" parameters are ones we        know about. */        char *ct = (hdrs          ? MimeHeaders_get(hdrs, HEADER_CONTENT_TYPE,										PR_FALSE, PR_FALSE)                    : 0);        char *proto = (ct          ? MimeHeaders_get_parameter(ct, PARAM_PROTOCOL, NULL, NULL)          : 0);        char *micalg = (ct          ? MimeHeaders_get_parameter(ct, PARAM_MICALG, NULL, NULL)          : 0);                  if (proto && (!nsCRT::strcasecmp(proto, APPLICATION_XPKCS7_SIGNATURE) &&                          micalg && (!nsCRT::strcasecmp(micalg, PARAM_MICALG_MD5) ||                                                 !nsCRT::strcasecmp(micalg, PARAM_MICALG_SHA1) ||                                                 !nsCRT::strcasecmp(micalg, PARAM_MICALG_SHA1_2) ||                                                 !nsCRT::strcasecmp(micalg, PARAM_MICALG_SHA1_3) ||                                                 !nsCRT::strcasecmp(micalg, PARAM_MICALG_SHA1_4) ||                                                 !nsCRT::strcasecmp(micalg, PARAM_MICALG_SHA1_5) ||                                                 !nsCRT::strcasecmp(micalg, PARAM_MICALG_MD2))))                        clazz = (MimeObjectClass *)&mimeMultipartSignedCMSClass;                  else                        clazz = 0;                  PR_FREEIF(proto);        PR_FREEIF(micalg);        PR_FREEIF(ct);      } #endif            if (!clazz && !exact_match_p)        /* Treat all unknown multipart subtypes as "multipart/mixed" */        clazz = (MimeObjectClass *)&mimeMultipartMixedClass;    }        /* Subtypes of message...    */    else if (!nsCRT::strncasecmp(content_type,			"message/", 8))    {      if      (!nsCRT::strcasecmp(content_type+8,		"rfc822") ||        !nsCRT::strcasecmp(content_type+8,		"news"))        clazz = (MimeObjectClass *)&mimeMessageClass;      else if (!nsCRT::strcasecmp(content_type+8,		"external-body"))        clazz = (MimeObjectClass *)&mimeExternalBodyClass;      else if (!nsCRT::strcasecmp(content_type+8,		"partial"))        /* I guess these are most useful as externals, for now... */        clazz = (MimeObjectClass *)&mimeExternalObjectClass;      else if (!exact_match_p)        /* Treat all unknown message subtypes as "text/plain" */        clazz = (MimeObjectClass *)&mimeInlineTextPlainClass;    }        /* The magic image types which we are able to display internally...    */    else if (!nsCRT::strncasecmp(content_type,		"image/", 6)) {        nsCOMPtr<nsIComponentRegistrar> reg;        NS_GetComponentRegistrar(getter_AddRefs(reg));        PRBool isReg = PR_FALSE;        nsCAutoString decoderId(NS_LITERAL_CSTRING("@mozilla.org/image/decoder;2?type=") + nsDependentCString(content_type));        reg->IsContractIDRegistered(decoderId.get(), &isReg);        if (isReg)          clazz = (MimeObjectClass *)&mimeInlineImageClass;    }    #ifdef ENABLE_SMIME    else if (!nsCRT::strcasecmp(content_type, APPLICATION_XPKCS7_MIME))	        clazz = (MimeObjectClass *)&mimeEncryptedCMSClass;#endif    /* A few types which occur in the real world and which we would otherwise    treat as non-text types (which would be bad) without this special-case...    */    else if (!nsCRT::strcasecmp(content_type,			APPLICATION_PGP) ||    !nsCRT::strcasecmp(content_type,			APPLICATION_PGP2))    clazz = (MimeObjectClass *)&mimeInlineTextPlainClass;        else if (!nsCRT::strcasecmp(content_type,			SUN_ATTACHMENT))      clazz = (MimeObjectClass *)&mimeSunAttachmentClass;          /* Everything else gets represented as a clickable link.    */    else if (!exact_match_p)      clazz = (MimeObjectClass *)&mimeExternalObjectClass;    } if (!exact_match_p)   PR_ASSERT(clazz);  if (!clazz) return 0;  PR_ASSERT(clazz);  if (clazz && !clazz->class_initialized)	{	  int status = mime_classinit(clazz);	  if (status < 0) return 0;	}  return clazz;}