| Top |
enum GMimePartEncodingType; GMimeReferences;time_t g_mime_utils_header_decode_date (constchar *in,int *tz_offset);char * g_mime_utils_header_format_date (time_t date,int tz_offset);char * g_mime_utils_generate_message_id (constchar *fqdn);char * g_mime_utils_decode_message_id (constchar *message_id); GMimeReferences * g_mime_references_decode (constchar *text);void g_mime_references_append (GMimeReferences **refs, constchar *msgid);void g_mime_references_clear (GMimeReferences **refs); GMimeReferences * g_mime_references_next (const GMimeReferences *ref);char * g_mime_utils_header_fold (constchar *in);char * g_mime_utils_header_printf (constchar *format, ...);char * g_mime_utils_quote_string (constchar *string);void g_mime_utils_unquote_string (char *string);gboolean g_mime_utils_text_is_8bit (unsignedchar *text,size_t len); GMimePartEncodingType g_mime_utils_best_encoding (unsignedchar *text,size_t len);char * g_mime_utils_decode_8bit (constchar *text,size_t len);char * g_mime_utils_header_decode_text (constchar *in);char * g_mime_utils_header_encode_text (constchar *in);char * g_mime_utils_header_decode_phrase (constchar *in);char * g_mime_utils_header_encode_phrase (constchar *in);char * g_mime_utils_8bit_header_decode (unsignedchar *in);char * g_mime_utils_8bit_header_encode (unsignedchar *in);char * g_mime_utils_8bit_header_encode_phrase (unsignedchar *in);char * g_mime_utils_structured_header_fold (constchar *in);char * g_mime_utils_unstructured_header_fold (constchar *in); #define GMIME_BASE64_ENCODE_LEN (x)size_t g_mime_utils_base64_decode_step (unsignedchar *in,size_t inlen, unsignedchar *out,int *state,guint32 *save);size_t g_mime_utils_base64_encode_step (unsignedchar *in,size_t inlen, unsignedchar *out,int *state,guint32 *save);size_t g_mime_utils_base64_encode_close (unsignedchar *in,size_t inlen, unsignedchar *out,int *state,guint32 *save); #define GMIME_UUDECODE_STATE_INIT #define GMIME_UUDECODE_STATE_BEGIN #define GMIME_UUDECODE_STATE_END #define GMIME_UUENCODE_LEN (x)size_t g_mime_utils_uudecode_step (unsignedchar *in,size_t inlen, unsignedchar *out,int *state,guint32 *save);size_t g_mime_utils_uuencode_step (unsignedchar *in,size_t inlen, unsignedchar *out, unsignedchar *uubuf,int *state,guint32 *save);size_t g_mime_utils_uuencode_close (unsignedchar *in,size_t inlen, unsignedchar *out, unsignedchar *uubuf,int *state,guint32 *save); #define GMIME_QP_ENCODE_LEN (x)size_t g_mime_utils_quoted_decode_step (unsignedchar *in,size_t inlen, unsignedchar *out,int *state,guint32 *save);size_t g_mime_utils_quoted_encode_step (unsignedchar *in,size_t inlen, unsignedchar *out,int *state,guint32 *save);size_t g_mime_utils_quoted_encode_close (unsignedchar *in,size_t inlen, unsignedchar *out,int *state,guint32 *save);
typedef enum {
GMIME_PART_ENCODING_DEFAULT,
GMIME_PART_ENCODING_7BIT,
GMIME_PART_ENCODING_8BIT,
GMIME_PART_ENCODING_BINARY,
GMIME_PART_ENCODING_BASE64,
GMIME_PART_ENCODING_QUOTEDPRINTABLE,
GMIME_PART_ENCODING_UUENCODE,
GMIME_PART_NUM_ENCODINGS
} GMimePartEncodingType;
A Content-Transfer-Encoding type.
| Default transfer encoding. | |
| 7bit text transfer encoding. | |
| 8bit text transfer encoding. | |
| Binary transfer encoding. | |
| Base64 transfer encoding. | |
| Quoted-printable transfer encoding. | |
| Uuencode transfer encoding. | |
| The number of available transfer encoding enum values. |
typedef struct {
GMimeReferences *next;
char *msgid;
} GMimeReferences;
A List of references, as per the References or In-Reply-To header fields.
GMimeReferences * |
Pointer to the next reference. |
|
Reference message-id. |
time_t g_mime_utils_header_decode_date (constchar *in,int *tz_offset);
Decodes the rfc822 date string and saves the GMT offset into
tz_offset if non-NULL.
|
input date string |
|
timezone offset |
Returns : |
the time_t representation of the date string specified by
in or (time_t) 0tz_offset is non-NULL, the value
of the timezone offset will be stored.
|
char * g_mime_utils_header_format_date (time_t date,int tz_offset);
Allocates a string buffer containing the rfc822 formatted date
string represented by time and tz_offset.
|
time_t date representation |
|
Timezone offset |
Returns : |
a valid string representation of the date. |
char * g_mime_utils_generate_message_id (constchar *fqdn);
Generates a unique Message-Id.
|
Fully qualified domain name |
Returns : |
a unique string in an addr-spec format suitable for use as a Message-Id. |
char * g_mime_utils_decode_message_id (constchar *message_id);
Decodes a msg-id as defined by rfc822.
|
string containing a message-id |
Returns : |
the addr-spec portion of the msg-id. |
GMimeReferences * g_mime_references_decode (constchar *text);
Decodes a list of msg-ids as in the References and/or In-Reply-To headers defined in rfc822.
|
string containing a list of msg-ids |
Returns : |
a list of referenced msg-ids. |
void g_mime_references_append (GMimeReferences **refs, constchar *msgid);
Appends a reference to msgid to the list of references.
|
the address of a GMimeReferences list |
|
a message-id string |
void g_mime_references_clear (GMimeReferences **refs);
Clears the GMimeReferences list and resets it to NULL
|
address of a GMimeReferences list |
GMimeReferences * g_mime_references_next (const GMimeReferences *ref);
Advances to the next reference node in the GMimeReferences list.
|
a GMimeReferences list |
Returns : |
the next reference node in the GMimeReferences list. |
char * g_mime_utils_header_fold (constchar *in);
Folds a structured header according to the rules in rfc822.
|
input header string |
Returns : |
an allocated string containing the folded header. |
char * g_mime_utils_header_printf (constchar *format, ...);
Allocates a buffer containing a formatted header specified by the
Varargs.
|
string format |
|
arguments |
Returns : |
an allocated string containing the folded header specified
by format and the following arguments.
|
char * g_mime_utils_quote_string (constchar *string);
Quotes string as needed according to the rules in rfc2045.
|
input string |
Returns : |
an allocated string containing the escaped and quoted (if needed to be) input string. The decision to quote the string is based on whether or not the input string contains any 'tspecials' as defined by rfc2045. |
void g_mime_utils_unquote_string (char *string);
Unquotes and unescapes a string.
|
string |
gboolean g_mime_utils_text_is_8bit (unsignedchar *text,size_t len);
Determines if text contains 8bit characters within the first len
bytes.
|
text to check for 8bit chars |
|
text length |
Returns : |
%TRUE if the text contains 8bit characters or FALSE |
GMimePartEncodingType g_mime_utils_best_encoding (unsignedchar *text,size_t len);
Determines the best content encoding for the first len bytes of
text.
|
text to encode |
|
text length |
Returns : |
a GMimePartEncodingType that is determined to be the best encoding type for the specified block of text. ("best" in this particular case means best compression) |
char * g_mime_utils_decode_8bit (constchar *text,size_t len);
Attempts to convert text in an unknown 8bit/multibyte charset into UTF-8 by finding the charset which will convert the most bytes into valid UTF-8 characters as possible. If no exact match can be found, it will choose the best match and convert invalid byte sequences into question-marks (?) in the returned string buffer.
|
input text in unknown 8bit/multibyte character set |
|
input text length |
Returns : |
a UTF-8 string representation of text.
|
char * g_mime_utils_header_decode_text (constchar *in);
Decodes an rfc2047 encoded 'text' header.
Note: See g_mime_set_user_charsets() for details on how charset
conversion is handled for unencoded 8bit text and/or wrongly
specified rfc2047 encoded-word tokens.
|
header to decode |
Returns : |
a newly allocated UTF-8 string representing the the decoded header. |
char * g_mime_utils_header_encode_text (constchar *in);
Encodes a 'text' header according to the rules in rfc2047.
|
header to encode |
Returns : |
the encoded header. Useful for encoding headers like "Subject". |
char * g_mime_utils_header_decode_phrase (constchar *in);
Decodes an rfc2047 encoded 'phrase' header.
Note: See g_mime_set_user_charsets() for details on how charset
conversion is handled for unencoded 8bit text and/or wrongly
specified rfc2047 encoded-word tokens.
|
header to decode |
Returns : |
a newly allocated UTF-8 string representing the the decoded header. |
char * g_mime_utils_header_encode_phrase (constchar *in);
Encodes a 'phrase' header according to the rules in rfc2047.
|
header to encode |
Returns : |
the encoded 'phrase'. Useful for encoding internet addresses. |
char * g_mime_utils_8bit_header_decode (unsignedchar *in);
g_mime_utils_8bit_header_decode is deprecated and should not be used in newly-written code.
Decodes an rfc2047 encoded header.
WARNING: This function is deprecated. Use
g_mime_utils_header_decode_text() instead.
|
header to decode |
Returns : |
the decoded header (which will be in UTF-8 if at all possible). |
char * g_mime_utils_8bit_header_encode (unsignedchar *in);
g_mime_utils_8bit_header_encode is deprecated and should not be used in newly-written code.
Encodes a 'text' header according to the rules in rfc2047.
WARNING: This function is deprecated. Use
g_mime_utils_header_encode_text() instead.
|
header to encode |
Returns : |
the encoded header. Useful for encoding headers like "Subject". |
char * g_mime_utils_8bit_header_encode_phrase (unsignedchar *in);
g_mime_utils_8bit_header_encode_phrase is deprecated and should not be used in newly-written code.
Encodes a 'phrase' header according to the rules in rfc2047.
WARNING: This function is deprecated. Use
g_mime_utils_header_encode_phrase() instead.
|
header to encode |
Returns : |
the encoded 'phrase'. Useful for encoding internet addresses. |
char * g_mime_utils_structured_header_fold (constchar *in);
Folds a structured header according to the rules in rfc822.
|
input header string |
Returns : |
an allocated string containing the folded header. |
char * g_mime_utils_unstructured_header_fold (constchar *in);
Folds an unstructured header according to the rules in rfc822.
|
input header string |
Returns : |
an allocated string containing the folded header. |
#define GMIME_BASE64_ENCODE_LEN(x) ((size_t) (((((x) + 2) / 57) * 77) + 77))
Calculates the maximum number of bytes needed to base64 encode the
full input buffer of length x.
|
Length of the input data to encode |
size_t g_mime_utils_base64_decode_step (unsignedchar *in,size_t inlen, unsignedchar *out,int *state,guint32 *save);
Decodes a chunk of base64 encoded data.
|
input stream |
|
max length of data to decode |
|
output stream |
|
holds the number of bits that are stored in save
|
|
leftover bits that have not yet been decoded |
Returns : |
the number of bytes decoded (which have been dumped in out).
|
size_t g_mime_utils_base64_encode_step (unsignedchar *in,size_t inlen, unsignedchar *out,int *state,guint32 *save);
Base64 encodes a chunk of data. Performs an 'encode step', only encodes blocks of 3 characters to the output at a time, saves left-over state in state and save (initialise to 0 on first invocation).
|
input stream |
|
length of the input |
|
output string |
|
holds the number of bits that are stored in save
|
|
leftover bits that have not yet been encoded |
Returns : |
the number of bytes encoded. |
size_t g_mime_utils_base64_encode_close (unsignedchar *in,size_t inlen, unsignedchar *out,int *state,guint32 *save);
Base64 encodes the input stream to the output stream. Call this
when finished encoding data with g_mime_utils_base64_encode_step()
to flush off the last little bit.
|
input stream |
|
length of the input |
|
output string |
|
holds the number of bits that are stored in save
|
|
leftover bits that have not yet been encoded |
Returns : |
the number of bytes encoded. |
#define GMIME_UUDECODE_STATE_INIT (0)
Initial state for the g_mime_utils_uudecode_step() function.
#define GMIME_UUDECODE_STATE_BEGIN (1 << 16)
State for the g_mime_utils_uudecode_step() function, denoting that
the 'begin' line has been found.
#define GMIME_UUDECODE_STATE_END (1 << 17)
State for the g_mime_utils_uudecode_step() function, denoting that
the end of the UU encoded block has been found.
#define GMIME_UUENCODE_LEN(x) ((size_t) (((((x) + 2) / 45) * 62) + 64))
Calculates the maximum number of bytes needed to uuencode the full
input buffer of length x.
|
Length of the input data to encode |
size_t g_mime_utils_uudecode_step (unsignedchar *in,size_t inlen, unsignedchar *out,int *state,guint32 *save);
Uudecodes a chunk of data. Performs a 'decode step' on a chunk of uuencoded data. Assumes the "begin mode filename" line has been stripped off.
|
input stream |
|
max length of data to decode |
|
output stream |
|
holds the number of bits that are stored in save
|
|
leftover bits that have not yet been decoded |
Returns : |
the number of bytes decoded. |
size_t g_mime_utils_uuencode_step (unsignedchar *in,size_t inlen, unsignedchar *out, unsignedchar *uubuf,int *state,guint32 *save);
Uuencodes a chunk of data. Performs an 'encode step', only encodes
blocks of 45 characters to the output at a time, saves left-over
state in uubuf, state and save (initialize to 0 on first
invocation).
|
input stream |
|
input stream length |
|
output stream |
|
temporary buffer of 60 bytes |
|
holds the number of bits that are stored in save
|
|
leftover bits that have not yet been encoded |
Returns : |
the number of bytes encoded. |
size_t g_mime_utils_uuencode_close (unsignedchar *in,size_t inlen, unsignedchar *out, unsignedchar *uubuf,int *state,guint32 *save);
Uuencodes a chunk of data. Call this when finished encoding data
with g_mime_utils_uuencode_step() to flush off the last little bit.
|
input stream |
|
input stream length |
|
output stream |
|
temporary buffer of 60 bytes |
|
holds the number of bits that are stored in save
|
|
leftover bits that have not yet been encoded |
Returns : |
the number of bytes encoded. |
#define GMIME_QP_ENCODE_LEN(x) ((size_t) ((((x) / 24) * 74) + 74))
Calculates the maximum number of bytes needed to encode the full
input buffer of length x using the quoted-printable encoding.
|
Length of the input data to encode |
size_t g_mime_utils_quoted_decode_step (unsignedchar *in,size_t inlen, unsignedchar *out,int *state,guint32 *save);
Decodes a block of quoted-printable encoded data. Performs a 'decode step' on a chunk of QP encoded data.
|
input stream |
|
max length of data to decode |
|
output stream |
|
holds the number of bits that are stored in save
|
|
leftover bits that have not yet been decoded |
Returns : |
the number of bytes decoded. |
size_t g_mime_utils_quoted_encode_step (unsignedchar *in,size_t inlen, unsignedchar *out,int *state,guint32 *save);
Quoted-printable encodes a block of text. Performs an 'encode step', saves left-over state in state and save (initialise to -1 on first invocation).
|
input stream |
|
length of the input |
|
output string |
|
holds the number of bits that are stored in save
|
|
leftover bits that have not yet been encoded |
Returns : |
the number of bytes encoded. |
size_t g_mime_utils_quoted_encode_close (unsignedchar *in,size_t inlen, unsignedchar *out,int *state,guint32 *save);
Quoted-printable encodes a block of text. Call this when finished
encoding data with g_mime_utils_quoted_encode_step() to flush off
the last little bit.
|
input stream |
|
length of the input |
|
output string |
|
holds the number of bits that are stored in save
|
|
leftover bits that have not yet been encoded |
Returns : |
the number of bytes encoded. |