2 次代碼提交 b6a3fe1d88 ... b49a7b490f

作者 SHA1 備註 提交日期
  Alyssa Rosenzweig b49a7b490f Switch to set 5 年之前
  Alyssa Rosenzweig 68529f151b Fix regression loading user room list in XMPP 5 年之前
共有 1 個文件被更改,包括 11 次插入4 次删除
  1. 11 4
      core.c

+ 11 - 4
core.c

@@ -63,7 +63,7 @@ GHashTable *id_to_chat;
 /* Account ID to PurpleAccount */
 GHashTable *id_to_account;
 
-/* Blist Chat ID -> bool isJoined*/
+/* Blist Chat ID set */
 GHashTable *id_to_joined;
 
 /* All known buddies/other users are maintained in a hash table from network
@@ -348,12 +348,11 @@ sapphire_process_message(Connection *conn, JsonObject *data)
 			return;
 		}
 
-		gboolean is_joined = (uintptr_t) g_hash_table_lookup(id_to_joined, id);
 		gboolean is_subscribed = g_hash_table_contains(conn->subscribed_ids, id);
 
-		if (!is_joined) {
+		if (g_hash_table_contains(id_to_joined, id)) {
 			purple_roomlist_room_join(chat->roomlist, chat->room);
-			g_hash_table_insert(id_to_joined, g_strdup(id), (void *) TRUE);
+			g_hash_table_add(id_to_joined, g_strdup(id));
 		} else if (!is_subscribed) {
 			/* If we already joined but not in this connection, just send back details */
 
@@ -1250,6 +1249,14 @@ sapphire_joined_chat(PurpleConversation *conv, gpointer null)
 	}
 
 	g_hash_table_insert(blist_id_to_conversation, id, conv);
+
+	/* It's joined! */
+
+	if (!g_hash_table_contains(id_to_joined, id)) {
+		g_hash_table_add(id_to_joined, g_strdup(id));
+		g_hash_table_insert(id_to_chat, g_strdup(id), schat);
+	}
+
 }
 
 /* Certain prpls, particularly those for third-party protocols, should be