| Top |
const char *
g_mime_header_id_to_name (GMimeHeaderId id);
Gets the canonical field name for id
. Like MimeKit's ToHeaderName(),
unknown and out-of-range identifiers return "Unknown".
GMimeHeaderId
g_mime_header_id_from_name (const char *name);
Looks up a common header field, ignoring ASCII case. The entire name
must match; whitespace and colons are not removed. Unrecognized names,
including extension fields, map to GMIME_HEADER_UNKNOWN.
char * (*GMimeHeaderRawValueFormatter) (GMimeHeader *header,GMimeFormatOptions *options,const char *value,const char *charset);
Function callback for encoding and formatting a header value.
char * g_mime_header_format_addrlist (GMimeHeader *header,GMimeFormatOptions *options,const char *value,const char *charset);
Parses the value
and then re-formats it to conform to the formatting options,
folding the value if necessary.
header |
||
options |
a GMimeFormatOptions or |
[nullable] |
value |
a Sender, From, Reply-To, To, Cc, or Bcc header value |
|
charset |
a charset (note: unused) |
char * g_mime_header_format_content_disposition (GMimeHeader *header,GMimeFormatOptions *options,const char *value,const char *charset);
Parses the value
and then re-formats it to conform to the formatting options,
folding the value if necessary.
header |
||
options |
a GMimeFormatOptions or |
[nullable] |
value |
a Content-Disposition header value |
|
charset |
a charset (note: unused) |
char * g_mime_header_format_content_type (GMimeHeader *header,GMimeFormatOptions *options,const char *value,const char *charset);
Parses the value
and then re-formats it to conform to the formatting options,
folding the value if necessary.
header |
||
options |
a GMimeFormatOptions or |
[nullable] |
value |
a Content-Type header value |
|
charset |
a charset (note: unused) |
char * g_mime_header_format_default (GMimeHeader *header,GMimeFormatOptions *options,const char *value,const char *charset);
Parses the value
and then re-formats it to conform to the formatting options,
folding the value if necessary.
International formatting emits UTF-8 without RFC 2047 encoding and counts
UTF-16 units when folding, keeping each Unicode character intact.
header |
||
options |
a GMimeFormatOptions or |
[nullable] |
value |
a header value |
|
charset |
a charset to use when encoding the |
char * g_mime_header_format_disposition_notification_options (GMimeHeader *header,GMimeFormatOptions *options,const char *value,const char *charset);
Removes whitespace within notification parameters and folds between parameters using the configured line length and newline format. Individual parameters are not split, and the first parameter is never moved off the initial line, even if it exceeds the line-length target.
header |
||
options |
a GMimeFormatOptions or |
[nullable] |
value |
a Disposition-Notification-Options header value |
|
charset |
a charset (note: unused) |
char * g_mime_header_format_dkim_signature (GMimeHeader *header,GMimeFormatOptions *options,const char *value,const char *charset);
Compacts tag whitespace and folds using the configured line length and newline format. Signature and body-hash tags start continuation lines. Long h and z tags fold between list entries; other long tags are split. Values are treated as ASCII, with lengths and split positions counted in bytes.
header |
||
options |
a GMimeFormatOptions or |
[nullable] |
value |
a DKIM-Signature, ARC-Message-Signature, or ARC-Seal header value |
|
charset |
a charset (note: unused) |
char * g_mime_header_format_mailing_list_command (GMimeHeader *header,GMimeFormatOptions *options,const char *value,const char *charset);
Formats List-Archive, List-Help, List-Owner, List-Post, List-Subscribe and List-Unsubscribe values. Keeps angle-bracket URLs intact, collapses repeated commas, and folds comments and words using UTF-16 column counts without splitting Unicode characters. Non-International comments use RFC 2047 encoding; International comments retain their UTF-8 text.
header |
||
options |
a GMimeFormatOptions or |
[nullable] |
value |
a decoded UTF-8 mailing-list command header value |
|
charset |
the charset to use when encoding comments. |
[nullable] |
char * g_mime_header_format_message_id (GMimeHeader *header,GMimeFormatOptions *options,const char *value,const char *charset);
Unfolds value
and applies the configured newline format without introducing
new folds or parsing its message-id tokens.
header |
||
options |
a GMimeFormatOptions or |
[nullable] |
value |
a message-id header value, including In-Reply-To |
|
charset |
a charset (note: unused) |
char * g_mime_header_format_received (GMimeHeader *header,GMimeFormatOptions *options,const char *value,const char *charset);
Parses the value
and then re-formats it to conform to the formatting options,
folding the value if necessary.
Preserves clause and comment boundaries and keeps the date-time together.
header |
||
options |
a GMimeFormatOptions or |
[nullable] |
value |
a Received header value |
|
charset |
a charset (note: unused) |
char * g_mime_header_format_authentication_results (GMimeHeader *header,GMimeFormatOptions *options,const char *value,const char *charset);
Folds parsed Authentication-Results or ARC-Authentication-Results at syntactic token boundaries. Unparseable values use the default formatter. Existing raw headers are not changed until explicitly reformatted.
char * g_mime_header_format_references (GMimeHeader *header,GMimeFormatOptions *options,const char *value,const char *charset);
Parses the value
and then re-formats it to conform to the formatting options,
folding the value if necessary.
Folds only between message-ids, never before the first one.
header |
||
options |
a GMimeFormatOptions or |
[nullable] |
value |
a References header value |
|
charset |
a charset (note: unused) |
GMimeHeader * g_mime_header_new (const char *name,const char *value,const char *charset);
Creates a standalone header, preserving field-name case. Leading and
trailing linear whitespace is trimmed and CR/LF characters are removed
from value
before formatting. The header owns its strings and an
independent copy of the default parser options and has no stream offset.
Invalid names, NULL values, and invalid UTF-8 are programming errors
reported through GLib's argument guards.
name |
a nonempty ASCII header field name without whitespace or a colon |
|
value |
the decoded UTF-8 header value |
|
charset |
the encoding charset, or |
[nullable] |
GMimeHeader * g_mime_header_new_full (const char *name,const char *value,const char *charset,GError **error);
Creates a standalone header using g_mime_header_set_value_full().
Invalid UTF-8 and unsupported charsets produce G_CONVERT_ERROR.
Invalid Content-Type and Content-Disposition values produce a
GMIME_ERROR parse error instead of using legacy fallback values.
Invalid names and NULL values are programming errors.
name |
a nonempty ASCII header field name without whitespace or a colon |
|
value |
the decoded UTF-8 header value |
|
charset |
the encoding charset, or |
[nullable] |
error |
return location for an error, or |
GMimeHeader * g_mime_header_new_with_id (GMimeHeaderId id,const char *value,const char *charset);
Creates a standalone header using the canonical field name for id
and
g_mime_header_new(). The header owns its strings and an independent copy
of the default parser options. Unknown and out-of-range IDs are
programming errors.
Use g_mime_header_new_with_id_full() for checked structured values and
charset conversion with error reporting.
id |
a known GMimeHeaderId |
|
value |
the decoded UTF-8 header value |
|
charset |
the encoding charset, or |
[nullable] |
GMimeHeader * g_mime_header_new_with_id_full (GMimeHeaderId id,const char *value,const char *charset,GError **error);
Creates a standalone header using the canonical field name for id
and
g_mime_header_new_full(), including its value normalization, independent
default parser options, formatting and error reporting. Unknown and
out-of-range IDs are programming errors.
id |
a known GMimeHeaderId |
|
value |
the decoded UTF-8 header value |
|
charset |
the encoding charset, or |
[nullable] |
error |
return location for an error, or |
GMimeHeader * g_mime_header_parse (GMimeParserOptions *options,const guint8 *buffer,gsize length,GError **error);
Parses a standalone header from the entire supplied byte span. The field consists of printable ASCII other than ':', followed by optional spaces or tabs and a colon. Like MimeKit's Header.TryParse(), this accepts an empty field name; it is not a complete RFC header validator.
All bytes after the colon belong to the value, including embedded NULs, folded lines and any subsequent header-like lines. Existing LF or CRLF endings are preserved; if the input does not end in LF, the default newline sequence is appended to the raw value.
The header owns copies of the input and parser options, has an unknown
source offset (-1), and decodes its value lazily. Missing field separators
return NULL with GMIME_ERROR_PARSE_ERROR and a relative byte offset.
buffer
may be NULL only when length
is zero.
options |
parser options, or |
[nullable] |
buffer |
input bytes. |
[array length=length][element-type guint8][nullable] |
length |
the number of bytes to parse |
|
error |
return location for a GError. |
[nullable] |
GMimeHeader * g_mime_header_parse_text (GMimeParserOptions *options,const char *text,GError **error);
Parses a standalone header using g_mime_header_parse(). Use the byte-span
API for input containing embedded NULs or not terminated by a NUL.
GMimeHeader *
g_mime_header_clone (GMimeHeader *header);
Clones the header, preserving its name, raw name and value, cached decoded value, charset, and formatting behavior without decoding or reformatting it. The clone has no change listeners and its stream offset is unknown (-1).
The clone shares immutable raw bytes and owns copies of its decoded strings
and parser options. It can outlive the original header and its containing
list. As with
g_mime_parser_options_clone(), warning callback user data remains borrowed.
char *
g_mime_header_unfold (const char *text);
Unfolds decoded header text for display. Leading and trailing linear
whitespace (SP, HTAB, CR and LF) is removed; other whitespace is retained.
All CR and LF characters are removed, including internal ones.
A NULL input produces an empty string.
This does not decode RFC 2047 encoded words. Use the header value getters to decode raw header bytes before unfolding.
GMimeHeaderId
g_mime_header_get_id (GMimeHeader *header);
Gets the header identifier, determined from its field name without
changing the original spelling or raw bytes. Extension and unrecognized
fields return GMIME_HEADER_UNKNOWN. Changing the value does not change
the identifier.
const char *
g_mime_header_get_name (GMimeHeader *header);
Gets the header's name. Embedded NUL bytes in an invalid field are represented as "\0" in this display/lookup string; the original bytes are preserved when writing the header.
GBytes *
g_mime_header_get_raw_name (GMimeHeader *header);
Gets the header's raw name. The raw header name is the complete byte sequence up to
(but not including) the ':' separating the header's name from its value. This
byte sequence may be different from the value returned by g_mime_header_get_name()
if the parsed message's header contained trailing whitespace after the header
name, such as: "Subject : this is the subject\r\n".
Embedded NULs in invalid fields are retained. The immutable bytes remain
valid after the header is changed or destroyed.
gint64
g_mime_header_get_offset (GMimeHeader *header);
Gets the header's stream offset if known.
const char *
g_mime_header_get_value (GMimeHeader *header);
Gets the header's unfolded value, trimming leading and trailing linear
whitespace as in g_mime_header_unfold(). Literal and decoded NUL characters
are replaced with the Unicode replacement character U+FFFD.
char * g_mime_header_get_value_with_charset (GMimeHeader *header,const char *charset,GError **error);
Decodes and unfolds the stored raw value using a copy of the header's
parser options with charset
as the fallback for undeclared 8-bit text.
Valid UTF-8 takes priority, and supported RFC 2047 declarations are
honored. Leading and trailing linear whitespace is removed.
The result is newly allocated, even if the decoded value was already
cached. The header's options, cache, raw bytes and formatting state are
unchanged, and no change event is emitted. An unset legacy placeholder
returns an empty string after validating charset
.
Empty, invalid or unsupported charsets report G_CONVERT_ERROR.
Generic UTF-16/32 aliases use little-endian bytes. The historical
MimeKit alias "unicode" selects UTF-8, not UTF-16.
Literal and decoded NUL characters are replaced with the Unicode
replacement character U+FFFD. The stored raw bytes remain unchanged.
No failure returns partial text.
void g_mime_header_set_value (GMimeHeader *header,GMimeFormatOptions *options,const char *value,const char *charset);
Sets the header's decoded value.
header |
||
options |
a GMimeFormatOptions or |
[nullable] |
value |
the new header value |
|
charset |
a charset. |
[nullable] |
gboolean g_mime_header_set_value_full (GMimeHeader *header,GMimeFormatOptions *options,const char *value,const char *charset,GError **error);
Trims leading and trailing linear whitespace, removes CR/LF characters,
and formats value
before replacing the header's state. Invalid UTF-8
and unsupported charsets produce G_CONVERT_ERROR. Content-Type and
Content-Disposition use the checked parsers and report GMIME_ERROR
parse errors, retaining those parsers' configured recovery behavior.
Other fields use the existing formatters, including UTF-8 fallback for
text that cannot be represented in a supported charset.
On failure no header state is changed and no change event is emitted.
On success the formatted raw value is cached using options
, rather than
being reformatted on every write. International output can still reformat
it as UTF-8; this is not an explicit raw-value assignment.
Invalid parsed field names are not repaired by assigning a value.
GBytes *
g_mime_header_get_raw_value (GMimeHeader *header);
Gets the complete raw value before decoding or charset conversion,
including any embedded NUL bytes. The returned immutable bytes remain
valid after the header is changed or destroyed. An unset legacy
placeholder returns NULL.
gboolean g_mime_header_set_raw_value (GMimeHeader *header,GBytes *raw_value,GError **error);
Sets the raw value without encoding, folding or charset validation.
Empty values and values whose final byte is not LF report
GMIME_ERROR_PARSE_ERROR without changing the header or notifying owners.
LF and CRLF endings are both accepted. No leading whitespace or other
header syntax is required or added.
The header retains a reference to the immutable bytes, clears its decoded cache and emits a change event, even when assigning the current bytes. Its field name, source offset, charset and parser options are preserved. Explicit raw values are preserved with International formatting until replaced by a decoded-value assignment.
Embedded NUL bytes are retained for serialization and byte-based access. Use
g_mime_header_get_value_with_charset() to reject NUL-containing text.
ssize_t g_mime_header_write_to_stream (GMimeHeader *header,GMimeFormatOptions *options,GMimeStream *stream);
Writes the header to the specified stream. International formatting reformats parsed text, address, and content headers as UTF-8 without changing their stored raw values. Explicit raw assignments and parsed trace, identifier, authentication, and signature fields are preserved.
char *
g_mime_header_to_string (GMimeHeader *header);
Formats the header for display using its name and decoded value, separated by a colon and a space. The raw name's trailing whitespace is not included, and no encoding, folding, or terminating newline is added. Invalid parsed fields return their display name alone, without adding a colon or a value.
This is not a transport serialization API. Use
g_mime_header_write_to_stream() to write the encoded header.
GMimeHeaderList *
g_mime_header_list_new (GMimeParserOptions *options);
Creates a new GMimeHeaderList object.
GMimeHeaderList * g_mime_header_list_new_with_capacity (GMimeParserOptions *options,int capacity);
Creates an empty GMimeHeaderList with space for at least capacity
headers. The list grows as needed; capacity
is not a count or a limit.
The list owns a snapshot of options
.
options |
a GMimeParserOptions or |
[nullable] |
capacity |
the initial number of headers to reserve space for, or |
GMimeHeaderList * g_mime_header_list_load (GMimeParserOptions *options,GMimeStream *stream,GError **error);
Loads a header block from stream
using g_mime_parser_construct_headers().
The list owns its parsed strings and a snapshot of options
, and remains
usable after stream
is released. The stream is not closed or reset.
The temporary parser may read ahead beyond the terminating blank line. Use a GMimeParser directly when the logical input position or subsequent buffered input is needed. The header/body separator is not part of the list.
options |
a GMimeParserOptions or |
[nullable] |
stream |
the input stream |
|
error |
return location for a GError, or |
GMimeHeaderList * g_mime_header_list_load_file (GMimeParserOptions *options,const char *filename,GError **error);
Opens filename
and loads its first header block using
g_mime_header_list_load(). Empty files return an empty list. The file is
closed on both success and failure, and the returned list owns its strings
and a snapshot of options
.
File open and input I/O errors use the GMIME_ERROR domain with a positive
errno code. Fatal syntax errors and header length violations use the same
errors as g_mime_parser_construct_headers().
options |
a GMimeParserOptions or |
[nullable] |
filename |
the path to the input file. |
[type filename] |
error |
return location for a GError, or |
int
g_mime_header_list_get_count (GMimeHeaderList *headers);
Gets the number of headers contained within the header list.
void
g_mime_header_list_clear (GMimeHeaderList *headers);
Removes all of the headers from the GMimeHeaderList.
gboolean g_mime_header_list_contains (GMimeHeaderList *headers,const char *name);
Checks whether or not a header exists.
gboolean g_mime_header_list_contains_id (GMimeHeaderList *headers,GMimeHeaderId id);
Checks whether a header with the canonical name for id
exists,
ignoring ASCII case. Unknown and out-of-range IDs are programming errors.
This does not decode values or notify owners.
gboolean g_mime_header_list_contains_header (GMimeHeaderList *headers,GMimeHeader *header);
Checks for the exact header instance, not another header with the same name or value.
int g_mime_header_list_index_of (GMimeHeaderList *headers,const char *name);
Finds the first header with the specified name, ignoring ASCII case.
int g_mime_header_list_index_of_id (GMimeHeaderList *headers,GMimeHeaderId id);
Finds the first header with the specified cached identifier without decoding values or comparing field-name strings. Unknown and out-of-range IDs are programming errors.
int g_mime_header_list_index_of_header (GMimeHeaderList *headers,GMimeHeader *header);
Finds the first occurrence of the exact header instance.
int g_mime_header_list_last_index_of (GMimeHeaderList *headers,const char *name);
Finds the last header with the specified name, ignoring ASCII case.
int g_mime_header_list_last_index_of_id (GMimeHeaderList *headers,GMimeHeaderId id);
Finds the last header with the specified cached identifier without decoding values or comparing field-name strings. Unknown and out-of-range IDs are programming errors.
int g_mime_header_list_add (GMimeHeaderList *headers,GMimeHeader *header);
Appends the existing header without copying or reformatting it. The list takes its own reference. A header may be shared between lists or occur more than once in a list; each occurrence retains a reference.
void g_mime_header_list_insert_header (GMimeHeaderList *headers,int index,GMimeHeader *header);
Inserts the existing header, retaining its identity, raw text and stream offset. The list takes a reference for each occurrence. Name lookup still returns the first matching header.
If header
borrowed its parser options from a list, it takes an independent
snapshot before insertion so it remains usable after that list is freed.
Other header state is unchanged. Changes notify every containing list until
its last occurrence is removed from that list.
headers |
||
index |
the 0-based insertion index, from zero through the current count |
|
header |
a GMimeHeader. |
[transfer none] |
void g_mime_header_list_insert (GMimeHeaderList *headers,int index,const char *name,const char *value,const char *charset);
Inserts a newly created header at index
, preserving the order of existing
headers. Name lookup continues to return the first matching header.
An index equal to the current count appends the header.
gboolean g_mime_header_list_insert_full (GMimeHeaderList *headers,int index,const char *name,const char *value,const char *charset,GError **error);
Constructs a header using g_mime_header_new_full() before inserting it.
The header owns an independent snapshot of the default parser options.
Existing headers retain their identity, values, offsets and relative order.
Name lookup continues to return the first matching header.
Failure leaves the list, its body-separator state and notifications
unchanged. Invalid indexes, field names and NULL values are programming
errors. Unlike g_mime_header_list_insert(), this does not reserve unset
headers or use legacy structured-value fallbacks.
headers |
||
index |
the 0-based insertion index, from zero through the current count |
|
name |
a nonempty ASCII header field name without whitespace or a colon |
|
value |
the decoded UTF-8 header value |
|
charset |
the encoding charset, or |
[nullable] |
error |
return location for an error, or |
gboolean g_mime_header_list_insert_id_full (GMimeHeaderList *headers,int index,GMimeHeaderId id,const char *value,const char *charset,GError **error);
Constructs and inserts a checked header using the canonical field name
for id
and g_mime_header_list_insert_full(). Existing headers retain
their identity, raw bytes and relative order. Validation failure leaves
the list and its notifications unchanged. Unknown and out-of-range IDs
are programming errors.
headers |
||
index |
the 0-based insertion index, from zero through the current count |
|
id |
a known GMimeHeaderId |
|
value |
the decoded UTF-8 header value |
|
charset |
the encoding charset, or |
[nullable] |
error |
return location for an error, or |
GMimeHeader * g_mime_header_list_get_header (GMimeHeaderList *headers,const char *name);
Gets the first header with the specified name.
GMimeHeader * g_mime_header_list_get_header_at (GMimeHeaderList *headers,int index);
Gets the header at the specified index
within the list.
void g_mime_header_list_set_header_at (GMimeHeaderList *headers,int index,GMimeHeader *header);
Replaces just the header at index
, without changing the list length or
removing duplicate fields. Assigning the instance already at index
does
nothing. Invalid indexes are programming errors reported by GLib's
argument guards without changing the list or header
.
The list retains its own reference and preserves header
's raw text and
stream offset. Borrowed parser options are snapshotted as with insertion.
Name lookup continues to identify the first matching occurrence, even if
either instance occurs elsewhere in the list.
Assigning a matching field name emits a change notification. Assigning a different field name emits removal of the old header and addition of the new header after the list and name lookups have been updated.
headers |
||
index |
the 0-based index of the header to replace |
|
header |
the replacement GMimeHeader. |
[transfer none] |
void g_mime_header_list_prepend (GMimeHeaderList *headers,const char *name,const char *value,const char *charset);
Prepends a header. If value
is NULL, a space will be set aside
for it (useful for setting the order of headers before values can
be obtained for them) otherwise the header will be unset.
gboolean g_mime_header_list_prepend_full (GMimeHeaderList *headers,const char *name,const char *value,const char *charset,GError **error);
Constructs and prepends a checked header. This is equivalent to
g_mime_header_list_insert_full() with an index of zero, including its
validation, ownership and failure behavior.
headers |
||
name |
a nonempty ASCII header field name without whitespace or a colon |
|
value |
the decoded UTF-8 header value |
|
charset |
the encoding charset, or |
[nullable] |
error |
return location for an error, or |
void g_mime_header_list_append (GMimeHeaderList *headers,const char *name,const char *value,const char *charset);
Appends a header. If value
is NULL, a space will be set aside for it
(useful for setting the order of headers before values can be
obtained for them) otherwise the header will be unset.
gboolean g_mime_header_list_append_full (GMimeHeaderList *headers,const char *name,const char *value,const char *charset,GError **error);
Constructs and appends a checked header. This is equivalent to
g_mime_header_list_insert_full() at the current count, including its
validation, ownership and failure behavior.
headers |
||
name |
a nonempty ASCII header field name without whitespace or a colon |
|
value |
the decoded UTF-8 header value |
|
charset |
the encoding charset, or |
[nullable] |
error |
return location for an error, or |
gboolean g_mime_header_list_append_id_full (GMimeHeaderList *headers,GMimeHeaderId id,const char *value,const char *charset,GError **error);
Constructs and appends a checked header using the canonical field name
for id
and g_mime_header_list_append_full(). Existing headers, including
duplicates, are unchanged. Unknown and out-of-range IDs are programming
errors. Failure leaves the list and its notifications unchanged.
headers |
||
id |
a known GMimeHeaderId |
|
value |
the decoded UTF-8 header value |
|
charset |
the encoding charset, or |
[nullable] |
error |
return location for an error, or |
void g_mime_header_list_set (GMimeHeaderList *headers,const char *name,const char *value,const char *charset);
Set the value of the specified header. If value
is NULL and the
header, name
, had not been previously set, a space will be set
aside for it (useful for setting the order of headers before values
can be obtained for them) otherwise the header will be unset.
Note: If there are multiple headers with the specified field name, the first instance of the header will be replaced and further instances will be removed.
const char * g_mime_header_list_get_value (GMimeHeaderList *headers,const char *name);
Gets the decoded value of the first matching header without changing list order or notifying owners. Later matches are not considered, even if the first is an unset legacy placeholder.
const char * g_mime_header_list_get_value_by_id (GMimeHeaderList *headers,GMimeHeaderId id);
Gets the decoded value of the first header with the canonical name for
id
, ignoring ASCII case. Like g_mime_header_list_get_value(), this does
not skip unset placeholders, change raw bytes or notify owners.
Unknown and out-of-range IDs are programming errors.
gboolean g_mime_header_list_set_value_full (GMimeHeaderList *headers,const char *name,const char *value,const char *charset,GError **error);
Sets only the first matching header using g_mime_header_set_value_full(),
or appends a checked header using g_mime_header_list_append_full() if
absent. Existing matches retain their identity, names, parser options and
source offsets. Later duplicates are not removed or changed, unless they
are additional occurrences of the same header object.
Existing-header changes notify all lists sharing that object and preserve each list's body-separator state. Appending adds a body separator and emits the normal add notification. Validation failure leaves header and list state unchanged and emits no notification.
Unlike g_mime_header_list_set(), this does not collapse duplicates.
An invalid parsed field name is not repaired; if no match exists, name
must satisfy the checked constructor's field-name requirements.
headers |
||
name |
the case-insensitive header field name |
|
value |
the decoded UTF-8 header value |
|
charset |
the encoding charset, or |
[nullable] |
error |
return location for an error, or |
gboolean g_mime_header_list_set_value_by_id_full (GMimeHeaderList *headers,GMimeHeaderId id,const char *value,const char *charset,GError **error);
Sets only the first matching header, or appends a checked header with
the canonical field name for id
if absent. Like MimeKit's HeaderId
indexer, this preserves the first header's identity and field spelling
and does not collapse duplicates. Uses g_mime_header_list_set_value_full()
and its existing ownership, notification and atomic failure behavior.
Unknown and out-of-range IDs are programming errors.
headers |
||
id |
a known GMimeHeaderId |
|
value |
the decoded UTF-8 header value |
|
charset |
the encoding charset, or |
[nullable] |
error |
return location for an error, or |
void g_mime_header_list_replace (GMimeHeaderList *headers,GMimeHeader *header);
Replaces all headers with the same field name, ignoring ASCII case, with
the exact header
instance at the first matching position. If no match
exists, header
is appended. Other fields retain their order.
The list takes its own reference without copying or reformatting header
.
The replacement may already occur in this list or be shared with another
list. Borrowed parser options are snapshotted as with instance insertion.
Removed headers stop notifying this list; other containing lists are
unaffected.
Replacing existing fields emits one normal change notification after the list and name lookup have been updated. Appending emits an add notification.
gboolean g_mime_header_list_replace_value_full (GMimeHeaderList *headers,const char *name,const char *value,const char *charset,GError **error);
Constructs a header using g_mime_header_new_full() and replaces all
case-insensitive matches using g_mime_header_list_replace(). If no match
exists, the header is appended. The new header owns an independent
snapshot of the default parser options.
Unlike g_mime_header_list_set(), this replaces the first matching object
instead of changing its value. Retained references and other lists sharing
removed headers are unaffected. All validation precedes mutation; failure
leaves the list, its body-separator state and notifications unchanged.
Successful replacement uses the existing single change notification,
after the final list and name lookup are established.
headers |
||
name |
a nonempty ASCII header field name without whitespace or a colon |
|
value |
the decoded UTF-8 header value |
|
charset |
the encoding charset, or |
[nullable] |
error |
return location for an error, or |
gboolean g_mime_header_list_replace_value_by_id_full (GMimeHeaderList *headers,GMimeHeaderId id,const char *value,const char *charset,GError **error);
Constructs a checked header with the canonical field name for id
and
replaces all matching headers using g_mime_header_list_replace_value_full().
Unlike assignment, replacement installs a new header object and removes
duplicates. If absent, the new header is appended. Existing native owner
notifications and atomic failure behavior are preserved. Unknown and
out-of-range IDs are programming errors.
headers |
||
id |
a known GMimeHeaderId |
|
value |
the decoded UTF-8 header value |
|
charset |
the encoding charset, or |
[nullable] |
error |
return location for an error, or |
gboolean g_mime_header_list_remove (GMimeHeaderList *headers,const char *name);
Remove the first instance of the specified header.
gboolean g_mime_header_list_remove_id (GMimeHeaderList *headers,GMimeHeaderId id);
Removes the first header with the canonical name for id
, ignoring
ASCII case. Uses the normal removal and owner-notification paths and
preserves the other headers' order and raw bytes. Does nothing if
absent. Unknown and out-of-range IDs are programming errors.
gboolean g_mime_header_list_remove_header (GMimeHeaderList *headers,GMimeHeader *header);
Removes the first occurrence of the exact header instance. A different header with the same name and value is not removed.
void g_mime_header_list_remove_all (GMimeHeaderList *headers,const char *name);
Removes every header with the specified name, ignoring ASCII case. Remaining headers retain their order and raw values. Each removed header emits the normal removal notification and stops notifying the list. Does nothing if no matching headers exist.
void g_mime_header_list_remove_all_id (GMimeHeaderList *headers,GMimeHeaderId id);
Removes every header with the canonical name for id
, ignoring ASCII
case. Each occurrence emits the normal removal notification; surviving
headers retain their order and raw bytes. Does nothing if absent.
Unknown and out-of-range IDs are programming errors.
void g_mime_header_list_remove_at (GMimeHeaderList *headers,int index);
Removes the header at the specified index
from headers
.
ssize_t g_mime_header_list_write_to_stream (GMimeHeaderList *headers,GMimeFormatOptions *options,GMimeStream *stream);
Writes the headers followed by the header/body separator. A parsed list without a separator omits it until a structural edit is made. Changing a contained header's value does not change this state. Hidden headers are only omitted when writing merged message headers, not standalone header lists or descendant MIME entity headers.
Newline conversion is completed before the separator is written. The caller's stream is not closed.
char * g_mime_header_list_to_string (GMimeHeaderList *headers,GMimeFormatOptions *options);
Allocates a string buffer containing the raw rfc822 headers
contained in headers
, without the header/body separator.
typedef struct _GMimeHeaderList GMimeHeaderList;
A list of message or mime-part headers.
Identifiers for common header fields. Comparing enum values is faster and less error-prone than comparing strings.
|
Accept-Language. |
||
|
Ad-Hoc. |
||
|
Alternate-Recipient. |
||
|
Apparently-To. |
||
|
Approved. |
||
|
ARC-Authentication-Results. |
||
|
ARC-Message-Signature. |
||
|
ARC-Seal. |
||
|
Archive. |
||
|
Archived-At. |
||
|
Article. |
||
|
Authentication-Results. |
||
|
Autocrypt. |
||
|
Autocrypt-Gossip. |
||
|
Autocrypt-Setup-Message. |
||
|
Autoforwarded. |
||
|
Auto-Submitted, as defined in RFC 3834. |
||
|
Legacy Autosubmitted, as defined in RFC 2156.
Most callers want |
||
|
Base. |
||
|
Bcc. |
||
|
Body. |
||
|
Bytes. |
||
|
Cc. |
||
|
Comments. |
||
|
Content-Alternative. |
||
|
Content-Base. |
||
|
Content-Class. |
||
|
Content-Description. |
||
|
Content-Disposition. |
||
|
Content-Duration. |
||
|
Content-Features. |
||
|
Content-Id. |
||
|
Content-Identifier. |
||
|
Content-Language. |
||
|
Content-Length. |
||
|
Content-Location. |
||
|
Content-Md5. |
||
|
Content-Return. |
||
|
Content-Transfer-Encoding. |
||
|
Content-Translation-Type. |
||
|
Content-Type. |
||
|
Control. |
||
|
Conversion. |
||
|
Conversion-With-Loss. |
||
|
Date. |
||
|
Date-Received. |
||
|
Deferred-Delivery. |
||
|
Delivery-Date. |
||
|
Disclose-Recipients. |
||
|
Disposition-Notification-Options. |
||
|
Disposition-Notification-To. |
||
|
Distribution. |
||
|
DKIM-Signature. |
||
|
DomainKey-Signature. |
||
|
Encoding. |
||
|
Encrypted. |
||
|
Expires. |
||
|
Expiry-Date. |
||
|
Followup-To. |
||
|
From. |
||
|
Generate-Delivery-Report. |
||
|
Importance. |
||
|
Injection-Date. |
||
|
Injection-Info. |
||
|
In-Reply-To. |
||
|
Keywords. |
||
|
Language. |
||
|
Latest-Delivery-Time. |
||
|
Lines. |
||
|
List-Archive. |
||
|
List-Help. |
||
|
List-Id. |
||
|
List-Owner. |
||
|
List-Post. |
||
|
List-Subscribe. |
||
|
List-Unsubscribe. |
||
|
List-Unsubscribe-Post. |
||
|
Message-Id. |
||
|
MIME-Version. |
||
|
Newsgroups. |
||
|
Nntp-Posting-Host. |
||
|
Organization. |
||
|
Original-From. |
||
|
Original-Message-Id. |
||
|
Original-Recipient. |
||
|
Original-Return-Address. |
||
|
Original-Subject. |
||
|
Path. |
||
|
Precedence. |
||
|
Prevent-NonDelivery-Report. |
||
|
Priority. |
||
|
Received. |
||
|
Received-SPF. |
||
|
References. |
||
|
Relay-Version. |
||
|
Reply-By. |
||
|
Reply-To. |
||
|
Require-Recipient-Valid-Since. |
||
|
Resent-Bcc. |
||
|
Resent-Cc. |
||
|
Resent-Date. |
||
|
Resent-From. |
||
|
Resent-Message-Id. |
||
|
Resent-Reply-To. |
||
|
Resent-Sender. |
||
|
Resent-To. |
||
|
Return-Path. |
||
|
Return-Receipt-To. |
||
|
See-Also. |
||
|
Sender. |
||
|
Sensitivity. |
||
|
Solicitation. |
||
|
Status. |
||
|
Subject. |
||
|
Summary. |
||
|
Supersedes. |
||
|
TLS-Required. |
||
|
To. |
||
|
User-Agent. |
||
|
X400-Content-Identifier. |
||
|
X400-Content-Return. |
||
|
X400-Content-Type. |
||
|
X400-MTS-Identifier. |
||
|
X400-Originator. |
||
|
X400-Received. |
||
|
X400-Recipients. |
||
|
X400-Trace. |
||
|
X-Mailer. |
||
|
X-MSMail-Priority. |
||
|
X-Priority. |
||
|
X-Status. |
||
|
An unknown header field. |