2 Commits b6a3fe1d88 ... b49a7b490f

Author SHA1 Message Date
  Alyssa Rosenzweig b49a7b490f Switch to set 5 years ago
  Alyssa Rosenzweig 68529f151b Fix regression loading user room list in XMPP 5 years ago
1 changed files with 11 additions and 4 deletions
  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