aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-05-18 23:16:32 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-06-07 19:00:14 +0800
commitcd6ab6adeb836cbda38abc502c39d14aedfef7f1 (patch)
tree818b1bd647893cb795a718b15c98068384cce2a3 /libempathy
parent52bb570645883d3920f4950aa1dca8f6d88b4b32 (diff)
downloadgsoc2013-empathy-cd6ab6adeb836cbda38abc502c39d14aedfef7f1.tar
gsoc2013-empathy-cd6ab6adeb836cbda38abc502c39d14aedfef7f1.tar.gz
gsoc2013-empathy-cd6ab6adeb836cbda38abc502c39d14aedfef7f1.tar.bz2
gsoc2013-empathy-cd6ab6adeb836cbda38abc502c39d14aedfef7f1.tar.lz
gsoc2013-empathy-cd6ab6adeb836cbda38abc502c39d14aedfef7f1.tar.xz
gsoc2013-empathy-cd6ab6adeb836cbda38abc502c39d14aedfef7f1.tar.zst
gsoc2013-empathy-cd6ab6adeb836cbda38abc502c39d14aedfef7f1.zip
add empathy_tp_chat_join() and empathy_tp_chat_is_invited()
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-tp-chat.c49
-rw-r--r--libempathy/empathy-tp-chat.h3
2 files changed, 52 insertions, 0 deletions
diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c
index daf24a36a..858cfae27 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 fd9724037..e5abe936f 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