예제 #1
0
static int
MimeInlineTextVCard_parse_begin (MimeObject *obj)
{
  int status = ((MimeObjectClass*)COM_GetmimeLeafClass())->parse_begin(obj);
  MimeInlineTextVCardClass *clazz;
  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.
  In this sample code, we tell it to start a table. */

  clazz = ((MimeInlineTextVCardClass *) obj->clazz);
  /* initialize vcard string to empty; */
  NS_MsgSACopy(&(clazz->vCardString), "");

  obj->options->state->separator_suppressed_p = true;
  return 0;
}
예제 #2
0
char *
MakeAbsoluteURL(char *base_url, char *relative_url)
{
  char            *retString = nullptr;
  nsIURI          *base = nullptr;

  // if either is NULL, just return the relative if safe...
  if (!base_url || !relative_url)
  {
    if (!relative_url)
      return nullptr;

    NS_MsgSACopy(&retString, relative_url);
    return retString;
  }

  nsresult err = nsMimeNewURI(&base, base_url, nullptr);
  if (err != NS_OK)
    return nullptr;

  nsCAutoString spec;

  nsIURI    *url = nullptr;
  err = nsMimeNewURI(&url, relative_url, base);
  if (err != NS_OK)
    goto done;

  err = url->GetSpec(spec);
  if (err)
  {
    retString = nullptr;
    goto done;
  }
  retString = ToNewCString(spec);

done:
  NS_IF_RELEASE(url);
  NS_IF_RELEASE(base);
  return retString;
}