diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-05-18 23:16:32 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-06-07 19:00:14 +0800 |
commit | cd6ab6adeb836cbda38abc502c39d14aedfef7f1 (patch) | |
tree | 818b1bd647893cb795a718b15c98068384cce2a3 /libempathy/empathy-tp-chat.c | |
parent | 52bb570645883d3920f4950aa1dca8f6d88b4b32 (diff) | |
download | gsoc2013-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/empathy-tp-chat.c')
-rw-r--r-- | libempathy/empathy-tp-chat.c | 49 |
1 files changed, 49 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); +} |