EmpathyContact

EmpathyContact

Synopsis

                    EmpathyContact;
                    EmpathyAvatar;
enum                EmpathyCapabilities;
EmpathyContact *    empathy_contact_new                 (TpContact *tp_contact);
EmpathyContact *    empathy_contact_new_for_log         (EmpathyAccount *account,
                                                         const gchar *id,
                                                         const gchar *name,
                                                         gboolean is_user);
TpContact *         empathy_contact_get_tp_contact      (EmpathyContact *contact);
const gchar *       empathy_contact_get_id              (EmpathyContact *contact);
void                empathy_contact_set_id              (EmpathyContact *contact,
                                                         const gchar *id);
const gchar *       empathy_contact_get_name            (EmpathyContact *contact);
void                empathy_contact_set_name            (EmpathyContact *contact,
                                                         const gchar *name);
EmpathyAvatar *     empathy_contact_get_avatar          (EmpathyContact *contact);
void                empathy_contact_set_avatar          (EmpathyContact *contact,
                                                         EmpathyAvatar *avatar);
EmpathyAccount *    empathy_contact_get_account         (EmpathyContact *contact);
TpConnection *      empathy_contact_get_connection      (EmpathyContact *contact);
TpConnectionPresenceType  empathy_contact_get_presence  (EmpathyContact *contact);
void                empathy_contact_set_presence        (EmpathyContact *contact,
                                                         TpConnectionPresenceType presence);
const gchar *       empathy_contact_get_presence_message
                                                        (EmpathyContact *contact);
void                empathy_contact_set_presence_message
                                                        (EmpathyContact *contact,
                                                         const gchar *message);
guint               empathy_contact_get_handle          (EmpathyContact *contact);
void                empathy_contact_set_handle          (EmpathyContact *contact,
                                                         guint handle);
EmpathyCapabilities  empathy_contact_get_capabilities   (EmpathyContact *contact);
void                empathy_contact_set_capabilities    (EmpathyContact *contact,
                                                         EmpathyCapabilities capabilities);
gboolean            empathy_contact_is_user             (EmpathyContact *contact);
void                empathy_contact_set_is_user         (EmpathyContact *contact,
                                                         gboolean is_user);
gboolean            empathy_contact_is_online           (EmpathyContact *contact);
const gchar *       empathy_contact_get_status          (EmpathyContact *contact);
gboolean            empathy_contact_can_voip            (EmpathyContact *contact);
gboolean            empathy_contact_can_send_files      (EmpathyContact *contact);
gboolean            empathy_contact_can_use_stream_tube (EmpathyContact *contact);
guint               empathy_contact_hash                (gconstpointer key);
void                empathy_contact_load_avatar_data    (EmpathyContact *contact,
                                                         const guchar *data,
                                                         const gsize len,
                                                         const gchar *format,
                                                         const gchar *token);
gboolean            empathy_contact_load_avatar_cache   (EmpathyContact *contact,
                                                         const gchar *token);
#define             EMPATHY_TYPE_AVATAR
GType               empathy_avatar_get_type             (void);
EmpathyAvatar *     empathy_avatar_new                  (guchar *data,
                                                         gsize len,
                                                         gchar *format,
                                                         gchar *token,
                                                         gchar *filename);
EmpathyAvatar *     empathy_avatar_ref                  (EmpathyAvatar *avatar);
void                empathy_avatar_unref                (EmpathyAvatar *avatar);
gboolean            empathy_avatar_save_to_file         (EmpathyAvatar *avatar,
                                                         const gchar *filename,
                                                         GError **error);
GHashTable *        empathy_contact_get_location        (EmpathyContact *contact);
void                empathy_contact_set_location        (EmpathyContact *contact,
                                                         GHashTable *location);
gboolean            empathy_contact_equal               (gconstpointer contact1,
                                                         gconstpointer contact2);

Object Hierarchy

  GObject
   +----EmpathyContact

Properties

  "account"                  EmpathyAccount*       : Read / Write / Construct Only
  "avatar"                   EmpathyAvatar*        : Read / Write
  "capabilities"             EmpathyCapabilities   : Read / Write / Construct
  "handle"                   guint                 : Read / Write
  "id"                       gchar*                : Read / Write
  "is-user"                  gboolean              : Read / Write
  "location"                 GHashTable*           : Read
  "name"                     gchar*                : Read / Write
  "presence"                 guint                 : Read / Write
  "presence-message"         gchar*                : Read / Write
  "tp-contact"               TpContact*            : Read / Write / Construct Only

Signals

  "presence-changed"                               : Run Last

Description

Details

EmpathyContact

typedef struct _EmpathyContact EmpathyContact;


EmpathyAvatar

typedef struct {
  guchar *data;
  gsize len;
  gchar *format;
  gchar *token;
  gchar *filename;
  guint refcount;
} EmpathyAvatar;


enum EmpathyCapabilities

typedef enum {
  EMPATHY_CAPABILITIES_NONE = 0,
  EMPATHY_CAPABILITIES_AUDIO = 1 << 0,
  EMPATHY_CAPABILITIES_VIDEO = 1 << 1,
  EMPATHY_CAPABILITIES_FT = 1 << 2,
  EMPATHY_CAPABILITIES_STREAM_TUBE = 1 << 3,
  EMPATHY_CAPABILITIES_UNKNOWN = 1 << 7
} EmpathyCapabilities;


empathy_contact_new ()

EmpathyContact *    empathy_contact_new                 (TpContact *tp_contact);

tp_contact :

Returns :


empathy_contact_new_for_log ()

EmpathyContact *    empathy_contact_new_for_log         (EmpathyAccount *account,
                                                         const gchar *id,
                                                         const gchar *name,
                                                         gboolean is_user);

account :

id :

name :

is_user :

Returns :


empathy_contact_get_tp_contact ()

TpContact *         empathy_contact_get_tp_contact      (EmpathyContact *contact);

contact :

Returns :


empathy_contact_get_id ()

const gchar *       empathy_contact_get_id              (EmpathyContact *contact);

contact :

Returns :


empathy_contact_set_id ()

void                empathy_contact_set_id              (EmpathyContact *contact,
                                                         const gchar *id);

contact :

id :


empathy_contact_get_name ()

const gchar *       empathy_contact_get_name            (EmpathyContact *contact);

contact :

Returns :


empathy_contact_set_name ()

void                empathy_contact_set_name            (EmpathyContact *contact,
                                                         const gchar *name);

contact :

name :


empathy_contact_get_avatar ()

EmpathyAvatar *     empathy_contact_get_avatar          (EmpathyContact *contact);

contact :

Returns :


empathy_contact_set_avatar ()

void                empathy_contact_set_avatar          (EmpathyContact *contact,
                                                         EmpathyAvatar *avatar);

contact :

avatar :


empathy_contact_get_account ()

EmpathyAccount *    empathy_contact_get_account         (EmpathyContact *contact);

contact :

Returns :


empathy_contact_get_connection ()

TpConnection *      empathy_contact_get_connection      (EmpathyContact *contact);

contact :

Returns :


empathy_contact_get_presence ()

TpConnectionPresenceType  empathy_contact_get_presence  (EmpathyContact *contact);

contact :

Returns :


empathy_contact_set_presence ()

void                empathy_contact_set_presence        (EmpathyContact *contact,
                                                         TpConnectionPresenceType presence);

contact :

presence :


empathy_contact_get_presence_message ()

const gchar *       empathy_contact_get_presence_message
                                                        (EmpathyContact *contact);

contact :

Returns :


empathy_contact_set_presence_message ()

void                empathy_contact_set_presence_message
                                                        (EmpathyContact *contact,
                                                         const gchar *message);

contact :

message :


empathy_contact_get_handle ()

guint               empathy_contact_get_handle          (EmpathyContact *contact);

contact :

Returns :


empathy_contact_set_handle ()

void                empathy_contact_set_handle          (EmpathyContact *contact,
                                                         guint handle);

contact :

handle :


empathy_contact_get_capabilities ()

EmpathyCapabilities  empathy_contact_get_capabilities   (EmpathyContact *contact);

contact :

Returns :


empathy_contact_set_capabilities ()

void                empathy_contact_set_capabilities    (EmpathyContact *contact,
                                                         EmpathyCapabilities capabilities);

contact :

capabilities :


empathy_contact_is_user ()

gboolean            empathy_contact_is_user             (EmpathyContact *contact);

contact :

Returns :


empathy_contact_set_is_user ()

void                empathy_contact_set_is_user         (EmpathyContact *contact,
                                                         gboolean is_user);

contact :

is_user :


empathy_contact_is_online ()

gboolean            empathy_contact_is_online           (EmpathyContact *contact);

contact :

Returns :


empathy_contact_get_status ()

const gchar *       empathy_contact_get_status          (EmpathyContact *contact);

contact :

Returns :


empathy_contact_can_voip ()

gboolean            empathy_contact_can_voip            (EmpathyContact *contact);

contact :

Returns :


empathy_contact_can_send_files ()

gboolean            empathy_contact_can_send_files      (EmpathyContact *contact);

contact :

Returns :


empathy_contact_can_use_stream_tube ()

gboolean            empathy_contact_can_use_stream_tube (EmpathyContact *contact);

contact :

Returns :


empathy_contact_hash ()

guint               empathy_contact_hash                (gconstpointer key);

key :

Returns :


empathy_contact_load_avatar_data ()

void                empathy_contact_load_avatar_data    (EmpathyContact *contact,
                                                         const guchar *data,
                                                         const gsize len,
                                                         const gchar *format,
                                                         const gchar *token);

contact :

data :

len :

format :

token :


empathy_contact_load_avatar_cache ()

gboolean            empathy_contact_load_avatar_cache   (EmpathyContact *contact,
                                                         const gchar *token);

contact :

token :

Returns :


EMPATHY_TYPE_AVATAR

#define EMPATHY_TYPE_AVATAR (empathy_avatar_get_type ())


empathy_avatar_get_type ()

GType               empathy_avatar_get_type             (void);

Returns :


empathy_avatar_new ()

EmpathyAvatar *     empathy_avatar_new                  (guchar *data,
                                                         gsize len,
                                                         gchar *format,
                                                         gchar *token,
                                                         gchar *filename);

Create a EmpathyAvatar from the provided data. This function takes the ownership of data, format, token and filename.

data :

the avatar data

len :

the size of avatar data

format :

the mime type of the avatar image

token :

the token of the avatar

filename :

the filename where the avatar is stored in cache

Returns :

a new EmpathyAvatar

empathy_avatar_ref ()

EmpathyAvatar *     empathy_avatar_ref                  (EmpathyAvatar *avatar);

avatar :

Returns :


empathy_avatar_unref ()

void                empathy_avatar_unref                (EmpathyAvatar *avatar);

avatar :


empathy_avatar_save_to_file ()

gboolean            empathy_avatar_save_to_file         (EmpathyAvatar *avatar,
                                                         const gchar *filename,
                                                         GError **error);

Save the avatar to a file named filename

avatar :

the avatar

filename :

name of a file to write avatar to

error :

return location for a GError, or NULL

Returns :

TRUE on success, FALSE if an error occurred

empathy_contact_get_location ()

GHashTable *        empathy_contact_get_location        (EmpathyContact *contact);

Returns the user's location if available. The keys are defined in empathy-location.h. If the contact doesn't have location information, the GHashTable will be empthy. Use g_hash_table_unref when you are done with the GHashTable.

It is composed of string keys and GValues. Keys are defined in empathy-location.h such as EMPATHY_LOCATION_COUNTRY. Example: a "city" key would have "Helsinki" as string GValue, a "latitude" would have 65.0 as double GValue.

contact :

an EmpathyContact

Returns :

a GHashTable of location values

empathy_contact_set_location ()

void                empathy_contact_set_location        (EmpathyContact *contact,
                                                         GHashTable *location);

Sets the user's location based on the location GHashTable passed. It is composed of string keys and GValues. Keys are defined in empathy-location.h such as EMPATHY_LOCATION_COUNTRY. Example: a "city" key would have "Helsinki" as string GValue, a "latitude" would have 65.0 as double GValue.

contact :

an EmpathyContact

location :

a GHashTable of the location

empathy_contact_equal ()

gboolean            empathy_contact_equal               (gconstpointer contact1,
                                                         gconstpointer contact2);

contact1 :

an EmpathyContact

contact2 :

an EmpathyContact

Returns :

FALSE if one of the contacts is NULL but the other is not. Otherwise returns TRUE if both pointer are equal or if they bith refer to the same id. It's only necessary to call this function if your contact objects come from logs where contacts are created dynamically and comparing pointers is not enough.

Property Details

The "account" property

  "account"                  EmpathyAccount*       : Read / Write / Construct Only

The account associated with the contact.


The "avatar" property

  "avatar"                   EmpathyAvatar*        : Read / Write

The avatar image.


The "capabilities" property

  "capabilities"             EmpathyCapabilities   : Read / Write / Construct

Capabilities of the contact.

Default value: EMPATHY_CAPABILITIES_UNKNOWN


The "handle" property

  "handle"                   guint                 : Read / Write

The handle of the contact.

Default value: 0


The "id" property

  "id"                       gchar*                : Read / Write

String identifying contact.

Default value: NULL


The "is-user" property

  "is-user"                  gboolean              : Read / Write

Is contact the user.

Default value: FALSE


The "location" property

  "location"                 GHashTable*           : Read

Physical location of the contact.


The "name" property

  "name"                     gchar*                : Read / Write

The name of the contact.

Default value: NULL


The "presence" property

  "presence"                 guint                 : Read / Write

Presence of contact.

Allowed values: <= 9

Default value: 0


The "presence-message" property

  "presence-message"         gchar*                : Read / Write

Presence message of contact.

Default value: NULL


The "tp-contact" property

  "tp-contact"               TpContact*            : Read / Write / Construct Only

The TpContact associated with the contact.

Signal Details

The "presence-changed" signal

void                user_function                      (EmpathyContact *empathycontact,
                                                        guint           arg1,
                                                        guint           arg2,
                                                        gpointer        user_data)           : Run Last

empathycontact :

the object which received the signal.

arg1 :

arg2 :

user_data :

user data set when the signal handler was connected.