void empathy_tp_contact_factory_get_from_handle (EmpathyTpContactFactory *tp_factory, TpHandle handle, EmpathyTpContactFactoryContactCb callback, gpointer user_data, GDestroyNotify destroy, GObject *weak_object) { EmpathyTpContactFactoryPriv *priv = GET_PRIV (tp_factory); GetContactsData *data; g_return_if_fail (EMPATHY_IS_TP_CONTACT_FACTORY (tp_factory)); data = g_slice_new (GetContactsData); data->callback.contact_cb = callback; data->user_data = user_data; data->destroy = destroy; data->tp_factory = g_object_ref (tp_factory); tp_connection_get_contacts_by_handle (priv->connection, 1, &handle, G_N_ELEMENTS (contact_features), contact_features, get_contact_by_handle_cb, data, (GDestroyNotify) get_contacts_data_free, weak_object); }
/* The callback is NOT given a reference to the EmpathyContact objects */ void empathy_tp_contact_factory_get_from_handles (EmpathyTpContactFactory *tp_factory, guint n_handles, const TpHandle *handles, EmpathyTpContactFactoryContactsByHandleCb callback, gpointer user_data, GDestroyNotify destroy, GObject *weak_object) { EmpathyTpContactFactoryPriv *priv = GET_PRIV (tp_factory); GetContactsData *data; if (n_handles == 0) { callback (tp_factory, 0, NULL, 0, NULL, NULL, user_data, weak_object); return; } g_return_if_fail (EMPATHY_IS_TP_CONTACT_FACTORY (tp_factory)); g_return_if_fail (handles != NULL); data = g_slice_new (GetContactsData); data->callback.handles_cb = callback; data->user_data = user_data; data->destroy = destroy; data->tp_factory = g_object_ref (tp_factory); tp_connection_get_contacts_by_handle (priv->connection, n_handles, handles, G_N_ELEMENTS (contact_features), contact_features, get_contacts_by_handle_cb, data, (GDestroyNotify) get_contacts_data_free, weak_object); }
/* The callback is NOT given a reference to the EmpathyContact objects */ void empathy_tp_contact_factory_get_from_ids (EmpathyTpContactFactory *tp_factory, guint n_ids, const gchar * const *ids, EmpathyTpContactFactoryContactsByIdCb callback, gpointer user_data, GDestroyNotify destroy, GObject *weak_object) { EmpathyTpContactFactoryPriv *priv = GET_PRIV (tp_factory); GetContactsData *data; g_return_if_fail (EMPATHY_IS_TP_CONTACT_FACTORY (tp_factory)); g_return_if_fail (ids != NULL); data = g_slice_new (GetContactsData); data->callback.ids_cb = callback; data->user_data = user_data; data->destroy = destroy; data->tp_factory = g_object_ref (tp_factory); tp_connection_get_contacts_by_id (priv->connection, n_ids, ids, G_N_ELEMENTS (contact_features), contact_features, get_contacts_by_id_cb, data, (GDestroyNotify) get_contacts_data_free, weak_object); }
void empathy_tp_contact_factory_set_location (EmpathyTpContactFactory *tp_factory, GHashTable *location) { EmpathyTpContactFactoryPriv *priv = GET_PRIV (tp_factory); g_return_if_fail (EMPATHY_IS_TP_CONTACT_FACTORY (tp_factory)); DEBUG ("Setting location"); tp_cli_connection_interface_location_call_set_location (priv->connection, -1, location, tp_contact_factory_set_location_cb, NULL, NULL, G_OBJECT (tp_factory)); }
void empathy_tp_contact_factory_set_avatar (EmpathyTpContactFactory *tp_factory, const gchar *data, gsize size, const gchar *mime_type) { EmpathyTpContactFactoryPriv *priv = GET_PRIV (tp_factory); g_return_if_fail (EMPATHY_IS_TP_CONTACT_FACTORY (tp_factory)); if (data && size > 0 && size < G_MAXUINT) { GArray avatar; avatar.data = (gchar *) data; avatar.len = size; DEBUG ("Setting avatar on connection %s", tp_proxy_get_object_path (TP_PROXY (priv->connection))); tp_cli_connection_interface_avatars_call_set_avatar (priv->connection, -1, &avatar, mime_type, tp_contact_factory_set_avatar_cb, NULL, NULL, G_OBJECT (tp_factory)); } else { DEBUG ("Clearing avatar on connection %s", tp_proxy_get_object_path (TP_PROXY (priv->connection))); tp_cli_connection_interface_avatars_call_clear_avatar (priv->connection, -1, tp_contact_factory_clear_avatar_cb, NULL, NULL, G_OBJECT (tp_factory)); } }
void empathy_tp_contact_factory_set_alias (EmpathyTpContactFactory *tp_factory, EmpathyContact *contact, const gchar *alias) { EmpathyTpContactFactoryPriv *priv = GET_PRIV (tp_factory); GHashTable *new_alias; guint handle; g_return_if_fail (EMPATHY_IS_TP_CONTACT_FACTORY (tp_factory)); g_return_if_fail (EMPATHY_IS_CONTACT (contact)); handle = empathy_contact_get_handle (contact); DEBUG ("Setting alias for contact %s (%d) to %s", empathy_contact_get_id (contact), handle, alias); new_alias = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free); g_hash_table_insert (new_alias, GUINT_TO_POINTER (handle), g_strdup (alias)); tp_cli_connection_interface_aliasing_call_set_aliases (priv->connection, -1, new_alias, tp_contact_factory_set_aliases_cb, NULL, NULL, G_OBJECT (tp_factory)); g_hash_table_destroy (new_alias); }