diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-11-03 21:08:01 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-11-08 20:33:27 +0800 |
commit | b018a119c5a7f43eb5a407ed34d90681673c3f78 (patch) | |
tree | ff51dbd3c284609914a82080297edcacf869c189 /libempathy | |
parent | 63ec3726a865e5ae6b5ed5cdbcee290a3415f707 (diff) | |
download | gsoc2013-empathy-b018a119c5a7f43eb5a407ed34d90681673c3f78.tar gsoc2013-empathy-b018a119c5a7f43eb5a407ed34d90681673c3f78.tar.gz gsoc2013-empathy-b018a119c5a7f43eb5a407ed34d90681673c3f78.tar.bz2 gsoc2013-empathy-b018a119c5a7f43eb5a407ed34d90681673c3f78.tar.lz gsoc2013-empathy-b018a119c5a7f43eb5a407ed34d90681673c3f78.tar.xz gsoc2013-empathy-b018a119c5a7f43eb5a407ed34d90681673c3f78.tar.zst gsoc2013-empathy-b018a119c5a7f43eb5a407ed34d90681673c3f78.zip |
add empathy_contact_add_to_contact_list()
https://bugzilla.gnome.org/show_bug.cgi?id=663327
Diffstat (limited to 'libempathy')
-rw-r--r-- | libempathy/empathy-contact.c | 38 | ||||
-rw-r--r-- | libempathy/empathy-contact.h | 3 |
2 files changed, 41 insertions, 0 deletions
diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c index 935afb556..cf46069b7 100644 --- a/libempathy/empathy-contact.c +++ b/libempathy/empathy-contact.c @@ -2071,3 +2071,41 @@ while_finish: return best_contact; } + +#define declare_contact_cb(name) \ +static void \ +contact_##name##_cb (GObject *source, \ + GAsyncResult *result, \ + gpointer user_data) \ +{ \ + TpContact *contact = (TpContact *) source; \ + GError *error = NULL; \ + \ + if (!tp_contact_##name##_finish (contact, result, &error)) \ + { \ + DEBUG ("Failed to ##name## on %s\n", \ + tp_contact_get_identifier (contact)); \ + g_error_free (error); \ + } \ +} + +declare_contact_cb(request_subscription) +declare_contact_cb(authorize_publication) +declare_contact_cb(unblock) + +void +empathy_contact_add_to_contact_list (EmpathyContact *self, + const gchar *message) +{ + EmpathyContactPriv *priv = GET_PRIV (self); + + g_return_if_fail (priv->tp_contact != NULL); + + tp_contact_request_subscription_async (priv->tp_contact, message, + contact_request_subscription_cb, NULL); + + tp_contact_authorize_publication_async (priv->tp_contact, + contact_authorize_publication_cb, NULL); + + tp_contact_unblock_async (priv->tp_contact, contact_unblock_cb, NULL); +} diff --git a/libempathy/empathy-contact.h b/libempathy/empathy-contact.h index cb8f5a660..f15c8ad5d 100644 --- a/libempathy/empathy-contact.h +++ b/libempathy/empathy-contact.h @@ -138,6 +138,9 @@ EmpathyContact * empathy_contact_dup_best_for_action ( FolksIndividual *individual, EmpathyActionType action_type); +void empathy_contact_add_to_contact_list (EmpathyContact *self, + const gchar *message); + G_END_DECLS #endif /* __EMPATHY_CONTACT_H__ */ |