[empathy] add empathy_tp_chat_join() and empathy_tp_chat_is_invited()
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] add empathy_tp_chat_join() and empathy_tp_chat_is_invited()
- Date: Mon, 7 Jun 2010 11:03:17 +0000 (UTC)
commit cd6ab6adeb836cbda38abc502c39d14aedfef7f1
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Tue May 18 17:16:32 2010 +0200
add empathy_tp_chat_join() and empathy_tp_chat_is_invited()
libempathy/empathy-tp-chat.c | 49 ++++++++++++++++++++++++++++++++++++++++++
libempathy/empathy-tp-chat.h | 3 ++
2 files changed, 52 insertions(+), 0 deletions(-)
---
diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c
index daf24a3..858cfae 100644
--- a/libempathy/empathy-tp-chat.c
+++ b/libempathy/empathy-tp-chat.c
@@ -1834,3 +1834,52 @@ empathy_tp_chat_leave (EmpathyTpChat *self)
g_array_free (array, TRUE);
}
+
+static void
+add_members_cb (TpChannel *proxy,
+ const GError *error,
+ gpointer user_data,
+ GObject *weak_object)
+{
+ EmpathyTpChatPriv *priv = GET_PRIV (weak_object);
+
+ if (error != NULL) {
+ DEBUG ("Failed to join chat (%s): %s",
+ tp_channel_get_identifier (priv->channel), error->message);
+ }
+}
+
+void
+empathy_tp_chat_join (EmpathyTpChat *self)
+{
+ EmpathyTpChatPriv *priv = GET_PRIV (self);
+ TpHandle self_handle;
+ GArray *members;
+
+ self_handle = tp_channel_group_get_self_handle (priv->channel);
+
+ members = g_array_sized_new (FALSE, FALSE, sizeof (TpHandle), 1);
+ g_array_append_val (members, self_handle);
+
+ tp_cli_channel_interface_group_call_add_members (priv->channel, -1, members,
+ "", add_members_cb, NULL, NULL, G_OBJECT (self));
+
+ g_array_free (members, TRUE);
+}
+
+gboolean
+empathy_tp_chat_is_invited (EmpathyTpChat *self)
+{
+ EmpathyTpChatPriv *priv = GET_PRIV (self);
+ TpHandle self_handle;
+
+ if (!tp_proxy_has_interface (priv->channel, TP_IFACE_CHANNEL_INTERFACE_GROUP))
+ return FALSE;
+
+ self_handle = tp_channel_group_get_self_handle (priv->channel);
+ if (self_handle == 0)
+ return FALSE;
+
+ return tp_channel_group_get_local_pending_info (priv->channel, self_handle,
+ NULL, NULL, NULL);
+}
diff --git a/libempathy/empathy-tp-chat.h b/libempathy/empathy-tp-chat.h
index fd97240..e5abe93 100644
--- a/libempathy/empathy-tp-chat.h
+++ b/libempathy/empathy-tp-chat.h
@@ -99,6 +99,9 @@ gboolean empathy_tp_chat_provide_password_finish (EmpathyTpChat *chat,
gboolean empathy_tp_chat_can_add_contact (EmpathyTpChat *self);
void empathy_tp_chat_leave (EmpathyTpChat *chat);
+void empathy_tp_chat_join (EmpathyTpChat *chat);
+
+gboolean empathy_tp_chat_is_invited (EmpathyTpChat *chat);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]