pidgin/pidgin

68d77b0e8ea6
Parents a91d4fc763f4
Children 1f1a3fbb2759
Fix purple_conversation_manager_find_chat_by_id.

purple_conversation_manager_find_chat_by_id was calling
purple_conversation_manager_find_internal with a name of NULL. However,
purple_conversation_manager_find_internal was always requring the conversation
name to matched what was passed in.
Therefore purple_conversation_manager_find_chat_by_id never actually worked.

Testing Done:
Connected an IRC account and successfully sent a message.

Reviewed at https://reviews.imfreedom.org/r/1495/
--- a/libpurple/purpleconversationmanager.c Tue Jun 07 00:43:47 2022 -0500
+++ b/libpurple/purpleconversationmanager.c Thu Jun 09 03:01:29 2022 -0500
@@ -86,19 +86,29 @@
GHashTableIter iter;
gpointer key;
+ g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
+
g_hash_table_iter_init(&iter, manager->conversations);
while(g_hash_table_iter_next(&iter, &key, NULL)) {
PurpleConversation *conversation = PURPLE_CONVERSATION(key);
- if(purple_strequal(purple_conversation_get_name(conversation), name)) {
- if(purple_conversation_get_account(conversation) == account) {
- if(func != NULL && !func(conversation, userdata)) {
- continue;
- }
+ if(name != NULL) {
+ const gchar *conv_name = purple_conversation_get_name(conversation);
- return conversation;
+ if(!purple_strequal(conv_name, name)) {
+ continue;
}
}
+
+ if(purple_conversation_get_account(conversation) != account) {
+ continue;
+ }
+
+ if(func != NULL && !func(conversation, userdata)) {
+ continue;
+ }
+
+ return conversation;
}
return NULL;