]> git.0d.be Git - empathy.git/commitdiff
tp_chat_check_if_ready: deal with password protected room
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Wed, 11 Nov 2009 12:15:51 +0000 (12:15 +0000)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 13 Nov 2009 15:59:22 +0000 (15:59 +0000)
The TpChat is not ready if we are fetching the password flags.
But once it's fetched, the chat is ready if it's protected as we won't
be able to get the members of the room.

libempathy/empathy-tp-chat.c

index 73c446a7dc91ad92e8d920fa2fd833b596fee3f8..aea125469fe2252a1eb53420f840f9bac7b8d136 100644 (file)
@@ -787,8 +787,14 @@ tp_chat_check_if_ready (EmpathyTpChat *chat)
        if (priv->user == NULL)
                return;
 
-       /* We need either the members (room) or the remote contact (private chat) */
-       if (priv->members == NULL && priv->remote_contact == NULL)
+       if (!priv->got_password_flags)
+               return;
+
+       /* We need either the members (room) or the remote contact (private chat).
+        * If the chat is protected by a password we can't get these information so
+        * consider the chat as ready so it can be presented to the user. */
+       if (!empathy_tp_chat_password_needed (chat) && priv->members == NULL &&
+                                                     priv->remote_contact == NULL)
                return;
 
        DEBUG ("Ready!");
@@ -1051,6 +1057,8 @@ got_password_flags_cb (TpChannel *proxy,
 
        priv->got_password_flags = TRUE;
        priv->password_flags = password_flags;
+
+       tp_chat_check_if_ready (EMPATHY_TP_CHAT (self));
 }
 
 static GObject *