Functions¶
Details¶
- EBookContacts.address_western_parse(in_address)¶
- Parameters:
in_address (
strorNone) – a string representing a mailing address- Returns:
A new
EBookContacts.AddressWesternstructure, orNoneif the parsing failed or when the in_address wasNone.- Return type:
Parses a string representing a mailing address into a structure of type
EBookContacts.AddressWestern.
- EBookContacts.book_client_error_create(code, custom_msg)¶
- Parameters:
code (
EBookContacts.BookClientError) – anEBookContacts.BookClientErrorcode to createcustom_msg (
strorNone) – custom message to use for the error; can beNone
- Returns:
a new
GLib.Errorcontaining an E_BOOK_CLIENT_ERROR of the given code. If the custom_msg isNone, then the error message is the one returned fromEBookContacts.book_client_error_to_string() for the code, otherwise the given message is used.Returned pointer should be freed with
GLib.Error.free().- Return type:
New in version 3.2.
- EBookContacts.book_client_error_to_string(code)¶
- Parameters:
code (
EBookContacts.BookClientError) – anEBookContacts.BookClientErrorcode- Returns:
Localized human readable description of the given error code
- Return type:
Get localized human readable description of the given error code.
New in version 3.2.
- EBookContacts.book_indices_get_ascending_sort(self)¶
- Parameters:
self (
EBookContacts.BookIndicesUpdater) – anEBookContacts.BookIndicesUpdater- Returns:
True, when considers contacts sorted in ascending order,Falsewhen in the descending order.- Return type:
Returns whether the self considers contacts stored in the ascending order.
New in version 3.50.
- EBookContacts.book_indices_set_ascending_sort(self, ascending_sort)¶
- Parameters:
self (
EBookContacts.BookIndicesUpdater) – anEBookContacts.BookIndicesUpdaterascending_sort (
bool) – the value to set
Sets whether the contacts are sorted in an ascending order; if not, then they are sorted in the descending order. That influences what indexes the indices have set.
New in version 3.50.
- EBookContacts.book_query_and(nqs, qs, unref)¶
- Parameters:
nqs (
int) – the number of queries to ANDqs (
EBookContacts.BookQuery) – pointer to an array ofEBookContacts.BookQueryitemsunref (
bool) – ifTrue, the new query takes ownership of the existing queries
- Returns:
A new
EBookContacts.BookQuery- Return type:
Create a new
EBookContacts.BookQuerywhich is the logical AND of the queries in #qs.
- EBookContacts.book_query_any_field_contains(value)¶
- Parameters:
value (
str) – a value- Returns:
the new
EBookContacts.BookQuery- Return type:
Creates a new
EBookContacts.BookQuerywhich tests if any field contains value.
- EBookContacts.book_query_field_exists(field)¶
- Parameters:
field (
EBookContacts.ContactField) – anEBookContacts.ContactField- Returns:
the new
EBookContacts.BookQuery- Return type:
Creates a new
EBookContacts.BookQuerywhich tests if the field field exists.
- EBookContacts.book_query_field_test(field, test, value)¶
- Parameters:
field (
EBookContacts.ContactField) – anEBookContacts.ContactFieldto testtest (
EBookContacts.BookQueryTest) – the test to applyvalue (
str) – the value to test for
- Returns:
the new
EBookContacts.BookQuery- Return type:
Creates a new
EBookContacts.BookQuerywhich tests field for value using the test test.
- EBookContacts.book_query_from_string(query_string)¶
- Parameters:
query_string (
str) – the query- Returns:
the new
EBookContacts.BookQuery.- Return type:
Parse query_string and return a new
EBookContacts.BookQueryrepresenting it.
- EBookContacts.book_query_or(nqs, qs, unref)¶
- Parameters:
nqs (
int) – the number of queries to ORqs (
EBookContacts.BookQuery) – pointer to an array ofEBookContacts.BookQueryitemsunref (
bool) – ifTrue, the new query takes ownership of the existing queries
- Returns:
A new
EBookContacts.BookQuery- Return type:
Creates a new
EBookContacts.BookQuerywhich is the logical OR of the queries in #qs.
- EBookContacts.book_query_vcard_field_exists(field)¶
- Parameters:
field (
str) – a field name- Returns:
the new
EBookContacts.BookQuery- Return type:
Creates a new
EBookContacts.BookQuerywhich tests if the field field exists. field should be a vCard field name, such asEBookContacts.EVC_FNorEBookContacts.EVC_X_MSN.
- EBookContacts.book_query_vcard_field_test(field, test, value)¶
- Parameters:
field (
str) – aEBookContacts.VCardfield name to testtest (
EBookContacts.BookQueryTest) – the test to applyvalue (
str) – the value to test for
- Returns:
the new
EBookContacts.BookQuery- Return type:
Creates a new
EBookContacts.BookQuerywhich tests field for value using the test test.New in version 2.22.
- EBookContacts.book_util_conflict_resolution_to_operation_flags(conflict_resolution)¶
- Parameters:
conflict_resolution (
EDataServer.ConflictResolution) – anEDataServer.ConflictResolution- Returns:
a bit-or of
EBookContacts.BookOperationFlags, corresponding to the conflict_resolution- Return type:
Encodes the
EDataServer.ConflictResolutioninto the bit-or ofEBookContacts.BookOperationFlags. The returned value can be bit-or-ed with otherEBookContacts.BookOperationFlagsvalues.New in version 3.34.
- EBookContacts.book_util_diff_categories(old_contact, new_contact)¶
- Parameters:
old_contact (
EBookContacts.ContactorNone) – an oldEBookContacts.Contact, orNonenew_contact (
EBookContacts.ContactorNone) – a newEBookContacts.Contact, orNone
- Returns:
- out_added:
a
GLib.HashTablewith added categories- out_removed:
a
GLib.HashTablewith removed categories
- Return type:
Compares list of categories on the old_contact with the list of categories on the new_contact and fills out_added categories and out_removed categories accordingly, as if the old_contact is replaced with the new_contact. When either of the contacts is
None, it’s considered as having no categories set. Rather than returning emptyGLib.HashTable, the return argument is set toNonewhen there are no added/removed categories.The key of the hash table is the category string, the value is an integer (1). There is used the hash table only for speed.
The returned
GLib.HashTable-s should be freed withGLib.HashTable.unref(), when no longer needed.New in version 3.48.
- EBookContacts.book_util_foreach_address(email_address, func, *user_data)¶
- Parameters:
email_address (
str) – one or more email addresses as stringfunc (
GLib.HRFunc) – a function to call for each email user_data (closureCamel.func): user data passed to func
Parses the email_address and calls func for each found address. The first parameter of the func is the name, the second parameter of the func is the email, the third parameters of the func is the user_data. The func returns
True, to continue processing.New in version 3.44.
- EBookContacts.book_util_operation_flags_to_conflict_resolution(flags)¶
- Parameters:
flags (
int) – bit-or ofEBookContacts.BookOperationFlags- Returns:
an
EDataServer.ConflictResolutionas stored in the flags- Return type:
Decodes the
EDataServer.ConflictResolutionfrom the bit-or ofEBookContacts.BookOperationFlags.New in version 3.34.
- EBookContacts.contact_attr_list_copy(list)¶
-
Copies a list of allocated strings, specifically for the #EContactAttrList boxed type used for multi valued contact fields.
New in version 3.8.
- EBookContacts.contact_attr_list_free(list)¶
-
Frees a list of allocated strings, specifically for the #EContactAttrList boxed type used for multi valued contact fields.
New in version 3.8.
- EBookContacts.contact_date_from_string(str)¶
- Parameters:
str (
str) – a date string in the format YYYY-MM-DD or YYYYMMDD- Returns:
A new
EBookContacts.ContactDatestruct.- Return type:
Creates a new
EBookContacts.ContactDatebased on str.
- EBookContacts.contact_name_from_string(name_str)¶
- Parameters:
name_str (
str) – a string representing a contact’s full name- Returns:
A new
EBookContacts.ContactNamestruct.- Return type:
Creates a new
EBookContacts.ContactNamebased on the parsed name_str.
- EBookContacts.name_western_parse(full_name)¶
- Parameters:
full_name (
str) – A string containing a western name.- Returns:
A new
EBookContacts.NameWesternstruct.- Return type:
Parses full_name and returns an
EBookContacts.NameWesternstruct filled with the component parts of the name.
- EBookContacts.phone_number_compare_strings(first_number, second_number)¶
- Parameters:
first_number (
str) – the firstEBookContacts.PhoneNumberto comparesecond_number (
str) – the secondEBookContacts.PhoneNumberto compare
- Raises:
- Returns:
The quality of matching for the two phone numbers.
- Return type:
Compares two phone numbers.
New in version 3.8.
- EBookContacts.phone_number_compare_strings_with_region(first_number, second_number, region_code)¶
- Parameters:
first_number (
str) – the firstEBookContacts.PhoneNumberto comparesecond_number (
str) – the secondEBookContacts.PhoneNumberto compareregion_code (
strorNone) – a two-letter country code, orNone
- Raises:
- Returns:
The quality of matching for the two phone numbers.
- Return type:
Compares two phone numbers within the context of region_code.
New in version 3.8.
- EBookContacts.phone_number_from_string(phone_number, region_code)¶
- Parameters:
- Raises:
- Returns:
a new
EBookContacts.PhoneNumberinstance on success, orNoneon error. CallEBookContacts.PhoneNumber.free() to release this instance.- Return type:
Parses the string passed in phone_number. Note that no validation is performed whether the recognized phone number is valid for a particular region.
The two-letter country code passed in region_code only is used if the phone_number is not written in international format. The application’s default region as returned by
EBookContacts.PhoneNumber.get_default_region() is used if region_code isNone.If the number is guaranteed to start with a ‘+’ followed by the country calling code, then “ZZ” can be passed for region_code.
New in version 3.8.
- EBookContacts.phone_number_get_country_code_for_region(region_code)¶
- Parameters:
region_code (
strorNone) – a two-letter country code, a locale name, orNone- Raises:
- Returns:
a valid country calling code, or zero if an unknown region code was passed.
- Return type:
Retrieves the preferred country calling code for region_code, e.g. 358 for “fi” or 1 for “en_USUTF-8”.
If
Noneis passed for region_code the default region as returned byEBookContacts.PhoneNumber.get_default_region() is used.New in version 3.8.
- EBookContacts.phone_number_get_default_region()¶
- Raises:
- Returns:
a newly allocated string containing the current locale’s two-letter code for phone number parsing.
- Return type:
Retrieves the current two-letter country code that’s used by default for parsing phone numbers in
EBookContacts.PhoneNumber.from_string(). It can be useful to store this number before parsing a bigger number of phone numbers.The result of this functions depends on the current setup of the %LC_ADDRESS category: If that category provides a reasonable value for %_NL_ADDRESS_COUNTRY_AB2 this value is returned. Otherwise the locale name configured for %LC_ADDRESS is parsed.
New in version 3.8.
- EBookContacts.phone_number_is_supported()¶
-
Checks if phone number support is available. It is recommended to call this function before using any of the phone-utils functions to ensure that the required functionality is available, and to pick alternative mechanisms if needed.
New in version 3.8.