From 279e787b1634fdd3269cb28f0562b9bcca79e496 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Wed, 11 Nov 2009 15:15:39 +0000 Subject: tp-chat: update the 'password-needed' property when password flags changes --- libempathy/empathy-tp-chat.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c index c0c6eb66e..9a235b70e 100644 --- a/libempathy/empathy-tp-chat.c +++ b/libempathy/empathy-tp-chat.c @@ -1046,6 +1046,28 @@ tp_chat_got_self_contact_cb (EmpathyTpContactFactory *factory, tp_chat_check_if_ready (EMPATHY_TP_CHAT (chat)); } +static void +password_flags_changed_cb (TpChannel *channel, + guint added, + guint removed, + gpointer user_data, + GObject *weak_object) +{ + EmpathyTpChat *self = EMPATHY_TP_CHAT (weak_object); + EmpathyTpChatPriv *priv = GET_PRIV (self); + gboolean was_needed, needed; + + was_needed = empathy_tp_chat_password_needed (self); + + priv->password_flags |= added; + priv->password_flags ^= removed; + + needed = empathy_tp_chat_password_needed (self); + + if (was_needed != needed) + g_object_notify (G_OBJECT (self), "password-needed"); +} + static void got_password_flags_cb (TpChannel *proxy, guint password_flags, @@ -1136,6 +1158,11 @@ tp_chat_constructor (GType type, if (tp_proxy_has_interface_by_id (priv->channel, TP_IFACE_QUARK_CHANNEL_INTERFACE_PASSWORD)) { priv->got_password_flags = FALSE; + + tp_cli_channel_interface_password_connect_to_password_flags_changed ( + priv->channel, password_flags_changed_cb, chat, NULL, + G_OBJECT (chat), NULL); + tp_cli_channel_interface_password_call_get_password_flags (priv->channel, -1, got_password_flags_cb, chat, NULL, chat); } else { -- cgit v1.2.3