Logo Search packages:      
Sourcecode: gaim-meanwhile version File versions  Download package

void gaim_mime_part_get_data_decoded ( GaimMimePart part,
char **  data,
gsize *  len 
)

Get the data portion of a MIME document part, after attempting to decode it according to the content-transfer-encoding field. If the specified encoding method is not supported, this function will return NULL.

Parameters:
part the MIME documemt part
 

Definition at line 306 of file mime.c.

                                                      {
  const char *enc;

  g_return_if_fail(part != NULL);
  g_return_if_fail(data != NULL);
  g_return_if_fail(len != NULL);

  g_return_if_fail(part->data != NULL);

  enc = gaim_mime_part_get_field(part, "content-transfer-encoding");

  if(! enc) {
    *data = g_strdup(part->data->str);
    *len = part->data->len;

  } else if(! g_ascii_strcasecmp(enc, "7bit")) {
    *data = g_strdup(part->data->str);
    *len = part->data->len;

  } else if(! g_ascii_strcasecmp(enc, "8bit")) {
    *data = g_strdup(part->data->str);
    *len = part->data->len;

  } else if(! g_ascii_strcasecmp(enc, "base16")) {
    *len = gaim_base16_decode(part->data->str, (unsigned char **) data);

  } else if(! g_ascii_strcasecmp(enc, "base64")) {
    gaim_base64_decode(part->data->str, data, (int *) len);

  } else if(! g_ascii_strcasecmp(enc, "quoted-printable")) {
    gaim_quotedp_decode(part->data->str, data, (int *) len);

  } else {
    gaim_debug_warning("mime", "gaim_mime_part_get_data_decoded:"
                   " unknown encoding '%s'\n", enc);
    *data = NULL;
    *len = 0;
  }
}


Generated by  Doxygen 1.6.0   Back to index