Functions¶
Details¶
- Camel.binding_bind_property(source, source_property, target, target_property, flags)¶
- Parameters:
source (
GObject.Object
) – the sourceGObject.Object
source_property (
str
) – the property on source to bindtarget (
GObject.Object
) – the targetGObject.Object
target_property (
str
) – the property on target to bindflags (
GObject.BindingFlags
) – flags to pass toGObject.Binding
- Return type:
Thread safe variant of
GObject.Object.bind_property
(). See its documentation for more information on arguments and return value.New in version 3.16.
- Camel.binding_bind_property_full(source, source_property, target, target_property, flags, transform_to, transform_from)¶
- Parameters:
source (
GObject.Object
) – the sourceGObject.Object
source_property (
str
) – the property on source to bindtarget (
GObject.Object
) – the targetGObject.Object
target_property (
str
) – the property on target to bindflags (
GObject.BindingFlags
) – flags to pass toGObject.Binding
transform_to (
GObject.Closure
) – aGObject.Closure
wrapping the transformation function from the source to the target, orNone
to use the defaulttransform_from (
GObject.Closure
) – aGObject.Closure
wrapping the transformation function from the target to the source, orNone
to use the default
- Returns:
the
GObject.Binding
instance representing the binding between the twoGObject.Object
instances. The binding is released whenever theGObject.Binding
reference count reaches zero.- Return type:
Thread safe variant of
GObject.Object.bind_property_full
(). See its documentation for more information on arguments and return value.New in version 3.16.
- Camel.charset_best(in_)¶
-
Finds the minimum charset for this string
None
means US-ASCII.
- Camel.charset_iso_to_windows(isocharset)¶
- Camel.cipher_can_load_photos()¶
- Returns:
Whether ciphers can load photos, as being setup by the user.
- Return type:
New in version 3.22.
- Camel.cipher_canonical_to_stream(part, flags, ostream, cancellable)¶
- Parameters:
part (
Camel.MimePart
) – Part to write.flags (
int
) – flags for the canonicalisation filter (Camel.MimeFilterCanon
)ostream (
Camel.Stream
) – stream to write canonicalised output to.cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
- Raises:
- Returns:
-1 on error;
- Return type:
Writes a
Camel.part
to a stream in a canonicalised format, suitable for signing/encrypting.The transfer encoding paramaters for the
Camel.part
may be changed by this function.
- Camel.cipher_certinfo_get_property(cert_info, name)¶
- Parameters:
cert_info (
Camel.CipherCertInfo
) – aCamel.CipherCertInfo
name (
str
) – a property name
- Returns:
Value of a named property of the cert_info, or
None
when no such property exists. The returned value is owned by the cert_info and is valid until the cert_info is freed.- Return type:
Gets a named property name value for the given cert_info.
New in version 3.22.
- Camel.cipher_certinfo_set_property(cert_info, name, value, value_free, value_clone)¶
- Parameters:
cert_info (
Camel.CipherCertInfo
) – aCamel.CipherCertInfo
name (
str
) – a property namevalue_free (
GLib.DestroyNotify
orNone
) – a free function for the valuevalue_clone (
Camel.CipherCloneFunc
orNone
) – a clone function for the value
Sets a named property name value value for the given cert_info. If the value is
None
, then the property is removed. With a non-None
value also value_free and value_clone functions cannot beNone
.New in version 3.22.
- Camel.debug(mode)¶
- Parameters:
mode (
str
) – string name of the mode to check for- Returns:
Whether the debug mode is activated
- Return type:
Check to see if a debug mode is activated. mode takes one of two forms, a fully qualified ‘module:target’, or a wildcard ‘module’ name. It returns a boolean to indicate if the module or module and target is currently activated for debug output.
- Camel.debug_demangle_backtrace(bt)¶
- Parameters:
bt (
GLib.String
orNone
) – aGLib.String
with a raw backtrace, orNone
- Returns:
a
GLib.String
with a raw backtrace, orNone
- Return type:
bt:
GLib.String
orNone
Demangles bt, possibly got from
Camel.debug_get_raw_backtrace
(), by replacing addresses with actual function calls and eventually line numbers, if available. It modifies lines of bt, but skips those it cannot parse.Note: Getting backtraces only works if the library was configured with –enable-backtraces.
See also
Camel.debug_get_raw_backtrace
()New in version 3.30.
- Camel.debug_end()¶
Call this when you’re done with your debug output. If and only if you called
Camel.debug_start
, and if it returnsTrue
.
- Camel.debug_get_backtrace()¶
- Returns:
Current backtrace, or
None
, if cannot determine it.Note: Getting backtraces only works if the library was configured with –enable-backtraces.
See also
Camel.debug_get_raw_backtrace
()- Return type:
GLib.String
orNone
Gets current backtrace leading to this function call and demangles it.
New in version 3.12.
- Camel.debug_get_raw_backtrace()¶
- Returns:
Current raw backtrace, or
None
, if cannot determine it.Note: Getting backtraces only works if the library was configured with –enable-backtraces.
See also
Camel.debug_get_backtrace
()- Return type:
GLib.String
orNone
Gets current raw backtrace leading to this function call. This is quicker than
Camel.debug_get_backtrace
(), because it doesn’t demangle the backtrace. To demangle it (replace addresses with actual function calls and eventually line numbers, if available) callCamel.debug_demangle_backtrace
().New in version 3.30.
- Camel.debug_init()¶
Init camel debug.
CAMEL_DEBUG is set to a comma separated list of modules to debug. The modules can contain module-specific specifiers after a ‘:’, or just act as a wildcard for the module or even specifier. e.g. ‘imap’ for imap debug, or ‘imap:folder’ for imap folder debug. Additionaly, ‘:folder’ can be used for a wildcard for any folder operations.
- Camel.debug_ref_unref_dump_backtraces()¶
Prints current backtraces stored with
Camel.debug_ref_unref_push_backtrace
() or withCamel.debug_ref_unref_push_backtrace_for_object
().It’s usually not needed to use this function, as the left backtraces, if any, are printed at the end of the application.
New in version 3.20.
- Camel.debug_ref_unref_push_backtrace(backtrace, object_ref_count)¶
- Parameters:
backtrace (
GLib.String
) – a backtrace to push, taken fromCamel.debug_get_backtrace
()object_ref_count (
int
) – the current object reference count when the push is done
Adds this backtrace into the set of backtraces related to some object reference counting issues debugging. This is usually called inside
GObject.Object.ref
() andGObject.Object.unref
(). If the backtrace corresponds to aGObject.Object.unref
() call, and a correspondingGObject.Object.ref
() backtrace is found in the current list, then the previous backtrace is removed and this one is skipped.Any left backtraces in the list are printed at the application end.
A convenient function
Camel.debug_ref_unref_push_backtrace_for_object
() is provided too.New in version 3.20.
- Camel.debug_ref_unref_push_backtrace_for_object(_object)¶
- Parameters:
_object (
object
orNone
) – aGObject.Object
, for which add the backtrace
Gets current backtrace of this call and adds it to the list of backtraces with
Camel.debug_ref_unref_push_backtrace
().Usual usage would be, once GNOME bug 758358 is applied to the GLib sources, or a patched GLib is used, to call this function in an object init() function, like this:
static void my_object_init (MyObject *obj) {
Camel.debug_ref_unref_push_backtrace_for_object
(obj); g_track_object_ref_unref (obj, (GLib.Func
)Camel.debug_ref_unref_push_backtrace_for_object
,None
); }Note that the g_track_object_ref_unref() can track only one pointer, thus make sure you track the right one (add some logic if multiple objects are created at once).
New in version 3.20.
- Camel.debug_start(mode)¶
- Parameters:
mode (
str
) – string name of the mode to start the debug for- Returns:
True
if mode is set, and in which case, you must callCamel.debug_end
() when finished any screen output.- Return type:
Start debug output for a given mode, used to make sure debug output is output atomically and not interspersed with unrelated stuff.
- Camel.enriched_to_html(in_, flags)¶
- Parameters:
in (
str
) – input textual stringflags (
Camel.MimeFilterEnrichedFlags
) – flags specifying filter behaviour
- Returns:
a newly allocated string containing the enriched or richtext version of in.
- Return type:
Convert in from text/plain into text/enriched or text/richtext based on flags.
- Camel.file_util_decode_fixed_int32(in_, dest)¶
- Parameters:
- Returns:
0 on success, -1 on error.
- Return type:
Retrieve a gint32.
- Camel.file_util_decode_fixed_string(in_, str, len)¶
- Parameters:
- Returns:
0 on success, -1 on error.
- Return type:
Decode a normal string from the input file.
- Camel.file_util_decode_gint64(in_, dest)¶
- Parameters:
- Returns:
0 on success, -1 on failure.
- Return type:
Decode a gint64 type.
New in version 3.50.
- Camel.file_util_decode_gsize(in_, dest)¶
- Parameters:
- Returns:
0 on success, -1 on failure.
- Return type:
Decode an gsize type.
- Camel.file_util_decode_off_t(in_, dest)¶
- Parameters:
- Returns:
0 on success, -1 on failure.
- Return type:
Decode an off_t type.
- Camel.file_util_decode_string(in_, str)¶
- Parameters:
- Returns:
0 on success, -1 on error.
- Return type:
Decode a normal string from the input file.
- Camel.file_util_decode_time_t(in_, dest)¶
- Parameters:
- Returns:
0 on success, -1 on error.
- Return type:
Decode a time_t value.
- Camel.file_util_decode_uint32(in_, dest)¶
- Parameters:
- Returns:
0 on success, -1 on error. @*dest will contain the decoded value.
- Return type:
Retrieve an encoded uint32 from a file.
- Camel.file_util_encode_fixed_int32(out, value)¶
- Parameters:
- Returns:
0 on success, -1 on error.
- Return type:
Encode a gint32, performing no compression, but converting to network order.
- Camel.file_util_encode_fixed_string(out, str, len)¶
- Parameters:
- Returns:
0 on success, -1 on error.
- Return type:
Encode a normal string and save it in the output file. Unlike camel_file_util_encode_string, it pads the str with “
None
" bytes, if len is > strlen(str)
- Camel.file_util_encode_gint64(out, value)¶
- Parameters:
- Returns:
0 on success, -1 on error.
- Return type:
Encode a gint64 type.
New in version 3.50.
- Camel.file_util_encode_gsize(out, value)¶
- Parameters:
- Returns:
0 on success, -1 on error.
- Return type:
Encode an gsize type.
- Camel.file_util_encode_off_t(out, value)¶
- Parameters:
- Returns:
0 on success, -1 on error.
- Return type:
Encode an off_t type.
- Camel.file_util_encode_string(out, str)¶
- Parameters:
- Returns:
0 on success, -1 on error.
- Return type:
Encode a normal string and save it in the output file.
- Camel.file_util_encode_time_t(out, value)¶
- Parameters:
- Returns:
0 on success, -1 on error.
- Return type:
Encode a time_t value to the file.
- Camel.file_util_encode_uint32(out, value)¶
- Parameters:
- Returns:
0 on success, -1 on error.
- Return type:
Utility function to save an uint32 to a file.
- Camel.file_util_safe_filename(name)¶
- Parameters:
name (
str
) – string to ‘flattened’ into a safe filename- Returns:
a safe filename string.
- Return type:
‘Flattens’ name into a safe filename string by hex encoding any chars that may cause problems on the filesystem.
- Camel.file_util_savename(filename)¶
- Parameters:
filename (
str
) – a pathname- Returns:
The new pathname. It must be free’d with
GLib.free
().- Return type:
Builds a pathname where the basename is of the form “.#” + the basename of filename, for instance used in a two-stage commit file write.
- Camel.folder_info_build(folders, namespace_, separator, short_names)¶
- Parameters:
folders ([
Camel.FolderInfo
]) – an array ofCamel.FolderInfo
namespace (
str
) – an ignorable prefix on the folder namesseparator (
int
) – the hieararchy separator charactershort_names (
bool
) –True
if the (short) name of a folder is theCamel.part
after the last separator in the full name.False
if it is the full name.
- Returns:
the top level of the tree of linked folder info.
- Return type:
This takes an array of folders and attaches them together according to the hierarchy described by their full_names and separator. If namespace_ is non-
None
, then it will be ignored as a full_name prefix, for purposes of comparison. If necessary,Camel.FolderInfo.build
() will create additionalCamel.FolderInfo
withNone
urls to fill in gaps in the tree. The value of short_names is used in constructing the names of these intermediate folders.
- Camel.freeaddrinfo(host)¶
-
Frees a structure returned with
Camel.getaddrinfo
(). It does nothing when the host isNone
.New in version 2.22.
- Camel.getaddrinfo(name, service, hints, cancellable)¶
- Parameters:
name (
str
) – an address name to resolveservice (
str
) – a service name to usecancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
- Raises:
- Returns:
a newly allocated #addrinfo. Free it with
Camel.freeaddrinfo
() when done with it.- Return type:
Resolves a host name and returns an information about its address.
New in version 2.22.
- Camel.header_address_decode(in_, charset)¶
- Parameters:
- Return type:
- Camel.header_address_fold(in_, headerlen)¶
- Camel.header_address_list_append(addrlistp, addr)¶
- Parameters:
addrlistp ([
Camel.HeaderAddress
]) – aNone
-terminated list ofCamel.HeaderAddress
objectsaddr (
Camel.HeaderAddress
) – theCamel.HeaderAddress
to add
TODO: Document me.
- Camel.header_address_list_append_list(addrlistp, addrs)¶
- Parameters:
addrlistp ([
Camel.HeaderAddress
]) – aNone
-terminated list ofCamel.HeaderAddress
objectsaddrs ([
Camel.HeaderAddress
]) – aNone
-terminated list ofCamel.HeaderAddress
to add
TODO: Document me.
- Camel.header_address_list_clear(addrlistp)¶
- Parameters:
addrlistp ([
Camel.HeaderAddress
]) – aNone
-terminated list ofCamel.HeaderAddress
objects
TODO: Document me.
- Camel.header_address_list_encode(addrlist)¶
- Parameters:
addrlist ([
Camel.HeaderAddress
]) – aNone
-terminated list ofCamel.HeaderAddress
objects- Return type:
TODO: Document me.
- Camel.header_address_list_format(addrlist)¶
- Parameters:
addrlist ([
Camel.HeaderAddress
]) – aNone
-terminated list ofCamel.HeaderAddress
objects- Return type:
TODO: Document me.
- Camel.header_contentid_decode(in_)¶
-
Extract a content-id from in.
- Camel.header_decode_date(str, tz_offset)¶
- Parameters:
- Returns:
the time_t representation of the date string specified by str or (time_t) 0 on error. If tz_offset is non-
None
, the value of the timezone offset will be stored.- Return type:
Decodes the rfc822 date string and saves the GMT offset into tz_offset if non-
None
.
- Camel.header_decode_int(in_)¶
-
Extracts an integer token from in and updates the pointer to point to after the end of the integer token (sort of like strtol).
- Camel.header_decode_string(in_, default_charset)¶
- Parameters:
- Returns:
a string containing the UTF-8 version of the decoded header value
- Return type:
Decodes rfc2047 encoded-word tokens
- Camel.header_encode_phrase(in_)¶
-
Encodes a ‘phrase’ header according to the rules in rfc2047.
- Camel.header_encode_string(in_)¶
-
Encodes a ‘text’ header according to the rules of rfc2047.
- Camel.header_format_ctext(in_, default_charset)¶
- Parameters:
- Returns:
a string containing the UTF-8 version of the decoded header value
- Return type:
Decodes a header which contains rfc2047 encoded-word tokens that may or may not be within a comment.
- Camel.header_format_date(date, tz_offset)¶
- Parameters:
- Returns:
a valid string representation of the date.
- Return type:
Allocates a string buffer containing the rfc822 formatted date string represented by time and tz_offset.
- Camel.header_mailbox_decode(in_, charset)¶
- Parameters:
- Return type:
- Camel.header_msgid_decode(in_)¶
-
Extract a message-id token from in.
- Camel.header_msgid_generate(domain)¶
- Parameters:
domain (
str
orNone
) – domain to use (like “example.com”) for the ID suffix; can beNone
- Returns:
Unique message ID.
- Return type:
Either the domain is used, or the user’s local hostname, in case it’s
None
or empty.
- Camel.header_param(params, name)¶
- Parameters:
- Returns:
the value of the name param
- Return type:
Searches params for a param named name and gets the value.
- Camel.header_param_list_decode(in_)¶
- Parameters:
- Returns:
Decode list of parameters. Free with
Camel.HeaderParam.list_free
() when done with it.- Return type:
- Camel.header_param_list_format_append(out, params)¶
- Parameters:
out (
GLib.String
) –
- Camel.header_param_list_free(params)¶
-
Free the list of params.
- Camel.header_references_decode(in_)¶
- Parameters:
in (
str
) – References header value- Returns:
a list of references decoedd from in
- Return type:
[
str
]
Generate a list of references, from most recent up.
- Camel.header_set_param(paramsp, name, value)¶
- Parameters:
- Returns:
the set param
- Return type:
Set a parameter in the list.
- Camel.header_token_decode(in_)¶
- Parameters:
in (
str
) – input string- Returns:
a new string containing the first token in in
- Return type:
Gets the first token in the string according to the rules of rfc0822.
- Camel.headers_dup_mailing_list(headers)¶
- Parameters:
headers (
Camel.NameValueArray
) – aCamel.NameValueArray
with headers- Returns:
The mailing list header, or
None
, if none is found- Return type:
Searches for a mailing list information among known headers and returns a newly allocated string with its value.
- Camel.host_idna_to_ascii(host)¶
- Parameters:
host (
str
orNone
) – Host name, with or without non-ascii letters in utf8- Returns:
Newly allocated string with only ASCII letters describing the host or
None
, when the host isNone
. Free the returned string withGLib.free
() when no longer needed.- Return type:
Converts IDN (Internationalized Domain Name) into ASCII representation. If there’s a failure or the host has only ASCII letters, then a copy of host is returned.
New in version 3.16.
- Camel.hostname_utils_requires_ascii(hostname)¶
- Parameters:
hostname (
str
) – a host name- Returns:
True
, when the hostname should be converted to an ASCII equivalent,False
, when it can be shown as is.- Return type:
Check whether the hostname requires conversion to ASCII. That can be when a character in it can look like an ASCII character, even it being a Unicode letter. This can be used to display host names in a way of invulnerable to IDN homograph attacks.
New in version 3.44.
- Camel.localtime_with_offset(tt, tm, offset)¶
- Parameters:
Converts the calendar time representation tt to a broken-down time representation, stored in tm, and provides the offset in seconds from UTC time, stored in offset.
- Camel.lock_dot(path)¶
- Parameters:
path (
str
) – a path to lock- Raises:
- Returns:
-1 on error, sets ex appropriately.
- Return type:
Create an exclusive lock using .lock semantics. All locks are equivalent to write locks (exclusive).
The function does nothing and returns success (zero), when dot locking had not been compiled.
- Camel.lock_fcntl(fd, type)¶
- Parameters:
fd (
int
) – a file descriptortype (
Camel.LockType
) – aCamel.LockType
- Raises:
- Returns:
-1 on error.
- Return type:
Create a lock using fcntl(2).
type is
Camel.LockType.WRITE
orCamel.LockType.READ
, to create exclusive or shared read locksThe function does nothing and returns success (zero), when fcntl locking had not been compiled.
- Camel.lock_flock(fd, type)¶
- Parameters:
fd (
int
) – a file descriptortype (
Camel.LockType
) – aCamel.LockType
- Raises:
- Returns:
-1 on error.
- Return type:
Create a lock using flock(2).
type is
Camel.LockType.WRITE
orCamel.LockType.READ
, to create exclusive or shared read locksThe function does nothing and returns success (zero), when flock locking had not been compiled.
- Camel.lock_folder(path, fd, type)¶
- Parameters:
path (
str
) – Path to the file to lock (used for .locking only).fd (
int
) – Open file descriptor of the right type to lock.type (
Camel.LockType
) – Type of lock,Camel.LockType.READ
orCamel.LockType.WRITE
.
- Raises:
- Returns:
-1 on error, ex will describe the locking system that failed.
- Return type:
Attempt to lock a folder, multiple attempts will be made using all locking strategies available.
- Camel.mktime_utc(tm)¶
- Parameters:
tm (
object
orNone
) – the #tm to convert to a calendar time representation- Returns:
the calendar time representation of tm
- Return type:
Like mktime(3), but assumes UTC instead of local timezone.
New in version 3.4.
- Camel.movemail(source, dest)¶
- Parameters:
- Raises:
- Returns:
Returns -1 on error or 0 on success.
- Return type:
This copies an mbox file from a shared directory with multiple readers and writers into a private (presumably Camel-controlled) directory. Dot locking is used on the source file (but not the destination).
- Camel.pointer_tracker_dump()¶
Prints information about currently stored pointers in the pointer tracker. This is called automatically on application exit if camel_pointer_tracker_track() or
Camel.pointer_tracker_track_with_info
() was called.Note: If the library is configured with –enable-backtraces, then also backtraces where the pointer was added is printed in the summary.
New in version 3.6.
- Camel.pointer_tracker_track_with_info(ptr, info)¶
- Parameters:
Adds pointer to the pointer tracker, with associated information, which is printed in summary of pointer tracker printed by
Camel.pointer_tracker_dump
(). For convenience can be used camel_pointer_tracker_track(), which adds place of the caller as info. Added pointer should be removed with pair functionCamel.pointer_tracker_untrack
().New in version 3.6.
- Camel.pointer_tracker_untrack(ptr)¶
-
Removes pointer from the pointer tracker. It’s an error to try to remove pointer which was not added to the tracker by camel_pointer_tracker_track() or
Camel.pointer_tracker_track_with_info
(), or a pointer which was already removed.New in version 3.6.
- Camel.provider_get(protocol)¶
- Parameters:
protocol (
str
) – aCamel.Provider
protocol name- Raises:
- Returns:
a
Camel.Provider
for protocol, orNone
on error- Return type:
Returns the registered
Camel.Provider
for protocol, loading it from disk if necessary. If noCamel.Provider
can be found for protocol, or the provider module fails to load, the function sets error and returnsNone
.The returned
Camel.Provider
is owned by Camel and should not be modified or freed.
- Camel.provider_init()¶
Initialize the Camel provider system by reading in the .urls files in the provider directory and creating a hash table mapping URLs to module names.
A .urls file has the same initial prefix as the shared library it correspond to, and consists of a series of lines containing the URL protocols that that library handles.
TODO: This should be pathed? TODO: This should be plugin-d?
- Camel.provider_list(load)¶
- Parameters:
load (
bool
) – whether or not to load in providers that are not already loaded- Returns:
a
GLib.List
ofCamel.Provider
structs- Return type:
This returns a list of available providers. If load is
True
, it will first load in all available providers that haven’t yet been loaded.Free the returned list with g_list_free(). The
Camel.Provider
structs in the list are owned by Camel and should not be modified or freed.
- Camel.provider_load(path)¶
- Parameters:
path (
str
) – the path to a shared library- Raises:
- Returns:
- Return type:
Loads the provider at path, and calls its initialization function, passing session as an argument. The provider should then register itself with session.
- Camel.provider_module_init()¶
- Camel.pstring_add(string, own)¶
- Parameters:
- Returns:
a canonicalized copy of string
- Return type:
Add string to the pool.
The
None
and empty strings are special cased to constant values.Unreference the returned string with
Camel.pstring_free
().
- Camel.pstring_contains(string)¶
- Parameters:
- Returns:
Whether the string exists in the string pool
- Return type:
Returns whether the string exists in the string pool.
The
None
and empty strings are special cased to constant values.New in version 3.22.
- Camel.pstring_dump_stat()¶
Dumps to stdout memory statistic about the string pool.
New in version 3.6.
- Camel.pstring_free(string)¶
-
Unreferences a pooled string. If the string’s reference count drops to zero it will be deallocated.
None
and the empty string are special cased.
- Camel.pstring_peek(string)¶
- Parameters:
- Returns:
a canonicalized copy of string
- Return type:
Returns the canonicalized copy of string without increasing its reference count in the string pool. If necessary, string is first added to the string pool.
The
None
and empty strings are special cased to constant values.New in version 2.24.
- Camel.pstring_strdup(string)¶
- Parameters:
- Returns:
a canonicalized copy of string
- Return type:
Create a new pooled string entry for strings. A pooled string is a table where common strings are canonicalized. They are also reference counted and freed when no longer referenced.
The
None
and empty strings are special cased to constant values.Unreference the returned string with
Camel.pstring_free
().
- Camel.quoted_decode_step(in_, out, saveme)¶
- Parameters:
- Returns:
the number of bytes decoded
- out:
output stream
- saveme:
leftover bits that have not yet been decoded
- Return type:
Decodes a block of quoted-printable encoded data. Performs a ‘decode step’ on a chunk of QP encoded data.
- Camel.quoted_encode_close(in_, out, save)¶
- Parameters:
- Returns:
the number of bytes encoded
- out:
output string
- save:
leftover bits that have not yet been encoded
- Return type:
Quoted-printable encodes a block of text. Call this when finished encoding data with
Camel.quoted_encode_step
() to flush off the last little bit.
- Camel.quoted_encode_step(in_, out, save)¶
- Parameters:
- Returns:
the number of bytes encoded
- out:
output string
- save:
leftover bits that have not yet been encoded
- Return type:
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).
- Camel.read(fd, buf, n, cancellable)¶
- Parameters:
fd (
int
) – file descriptorbuf (
str
) – buffer to filln (
int
) – number of bytes to read into bufcancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
- Raises:
- Returns:
number of bytes read or -1 on fail. On failure, errno will be set appropriately.
- Return type:
Cancellable libc read() replacement.
Code that intends to be portable to Win32 should call this function only on file descriptors returned from open(), not on sockets.
- Camel.search_camel_header_soundex(header, match)¶
- Camel.search_get_all_headers_decoded(message)¶
- Parameters:
message (
Camel.MimeMessage
) – a #CamelMessage- Returns:
All headers of the message, decoded where needed. Free the returned pointer with
GLib.free
() when done with it.- Return type:
New in version 3.22.
- Camel.search_get_default_charset_from_headers(headers)¶
- Parameters:
headers (
Camel.NameValueArray
) – aCamel.NameValueArray
- Returns:
Default charset from the Content-Type header of the headers; if none cannot be determined, UTF-8 is returned.
- Return type:
New in version 3.28.
- Camel.search_get_default_charset_from_message(message)¶
- Parameters:
message (
Camel.MimeMessage
) – aCamel.MimeMessage
- Returns:
Default charset of the message; if none cannot be determined, UTF-8 is returned.
- Return type:
New in version 3.22.
- Camel.search_get_header_decoded(header_name, header_value, default_charset)¶
- Parameters:
- Returns:
decoded header value, suitable for text comparison. Free the returned pointer with
GLib.free
() when done with it.- Return type:
Decodes header_value, if needed, either from an address header or the Subject header. Other header_name headers are returned as is.
New in version 3.22.
- Camel.search_get_headers_decoded(headers, default_charset)¶
- Parameters:
headers (
Camel.NameValueArray
) – aCamel.NameValueArray
default_charset (
str
orNone
) – default charset to use; orNone
, to detect from Content-Type of headers
- Returns:
The headers, decoded where needed. Free the returned pointer with
GLib.free
() when done with it.- Return type:
New in version 3.28.
- Camel.search_header_is_address(header_name)¶
- Parameters:
header_name (
str
) – A header name, like “Subject”- Returns:
Whether the header_name is a header with a mail address
- Return type:
New in version 3.22.
- Camel.search_header_match(value, match, how, type, default_charset)¶
- Camel.shutdown()¶
New in version 2.24.
- Camel.store_info_name(summary, info)¶
- Parameters:
summary (
Camel.StoreSummary
) – aCamel.StoreSummary
info (
Camel.StoreInfo
) – aCamel.StoreInfo
- Returns:
the last segment of the path string from info
- Return type:
Returns the last segment of the path string from info.
Deprecated since version 3.46: Use
Camel.StoreInfo.get_name
() instead.
- Camel.store_info_path(summary, info)¶
- Parameters:
summary (
Camel.StoreSummary
) – aCamel.StoreSummary
info (
Camel.StoreInfo
) – aCamel.StoreInfo
- Returns:
the path string from info
- Return type:
Returns the path string from info.
Deprecated since version 3.46: Use
Camel.StoreInfo.get_path
() instead.
- Camel.store_info_set_string(summary, info, type, value)¶
- Parameters:
summary (
Camel.StoreSummary
) – aCamel.StoreSummary
objectinfo (
Camel.StoreInfo
) – aCamel.StoreInfo
type (
int
) – specific string being setvalue (
str
) – string value to set
Set a specific string on the info.
Deprecated since version 3.46: Use
Camel.StoreInfo.set_value
() instead.
- Camel.string_is_all_ascii(str)¶
- Parameters:
- Returns:
True
, when the str isNone
, an empty string or when it contains only ASCII letters.- Return type:
New in version 3.44.
- Camel.system_flag(name)¶
- Parameters:
name (
str
) – name of a system flag- Returns:
the integer value of the system flag string
- Return type:
- Camel.system_flag_get(flags, name)¶
- Parameters:
flags (
Camel.MessageFlags
) – bitwise system flagsname (
str
) – name of the flag to check for
- Returns:
- Return type:
Find the state of the flag name in flags.
- Camel.text_to_html(in_, flags, color)¶
- Parameters:
in (
str
) – input textflags (
Camel.MimeFilterToHTMLFlags
) – bitwise flags defining the html conversion behaviourcolor (
int
) – color to use when syntax highlighting
- Returns:
a newly allocated string containing the HTMLified version of in
- Return type:
Convert in from plain text into HTML.
- Camel.time_value_apply(src_time, unit, value)¶
- Parameters:
src_time (
int
) – a time_t to apply the value to, or -1 to use the current timeunit (
Camel.TimeUnit
) – aCamel.TimeUnit
value (
int
) – a value to apply
- Returns:
src_time modified by the given parameters as date, with the time
Camel.part
being beginning of the day.- Return type:
Applies the given time value in unit unit to the src_time. Use negative value to subtract it. The time
Camel.part
is rounded to the beginning of the day.New in version 3.24.
- Camel.transfer_encoding_to_string(encoding)¶
- Parameters:
encoding (
Camel.TransferEncoding
) –- Return type:
- Camel.ucs2_utf8(ptr)¶
- Parameters:
ptr (
str
) – a ucs2 string to convert- Returns:
The converted string. Free it with
GLib.free
(), when no longer needed.- Return type:
Convert a ucs2 string into a UTF-8 one. The ucs2 string is treated as network byte ordered, and terminated with a 16-bit
None
.
- Camel.uid_cache_free_uids(uids)¶
- Parameters:
uids ([
str
]) – an array returned fromCamel.UIDCache.get_new_uids
()
Frees the array of UIDs.
- Camel.unlock_dot(path)¶
- Parameters:
path (
str
) – a path to unlock
Attempt to unlock a .lock lock.
The function does nothing, when dot locking had not been compiled.
- Camel.unlock_fcntl(fd)¶
- Parameters:
fd (
int
) – a file descriptor
Unlock an fcntl lock.
The function does nothing, when fcntl locking had not been compiled.
- Camel.unlock_flock(fd)¶
- Parameters:
fd (
int
) – a file descriptor
Unlock an flock lock.
The function does nothing, when flock locking had not been compiled.
- Camel.unlock_folder(path, fd)¶
-
Free a lock on a folder.
- Camel.url_addrspec_end(in_, pos, inend, match)¶
- Parameters:
in (
str
) –pos (
str
) –inend (
str
) –match (
Camel.UrlMatch
) –
- Return type:
- Camel.url_addrspec_start(in_, pos, inend, match)¶
- Parameters:
in (
str
) –pos (
str
) –inend (
str
) –match (
Camel.UrlMatch
) –
- Return type:
- Camel.url_decode(part)¶
- Parameters:
part (
str
) – a URLCamel.part
%-decodes the passed-in URL *in place*. The decoded version is never longer than the encoded version, so there does not need to be any additional space at the end of the string.
- Camel.url_encode(part, escape_extra)¶
- Parameters:
- Returns:
the encoded string
- Return type:
This %-encodes the given URL
Camel.part
and returns the escaped version in allocated memory, which the caller must free when it is done.
- Camel.url_file_end(in_, pos, inend, match)¶
- Parameters:
in (
str
) –pos (
str
) –inend (
str
) –match (
Camel.UrlMatch
) –
- Return type:
- Camel.url_file_start(in_, pos, inend, match)¶
- Parameters:
in (
str
) –pos (
str
) –inend (
str
) –match (
Camel.UrlMatch
) –
- Return type:
- Camel.url_web_end(in_, pos, inend, match)¶
- Parameters:
in (
str
) –pos (
str
) –inend (
str
) –match (
Camel.UrlMatch
) –
- Return type:
- Camel.url_web_start(in_, pos, inend, match)¶
- Parameters:
in (
str
) –pos (
str
) –inend (
str
) –match (
Camel.UrlMatch
) –
- Return type:
- Camel.utf7_utf8(ptr)¶
- Parameters:
ptr (
str
) – a UTF-7 string to convert- Returns:
The converted string. Free it with
GLib.free
(), when no longer needed.- Return type:
Convert a modified UTF-7 string to UTF-8. If the UTF-7 string contains 8 bit characters, they are treated as iso-8859-1.
The IMAP rules [rfc2060] are used in the UTF-7 encoding.
- Camel.utf8_getc(ptr)¶
- Parameters:
ptr (
int
) – a pointer to read the character from- Returns:
The next Unicode character. The ptr will be advanced to the next character always.
- ptr:
a pointer to read the character from
- Return type:
Get a Unicode character from a UTF-8 stream. ptr will be advanced to the next character position. Invalid utf8 characters will be silently skipped. The ptr should point to a NUL terminated array.
- Camel.utf8_getc_limit(ptr, end)¶
- Parameters:
- Returns:
The next UTF-8
str
, or 0xffff.- ptr:
a pointer to read the character from
- Return type:
Get the next UTF-8
str
at ptr, and return it, advancing ptr to the next character. If end is reached before a full UTF-8 character can be read, then the invalid Unicodestr
0xffff is returned as a sentinel (Unicode 3.1, section 2.7), and ptr is not advanced.
- Camel.utf8_make_valid(text)¶
- Parameters:
text (
str
) – a text to make valid- Returns:
Valid UTF-8 string, with replaced incorrect letters. Free it with
GLib.free
(), when no longer needed.- Return type:
Ensures the returned text will be valid UTF-8 string, with incorrect letters changed to question marks.
New in version 2.26.
- Camel.utf8_make_valid_len(text, text_len)¶
- Parameters:
- Returns:
Valid UTF-8 string, with replaced incorrect letters. Free it with
GLib.free
(), when no longer needed.- Return type:
Ensures the returned text will be valid UTF-8 string, with incorrect letters changed to question marks.
New in version 3.34.
- Camel.utf8_putc(ptr, c)¶
- Parameters:
- Returns:
pointer to write the character to
- Return type:
ptr:
int
Output a 32 bit unicode character as UTF-8 octets. At most 4 octets will be written to ptr. The ptr will be advanced to the next character position.
- Camel.utf8_ucs2(ptr)¶
- Parameters:
ptr (
str
) – a UTF-8 string to convert- Returns:
The converted string. Free it with
GLib.free
(), when no longer needed.- Return type:
Convert a UTF-8 string into a ucs2 one. The ucs string will be in network byte order, and terminated with a 16-bit
None
.
- Camel.utf8_utf7(ptr)¶
- Parameters:
ptr (
str
) – a UTF-8 string to convert- Returns:
The converted string. Free it with
GLib.free
(), when no longer needed.- Return type:
Convert a UTF-8 string to a modified UTF-7 format.
The IMAP rules [rfc2060] are used in the UTF-7 encoding.
- Camel.util_bdata_get_number(bdata_ptr, default_value)¶
- Parameters:
- Returns:
The read number, or the default_value, if the bdata_ptr doesn’t point to a number.
- Return type:
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
().New in version 3.24.
- Camel.util_bdata_get_string(bdata_ptr, default_value)¶
- Parameters:
- 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
GLib.free
() when done with it.- Return type:
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
().New in version 3.24.
- Camel.util_bdata_put_number(bdata_str, value)¶
- Parameters:
bdata_str (
GLib.String
) – aGLib.String
to store a backend specific data (bdata)value (
int
) – a value to store
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
().New in version 3.24.
- Camel.util_bdata_put_string(bdata_str, value)¶
- Parameters:
bdata_str (
GLib.String
) – aGLib.String
to store a backend specific data (bdata)value (
str
) – a value to store
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.
New in version 3.24.
- Camel.util_decode_user_header_setting(setting_value)¶
- Parameters:
setting_value (
str
) – the value to decode- Returns:
- out_display_name:
location for the decoded display name, or
None
when not needed- out_header_name:
the location for the decoded header name
- Return type:
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
None
when the setting_value contains invalid data.The out_display_name can result in
None
when the setting_value does not contain the display name. In such case the header name can be used as the display name.New in version 3.42.
- Camel.util_encode_user_header_setting(display_name, header_name)¶
- Parameters:
- Returns:
a newly allocated string with encoded display_name and header_name
- Return type:
Encode the optional display_name and the header_name to a value suitable for
Gio.Settings
schema org.gnome.evolution-data-server and key camel-message-info-user-headers.Free the returned string with
GLib.free
(), when no longer needed.New in version 3.42.
- Camel.util_fill_message_info_user_headers(info, headers)¶
- Parameters:
info (
Camel.MessageInfo
) – aCamel.MessageInfo
headers (
Camel.NameValueArray
) – aCamel.NameValueArray
with the headers to read from
- Returns:
Whether the info's user headers changed
- Return type:
Fill info ‘s user-headers with the user-defined headers from the headers array.
New in version 3.42.
- Camel.util_get_directory_variants(main_path, replace_prefix, with_modules_dir)¶
- Parameters:
- Returns:
a
GLib.PtrArray
with paths to use, including the main_path. Free it with g_ptr_array_unref(), when no longer needed.- Return type:
[
str
]
The main_path is a directory, which will be always used. It should have as its prefix the replace_prefix, otherwise the function returns only the main_path in the paths array.
When there’s exported an environment variable EDS_EXTRA_PREFIXES, it is used as a list of alternative prefixes where to look for the main_path (rest after the replace_prefix).
When the with_modules_dir is
True
, there’s also addedGLib.get_user_data_dir
() + “evolution/modules/”, aka ~/.local/share/evolution/modules/, into the resulting array.New in version 3.40.
- Camel.utils_sanitize_ascii_domain_in_address(email_address, do_format)¶
- Parameters:
- Returns:
the email_address with only ASCII letters, if such conversion is needed or
None
, when no conversion was required.See:
Camel.hostname_utils_requires_ascii
(),Camel.InternetAddress.sanitize_ascii_domain
(),Camel.utils_sanitize_ascii_domain_in_url_str
()- Return type:
Checks whether the domain in the email_address requires conversion to ASCII and if it does it also converts it. When the do_format is
True
, the output string is formatted for display, otherwise it’s encoded for use in the message headers. ANone
is returned when no conversion was needed.New in version 3.44.
- Camel.utils_sanitize_ascii_domain_in_url(url)¶
- Parameters:
- Returns:
True
, when the conversion was required.See:
Camel.hostname_utils_requires_ascii
(),Camel.utils_sanitize_ascii_domain_in_url_str
()- Return type:
Checks whether the host name of the url requires conversion to ASCII and converts it, if needed.
New in version 3.44.
- Camel.utils_sanitize_ascii_domain_in_url_str(url_str)¶
- Parameters:
- Returns:
converted url_str to ASCII host name, or
None
, when no conversion was needed.See:
Camel.hostname_utils_requires_ascii
(),Camel.utils_sanitize_ascii_domain_in_url
()- Return type:
Checks whether the host name of the url_str requires conversion to ASCII and converts it if needed. Returns
None
, when no conversion was required.New in version 3.44.
- Camel.uudecode_step(in_, out, save)¶
- Parameters:
- Returns:
the number of bytes decoded
- out:
output stream
- save:
leftover bits that have not yet been decoded
- Return type:
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.
- Camel.uuencode_close(in_, out, uubuf, save)¶
- Parameters:
- Returns:
the number of bytes encoded
- out:
output stream
- uubuf:
temporary buffer of 60 bytes
- save:
leftover bits that have not yet been encoded
- Return type:
Uuencodes a chunk of data. Call this when finished encoding data with
Camel.uuencode_step
() to flush off the last little bit.
- Camel.uuencode_step(in_, out, uubuf, save)¶
- Parameters:
- Returns:
the number of bytes encoded
- out:
output stream
- uubuf:
temporary buffer of 60 bytes
- save:
leftover bits that have not yet been encoded
- Return type:
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).
- Camel.write(fd, buf, n, cancellable)¶
- Parameters:
fd (
int
) – file descriptorbuf (
str
) – buffer to writen (
int
) – number of bytes of buf to writecancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
- Raises:
- Returns:
number of bytes written or -1 on fail. On failure, errno will be set appropriately.
- Return type:
Cancellable libc write() replacement.
Code that intends to be portable to Win32 should call this function only on file descriptors returned from open(), not on sockets.
- Camel.ydecode_step(in_)¶
- Parameters:
in (
bytes
) – input buffer- Returns:
the number of bytes decoded
- out:
output buffer
- state:
ydecode state
- pcrc:
Camel.part
crc state- crc:
crc state
- Return type:
Performs a ‘decode step’ on a chunk of yEncoded data of length inlen pointed to by in and writes to out. Assumes the =ybegin and =ypart lines have already been stripped off.
To get the crc32 value of the
Camel.part
, use #CAMEL_MIME_YENCODE_CRC_FINAL (pcrc). If there are more parts, you should reuse crc without re-initializing. Once all parts have been decoded, you may get the combined crc32 value of all the parts using #CAMEL_MIME_YENCODE_CRC_FINAL (crc).
- Camel.yencode_close(in_)¶
- Parameters:
in (
bytes
) – input buffer- Returns:
the number of bytes encoded.
- out:
output buffer
- state:
yencode state
- pcrc:
Camel.part
crc state- crc:
crc state
- Return type:
Call this function when finished encoding data with
Camel.yencode_step
() to flush off the remaining state.#CAMEL_MIME_YENCODE_CRC_FINAL (pcrc) will give you the crc32 of the encoded “
Camel.part
". If there are more “parts” to encode, you should re-use crc when encoding the next “parts” and then use #CAMEL_MIME_YENCODE_CRC_FINAL (crc) to get the combined crc32 value of all the parts.
- Camel.yencode_step(in_)¶
- Parameters:
in (
bytes
) – input buffer- Returns:
the number of bytes encoded
- out:
output buffer
- state:
yencode state
- pcrc:
Camel.part
crc state- crc:
crc state
- Return type:
Performs an yEncode ‘encode step’ on a chunk of raw data of length inlen pointed to by in and writes to out.
state should be initialized to
Camel.MIME_YENCODE_STATE_INIT
before beginning making the first call to this function. Subsequent calls should reuse state.Along the same lines, pcrc and crc should be initialized to
Camel.MIME_YENCODE_CRC_INIT
before using.