| Top |
GBoxed ├── EContactAddress ├── EContactCert ├── EContactDate ├── EContactDateTime ├── EContactGender ├── EContactGeo ├── EContactName ╰── EContactPhoto GObject ╰── EVCard ╰── EContact
This subclass of EVCard is a convenient interface for interacting with vCards. The EBookClient, EBookClientView and EBookClientCursor return vCards in the form of an EContact for your convenience.
Using e_contact_set() and e_contact_get() you get automatic conversion
between vCard standards. For example, when the EContact holds a vCard 3.0
data and E_CONTACT_BIRTHPLACE is used, an EVC_X_EVOLUTION_BIRTHPLACE attribute
is used to store the value, but when the EContact holds a vCard 4.0 data,
then the EVC_BIRTHPLACE attribute is used, because it's a valid attribute
in the vCard 4.0. Similarly the data formats are converted as needed.
Note: Some of the attributes are very specific and the EContact can construct
their values from multiple other attributes. One such is E_CONTACT_IMPP, which
always returns the data in the vCard 4.0 format ("scheme:value"), which the vCard
4.0 data has stored in an attribute EVC_IMPP, but the previous vCard versions
have it split into multiple different attributes (not only EVC_X_EVOLUTION_IMPP),
depending whether there exists a known EContact field for the used "scheme".
These things are taken care of both when using e_contact_get() and e_contact_set(),
to preserve as much compatibility between the vCard versions as possible, while
keeping the abstraction the EContact offers.
EContact *
e_contact_new_from_vcard (const gchar *vcard);
Creates a new EContact based on a vcard.
EContact * e_contact_new_from_vcard_with_uid (const gchar *vcard,const gchar *uid);
Creates a new EContact based on a vcard and a predefined UID.
Since: 3.4
EContact *
e_contact_duplicate (EContact *contact);
Creates a copy of contact
.
EContact * e_contact_convert (EContact *self,EVCardVersion to_version);
Converts the self
into the vCard version to_version
and returns a converted
copy of the self
. When the to_version
matches the version of the self
,
then does nothing and returns NULL.
the self
converted to to_version
,
or NULL, when it is in this version already.
[transfer full][nullable]
Since: 3.60
gpointer e_contact_get (EContact *contact,EContactField field_id);
Gets the value of contact
's field specified by field_id
.
gconstpointer e_contact_get_const (EContact *contact,EContactField field_id);
Gets the value of contact
's field specified by field_id
, caching
the result so it can be freed later. Use e_contact_field_is_string()
to check whether the field can be used here.
void e_contact_set (EContact *contact,EContactField field_id,gconstpointer value);
Sets the value of contact
's field specified by field_id
to value
.
EContactDate *
e_contact_date_from_string (const gchar *str);
Creates a new EContactDate based on str
.
gchar * e_contact_date_to_string (EContactDate *dt,EVCardVersion for_version);
Generates a date string in the format YYYY-MM-DD based
on the values of dt
.
Since: 3.60
gboolean e_contact_date_equal (EContactDate *dt1,EContactDate *dt2);
Checks if dt1
and dt2
are the same date.
void
e_contact_date_free (EContactDate *date);
Frees the date
struct and its contents.
EContactDateTime *
e_contact_date_time_new (void);
Creates a new EContactDateTime struct with unset date and time.
Since: 3.60
EContactDateTime * e_contact_date_time_from_string (const gchar *str,EContactDateTimeFlags flags);
Creates a new EContactDateTime based on str
.
Since: 3.60
gchar * e_contact_date_time_to_string (const EContactDateTime *self,EVCardVersion for_version,EContactDateTimeFlags flags);
Generates a date/time string in the for_version
format used by vCard standard,
omitting unset values of the self
. Free the returned string with
g_free(), when no longer needed.
self |
||
for_version |
an EVCardVersion with version to use the format for |
|
flags |
bit-or of EContactDateTimeFlags |
a new date/time string, or NULL,
when self
is NULL or when all members are unset.
[transfer full][nullable]
Since: 3.60
gboolean e_contact_date_time_equal (const EContactDateTime *dt1,const EContactDateTime *dt2);
Checks if dt1
and dt2
are the same date time.
Since: 3.60
gboolean
e_contact_date_time_has_date (const EContactDateTime *self);
Checks whether the self
has set at least one of the date members.
Since: 3.60
gboolean
e_contact_date_time_has_time (const EContactDateTime *self);
Checks whether the self
has set at least one of the time members.
Since: 3.60
void
e_contact_date_time_free (EContactDateTime *self);
Frees the self
struct and its content.
Since: 3.60
gchar *
e_contact_name_to_string (const EContactName *name);
Generates a string representation of name
.
EContactName *
e_contact_name_from_string (const gchar *name_str);
Creates a new EContactName based on the parsed name_str
.
EContactPhoto *
e_contact_photo_new (void);
Creates a new EContactPhoto struct.
Since: 3.2
void
e_contact_photo_free (EContactPhoto *photo);
Frees the photo
struct and its contents.
EContactPhoto *
e_contact_photo_copy (EContactPhoto *photo);
Creates a copy of photo
.
Since: 3.8
const guchar * e_contact_photo_get_inlined (EContactPhoto *photo,gsize *len);
Gets the photo
's data.
the inlined image in the
EContactPhoto, or NULL if it has not been set.
[transfer none][array length=len][nullable]
Since: 3.2
void e_contact_photo_set_inlined (EContactPhoto *photo,const guchar *data,gsize len);
Sets the photo
's inlined data.
photo |
||
data |
the inlined image data. |
[transfer none][array length=len] |
len |
the length of |
Since: 3.2
const gchar *
e_contact_photo_get_mime_type (EContactPhoto *photo);
Gets the photo
's mime type.
Since: 3.2
void e_contact_photo_set_mime_type (EContactPhoto *photo,const gchar *mime_type);
Sets the photo
's mime type.
Since: 3.2
const gchar *
e_contact_photo_get_uri (EContactPhoto *photo);
Gets the photo
's URI.
Since: 3.2
void e_contact_photo_set_uri (EContactPhoto *photo,const gchar *uri);
Sets the photo
's URI.
Since: 3.2
gboolean e_contact_inline_local_photos (EContact *contact,GError **error);
Tries to modify any EContactPhoto fields which are
stored on the local file system as type E_CONTACT_PHOTO_TYPE_URI
to be inlined and stored as E_CONTACT_PHOTO_TYPE_INLINED instead.
Since: 3.4
EContactGeo *
e_contact_geo_new (void);
Creates an EContactGeo struct with all coordinates set to 0.
Since: 3.8
EContactGeo * e_contact_geo_from_string (const gchar *latitude,const gchar *longitude);
Creates a new EContactGeo, which has set latitude and longitude from the provided strings.
latitude |
a text representation of the latitude |
|
longitude |
a text representation of the longitude |
a new EContactGeo, or NULL,
when cannot convert the latitude
or longitude
to a double.
[transfer full][nullable]
Since: 3.60
gboolean e_contact_geo_to_string (const EContactGeo *self,gchar **out_latitude,gchar **out_longitude);
Converts latitude and longitude of the self
into string.
Free the returned strings with g_free(), when no longer needed.
Note: the numbers are converted up to 6 digits after the decimal point.
self |
an EContactGeo |
|
out_latitude |
output location to store converted latitude into string. |
[out][transfer full][nullable] |
out_longitude |
output location to store converted longitude into string. |
[out][transfer full][nullable] |
TRUE, when the self
contained latitude and longitude
and the out arguments were populated, FALSE otherwise, which
also means the out arguments were not modified.
Since: 3.60
void
e_contact_geo_free (EContactGeo *geo);
Frees the geo
struct and its contents.
Since: 1.12
EContactCert *
e_contact_cert_new (void);
Creates an EContactCert struct with all values set to 0.
Since: 3.8
void
e_contact_cert_free (EContactCert *cert);
Frees the cert
struct and its contents.
EContactCert *
e_contact_cert_from_attr (EVCardAttribute *source);
Creates a new EContactCert structure with the information
from the source
attribute. Returns NULL, when
the information in the source
could not be stored
in the structure (for example when the KEY attribute
is a URI to some server).
a new EContactCert populated
with the data from the source
, or NULL, when the source contains
unknown information.
[transfer full][nullable]
Since: 3.60
void e_contact_cert_write_attr (EContactCert *self,EVCardVersion to_version,EVCardAttribute *destination);
Populates the destination
with the data from the self
,
using format suitable to to_version
vCard version. The
function does nothing when the self
is an empty structure.
The destination
is supposed to be a KEY attribute.
self |
an EContactCert |
|
to_version |
one of EVCardVersion |
|
destination |
a destination EVCardAttribute |
Since: 3.60
EContactAddress *
e_contact_address_new (void);
Creates a new EContactAddress struct.
Since: 3.2
void
e_contact_address_free (EContactAddress *address);
Frees the address
struct and its contents.
void
e_contact_address_clear (EContactAddress *address);
Frees all the members of the self
, but unlike e_contact_address_free(),
it does not free the self
itself.
Since: 3.60
void e_contact_address_read_attr (EContactAddress *self,EVCardAttribute *source);
Populates self
from the source
attribute.
Since: 3.60
void e_contact_address_write_attr (EContactAddress *self,EVCardAttribute *destination);
Populates ADR attribute destination
with the data from the self
.
Since: 3.60
GList *
e_contact_attr_list_copy (GList *list);
Copies a list of allocated strings, specifically for the EContactAttrList boxed type used for multi valued contact fields.
Since: 3.8
void
e_contact_attr_list_free (GList *list);
Frees a list of allocated strings, specifically for the EContactAttrList boxed type used for multi valued contact fields.
Since: 3.8
const gchar *
e_contact_gender_sex_to_string (EContactGenderSex sex);
Converts the sex
into a string, as used by the vCard 4.0 standard.
a vCard string representation of the sex
, or NULL,
when the value is not recognized.
[nullable]
Since: 3.60
EContactGenderSex
e_contact_gender_sex_from_string (const gchar *string);
Converts a string into an EContactGenderSex. Unrecognized values
are returned as E_CONTACT_GENDER_SEX_NOT_SET.
Since: 3.60
EContactGender *
e_contact_gender_new (void);
Creates a new empty EContactGender structure. Free it
with e_contact_gender_free() when no longer needed.
Since: 3.60
EContactGender *
e_contact_gender_copy (EContactGender *self);
Creates a copy of the self
. Returns NULL when self
is NULL.
Free it with e_contact_gender_free(), when no longer needed.
Since: 3.60
void
e_contact_gender_free (EContactGender *self);
Frees the self
. Does nothing, when self
is NULL.
Since: 3.60
GType
e_contact_field_type (EContactField field_id);
Gets the GType used for this contact field, this indicates
what kind of value can be passed to e_contact_set().
Since: 3.8
const gchar *
e_contact_field_name (EContactField field_id);
Gets the string representation of field_id
.
const gchar *
e_contact_pretty_name (EContactField field_id);
Gets a human-readable, translated string representation
of field_id
.
const gchar *
e_contact_vcard_attribute (EContactField field_id);
Gets the vcard attribute corresponding to field_id
, as a string.
const gchar *
e_contact_vcard_attribute_fallback (EContactField field_id);
Gets the vCard attribute name corresponding to field_id
, which is used
to hold vCard attributes in an earlier versions of the vCard standard
than in which the attribute had been added for.
Not every attribute has it set, thus a NULL is a valid return value.
the vCard fallback attribute name corresponding to field_id
,
or NULL, when the field_id
has not set any such fallback attribute.
[nullable]
Since: 3.60
gboolean
e_contact_field_is_string (EContactField field_id);
Returns whether the field_id
is of a string type,
thus it can be used with e_contact_get_const().
Since: 3.16
EContactField
e_contact_field_id (const gchar *field_name);
Gets the EContactField corresponding to the field_name
.
EContactField
e_contact_field_id_from_vcard (const gchar *vcard_field);
Gets the EContactField corresponding to the vcard_field
.
Since: 2.26
EContactField e_contact_impp_scheme_to_field (const gchar *scheme,guint *out_scheme_len);
Tries to find one of the predefined EContactField for
the scheme
, which can be either the scheme itself, like "icq:",
or a scheme with the value, like "icq:1234". The out_scheme_len
can be used to return how many letters from the beginning
of the scheme
can be skipped to get to the actual value.
Returns value E_CONTACT_FIELD_LAST means no matching
EContactField was found for the scheme
. The E_CONTACT_IMPP
is never returned, then the scheme
can be a valid scheme,
only the EContactField does not have a mapping for it.
scheme |
a URI scheme as "icq:", but can be with a value too |
|
out_scheme_len |
optional place where to store how many letters the scheme has. |
[out][optional] |
an EContactField corresponding to the scheme
,
or E_CONTACT_FIELD_LAST when no mapping exists for the scheme
.
Since: 3.60
const gchar *
e_contact_impp_field_to_scheme (EContactField field);
Gets a scheme (like "icq:") for the corresponding IM field
.
a scheme for the corresponding IM field, or NULL
when the field
is no predefined IM field.
[nullable]
Since: 3.60