pidgin 2.14.14dev
Loading...
Searching...
No Matches
mime.h File Reference

Rudimentary parsing of multi-part MIME messages into more accessible structures. More...

#include <glib.h>
Include dependency graph for mime.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct _PurpleMimeDocument PurpleMimeDocument
 A MIME document.
 
typedef struct _PurpleMimePart PurpleMimePart
 A part of a multipart MIME document.
 

Functions

PurpleMimeDocumentpurple_mime_document_new (void)
 Allocate an empty MIME document.
 
void purple_mime_document_free (PurpleMimeDocument *doc)
 Frees memory used in a MIME document and all of its parts and fields.
 
PurpleMimeDocumentpurple_mime_document_parse (const char *buf)
 Parse a MIME document from a NUL-terminated string.
 
PurpleMimeDocumentpurple_mime_document_parsen (const char *buf, gsize len)
 Parse a MIME document from a string.
 
void purple_mime_document_write (PurpleMimeDocument *doc, GString *str)
 Write (append) a MIME document onto a GString.
 
GList * purple_mime_document_get_fields (PurpleMimeDocument *doc)
 The list of fields in the header of a document.
 
const char * purple_mime_document_get_field (PurpleMimeDocument *doc, const char *field)
 Get the value of a specific field in the header of a document.
 
void purple_mime_document_set_field (PurpleMimeDocument *doc, const char *field, const char *value)
 Set or replace the value of a specific field in the header of a document.
 
GList * purple_mime_document_get_parts (PurpleMimeDocument *doc)
 The list of parts in a multipart document.
 
PurpleMimePartpurple_mime_part_new (PurpleMimeDocument *doc)
 Create and insert a new part into a MIME document.
 
GList * purple_mime_part_get_fields (PurpleMimePart *part)
 The list of fields in the header of a document part.
 
const char * purple_mime_part_get_field (PurpleMimePart *part, const char *field)
 Get the value of a specific field in the header of a document part.
 
char * purple_mime_part_get_field_decoded (PurpleMimePart *part, const char *field)
 Get the decoded value of a specific field in the header of a document part.
 
void purple_mime_part_set_field (PurpleMimePart *part, const char *field, const char *value)
 Set or replace the value of a specific field in the header of a document.
 
const char * purple_mime_part_get_data (PurpleMimePart *part)
 Get the (possibly encoded) data portion of a MIME document part.
 
void purple_mime_part_get_data_decoded (PurpleMimePart *part, guchar **data, gsize *len)
 Get the data portion of a MIME document part, after attempting to decode it according to the content-transfer-encoding field.
 
gsize purple_mime_part_get_length (PurpleMimePart *part)
 Get the length of the data portion of a MIME document part.
 
void purple_mime_part_set_data (PurpleMimePart *part, const char *data)
 

Detailed Description

Rudimentary parsing of multi-part MIME messages into more accessible structures.

Definition in file mime.h.

Typedef Documentation

◆ PurpleMimeDocument

typedef struct _PurpleMimeDocument PurpleMimeDocument

A MIME document.

Definition at line 44 of file mime.h.

◆ PurpleMimePart

typedef struct _PurpleMimePart PurpleMimePart

A part of a multipart MIME document.

Definition at line 49 of file mime.h.

Function Documentation

◆ purple_mime_document_free()

void purple_mime_document_free ( PurpleMimeDocument doc)

Frees memory used in a MIME document and all of its parts and fields.

Parameters
docThe MIME document to free.

◆ purple_mime_document_get_field()

const char * purple_mime_document_get_field ( PurpleMimeDocument doc,
const char *  field 
)

Get the value of a specific field in the header of a document.

Parameters
docThe MIME document.
fieldCase-insensitive field name.
Returns
Value associated with the indicated header field, or NULL if the field doesn't exist.

◆ purple_mime_document_get_fields()

GList * purple_mime_document_get_fields ( PurpleMimeDocument doc)

The list of fields in the header of a document.

Parameters
docThe MIME document.
Note
The return value of this function must not be modified or freed.
Returns
A list of strings indicating the fields (but not the values of the fields) in the header of doc.

◆ purple_mime_document_get_parts()

GList * purple_mime_document_get_parts ( PurpleMimeDocument doc)

The list of parts in a multipart document.

Parameters
docThe MIME document.
Note
The return value of this function must not be modified or freed.
Returns
List of PurpleMimePart contained within doc.

◆ purple_mime_document_parse()

PurpleMimeDocument * purple_mime_document_parse ( const char *  buf)

Parse a MIME document from a NUL-terminated string.

Parameters
bufThe NULL-terminated string containing the MIME-encoded data.
Returns
A MIME document.

◆ purple_mime_document_parsen()

PurpleMimeDocument * purple_mime_document_parsen ( const char *  buf,
gsize  len 
)

Parse a MIME document from a string.

Parameters
bufThe string containing the MIME-encoded data.
lenLength of buf.
Returns
A MIME document.

◆ purple_mime_document_set_field()

void purple_mime_document_set_field ( PurpleMimeDocument doc,
const char *  field,
const char *  value 
)

Set or replace the value of a specific field in the header of a document.

Parameters
docThe MIME document.
fieldCase-insensitive field name.
valueValue to associate with the indicated header field, of NULL to remove the field.

◆ purple_mime_part_get_data()

const char * purple_mime_part_get_data ( PurpleMimePart part)

Get the (possibly encoded) data portion of a MIME document part.

Parameters
partThe MIME document part.
Returns
NULL-terminated data found in the document part

◆ purple_mime_part_get_data_decoded()

void purple_mime_part_get_data_decoded ( PurpleMimePart part,
guchar **  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
partThe MIME documemt part.
dataBuffer for the data.
lenThe length of the buffer.

◆ purple_mime_part_get_field()

const char * purple_mime_part_get_field ( PurpleMimePart part,
const char *  field 
)

Get the value of a specific field in the header of a document part.

Parameters
partThe MIME document part.
fieldCase-insensitive name of the header field.
Returns
Value of the specified header field, or NULL if the field doesn't exist.

◆ purple_mime_part_get_fields()

GList * purple_mime_part_get_fields ( PurpleMimePart part)

The list of fields in the header of a document part.

Parameters
partThe MIME document part.
Note
The return value of this function must not be modified or freed.
Returns
List of strings indicating the fields (but not the values of the fields) in the header of part.

◆ purple_mime_part_get_length()

gsize purple_mime_part_get_length ( PurpleMimePart part)

Get the length of the data portion of a MIME document part.

Parameters
partThe MIME document part.
Returns
Length of the data in the document part.

◆ purple_mime_part_new()

PurpleMimePart * purple_mime_part_new ( PurpleMimeDocument doc)

Create and insert a new part into a MIME document.

Parameters
docThe new part's parent MIME document.

◆ purple_mime_part_set_field()

void purple_mime_part_set_field ( PurpleMimePart part,
const char *  field,
const char *  value 
)

Set or replace the value of a specific field in the header of a document.

Parameters
partThe part of the MIME document.
fieldCase-insensitive field name
valueValue to associate with the indicated header field, of NULL to remove the field.