camel-utils

camel-utils

Functions

Types and Values

Description

Functions

camel_util_bdata_get_number ()

gint64
camel_util_bdata_get_number (gchar **bdata_ptr,
                             gint64 default_value);

Reads a numeric data from the bdata_ptr and moves the bdata_ptr after that number. If the number cannot be read, then the default_value is returned instead and the bdata_ptr is left unchanged. The number might be previously stored with the camel_util_bdata_put_number().

Parameters

bdata_ptr

a backend specific data (bdata) pointer

 

default_value

a value to return, when no data can be read

 

Returns

The read number, or the default_value , if the bdata_ptr doesn't point to a number.

Since: 3.24


camel_util_bdata_put_number ()

void
camel_util_bdata_put_number (GString *bdata_str,
                             gint64 value);

Puts the number value at the end of the bdata_str . In case the bdata_str is not empty a space is added before the numeric value . The stored value can be read back with the camel_util_bdata_get_number().

Parameters

bdata_str

a GString to store a backend specific data (bdata)

 

value

a value to store

 

Since: 3.24


camel_util_bdata_get_string ()

gchar *
camel_util_bdata_get_string (gchar **bdata_ptr,
                             const gchar *default_value);

Reads a string data from the bdata_ptr and moves the bdata_ptr after that string. If the string cannot be read, then the default_value is returned instead and the bdata_ptr is left unchanged. The string might be previously stored with the camel_util_bdata_put_string().

Parameters

bdata_ptr

a backend specific data (bdata) pointer

 

default_value

a value to return, when no data can be read

 

Returns

Newly allocated string, which was read, or dupped the default_value , if the bdata_ptr doesn't point to a string. Free returned pointer with g_free() when done with it.

[transfer full]

Since: 3.24


camel_util_bdata_put_string ()

void
camel_util_bdata_put_string (GString *bdata_str,
                             const gchar *value);

Puts the string value at the end of the bdata_str . In case the bdata_str is not empty a space is added before the string value . The stored value can be read back with the camel_util_bdata_get_string().

The strings are encoded as "length-value", quotes for clarity only.

Parameters

bdata_str

a GString to store a backend specific data (bdata)

 

value

a value to store

 

Since: 3.24


camel_time_value_apply ()

time_t
camel_time_value_apply (time_t src_time,
                        CamelTimeUnit unit,
                        gint value);

Applies the given time value in unit unit to the src_time . Use negative value to subtract it. The time part is rounded to the beginning of the day.

Parameters

src_time

a time_t to apply the value to, or -1 to use the current time

 

unit

a CamelTimeUnit

 

value

a value to apply

 

Returns

src_time modified by the given parameters as date, with the time part being beginning of the day.

Since: 3.24


camel_utils_weak_ref_new ()

GWeakRef *
camel_utils_weak_ref_new (gpointer object);

Allocates a new GWeakRef and calls g_weak_ref_set() with object .

Free the returned GWeakRef with camel_utils_weak_ref_free().

[skip]

Parameters

object

a GObject or NULL.

[nullable]

Returns

a new GWeakRef.

[transfer full]

Since: 3.40


camel_utils_weak_ref_free ()

void
camel_utils_weak_ref_free (GWeakRef *weak_ref);

Frees a GWeakRef created by camel_utils_weak_ref_new().

[skip]

Parameters

weak_ref

a GWeakRef

 

Since: 3.40


camel_util_fill_message_info_user_headers ()

gboolean
camel_util_fill_message_info_user_headers
                               (CamelMessageInfo *info,
                                const CamelNameValueArray *headers);

Fill info 's user-headers with the user-defined headers from the headers array.

Parameters

info

a CamelMessageInfo

 

headers

a CamelNameValueArray with the headers to read from

 

Returns

Whether the info 's user headers changed

Since: 3.42


camel_util_encode_user_header_setting ()

gchar *
camel_util_encode_user_header_setting (const gchar *display_name,
                                       const gchar *header_name);

Encode the optional display_name and the header_name to a value suitable for GSettings schema org.gnome.evolution-data-server and key camel-message-info-user-headers.

Free the returned string with g_free(), when no longer needed.

Parameters

display_name

display name for the header name, or NULL.

[nullable]

header_name

the header name

 

Returns

a newly allocated string with encoded display_name and header_name .

[transfer full]

Since: 3.42


camel_util_decode_user_header_setting ()

void
camel_util_decode_user_header_setting (const gchar *setting_value,
                                       gchar **out_display_name,
                                       const gchar **out_header_name);

Decode the values previously encoded by camel_util_encode_user_header_setting(). The out_header_name points to the setting_value , thus it's valid as long as the setting_value is valid and unchanged.

The out_header_name can result in NULL when the setting_value contains invalid data.

The out_display_name can result in NULL when the setting_value does not contain the display name. In such case the header name can be used as the display name.

Parameters

setting_value

the value to decode

 

out_display_name

location for the decoded display name, or NULL when not needed.

[out][transfer full][nullable]

out_header_name

the location for the decoded header name.

[out]

Since: 3.42

Types and Values

CAMEL_UTILS_MAX_USER_HEADERS

#define CAMEL_UTILS_MAX_USER_HEADERS 3