]> git.0d.be Git - empathy.git/blobdiff - libempathy/empathy-tp-roomlist.c
Add empathy_tp_chat_get_connection() to direct access the channel's connection.
[empathy.git] / libempathy / empathy-tp-roomlist.c
index b54aec82408cb81051f7c69a94c1ff01a6d2b550..fc2526fd0d6a422875517df13859423b8573aa2f 100644 (file)
@@ -91,7 +91,12 @@ tp_roomlist_inspect_handles_cb (TpConnection *connection,
 {
        GSList *chatrooms = user_data;
 
-       while (*names) {
+       if (error != NULL) {
+               DEBUG ("Error: %s", error->message);
+               return;
+       }
+
+       while (*names != NULL) {
                EmpathyChatroom *chatroom = chatrooms->data;
 
                empathy_chatroom_set_room (chatroom, *names);
@@ -117,6 +122,10 @@ tp_roomlist_got_rooms_cb (TpChannel       *channel,
        for (i = 0; i < rooms->len; i++) {
                const GValue *room_name_value;
                const GValue *handle_name_value;
+               const GValue *room_members_value;
+               const GValue *room_subject_value;
+               const GValue *room_invite_value;
+               const GValue *room_password_value;
                GValueArray  *room_struct;
                guint         handle;
                const gchar  *channel_type;
@@ -129,6 +138,10 @@ tp_roomlist_got_rooms_cb (TpChannel       *channel,
                info = g_value_get_boxed (g_value_array_get_nth (room_struct, 2));
                room_name_value = g_hash_table_lookup (info, "name");
                handle_name_value = g_hash_table_lookup (info, "handle-name");
+               room_subject_value = g_hash_table_lookup (info, "subject");
+               room_members_value = g_hash_table_lookup (info, "members");
+               room_invite_value = g_hash_table_lookup (info, "invite-only");
+               room_password_value = g_hash_table_lookup (info, "password");
 
                if (tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_TEXT)) {
                        continue;
@@ -141,6 +154,26 @@ tp_roomlist_got_rooms_cb (TpChannel       *channel,
                                                   g_value_get_string (room_name_value));
                }
 
+               if (room_members_value != NULL) {
+                       empathy_chatroom_set_members_count (chatroom,
+                                                  g_value_get_uint (room_members_value));
+               }
+
+               if (room_subject_value != NULL) {
+                       empathy_chatroom_set_subject (chatroom,
+                                                  g_value_get_string (room_subject_value));
+               }
+
+               if (room_invite_value != NULL) {
+                       empathy_chatroom_set_invite_only (chatroom,
+                                                  g_value_get_boolean (room_invite_value));
+               }
+
+               if (room_password_value != NULL) {
+                       empathy_chatroom_set_need_password (chatroom,
+                                                  g_value_get_boolean (room_password_value));
+               }
+
                if (handle_name_value != NULL) {
                        empathy_chatroom_set_room (chatroom,
                                                   g_value_get_string (handle_name_value));
@@ -169,9 +202,8 @@ tp_roomlist_got_rooms_cb (TpChannel       *channel,
                                                       chatrooms,
                                                       tp_roomlist_chatrooms_free,
                                                       list);
+               g_array_free (handles, TRUE);
        }
-
-       g_array_free (handles, TRUE);
 }
 
 static void
@@ -275,7 +307,7 @@ tp_roomlist_constructed (GObject *list)
        EmpathyTpRoomlistPriv *priv = GET_PRIV (list);
        MissionControl        *mc;
 
-       mc = empathy_mission_control_new ();
+       mc = empathy_mission_control_dup_singleton ();
        priv->account = mission_control_get_account_for_tpconnection (mc,
                                                                      priv->connection,
                                                                      NULL);
@@ -397,7 +429,7 @@ empathy_tp_roomlist_new (McAccount *account)
 
        g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL);
 
-       mc = empathy_mission_control_new ();
+       mc = empathy_mission_control_dup_singleton ();
        connection = mission_control_get_tpconnection (mc, account, NULL);
 
        list = g_object_new (EMPATHY_TYPE_TP_ROOMLIST,