Added transient-buddy back for showing the buddy menu when release-2.x.y

Fri, 15 Apr 2022 11:15:37 -0500

author
Belgin Știrbu <belginstirbu@hotmail.com>
date
Fri, 15 Apr 2022 11:15:37 -0500
branch
release-2.x.y
changeset 41325
c5c98b27f755
parent 41324
f20e9970a54f
child 41326
0079467afee4

Added transient-buddy back for showing the buddy menu when
right-clicking the topic bar.

Testing Done:
Tested on Debian and Windows. Right-clicking showed the correct context menu.

Bugs closed: PIDGIN-17523

Reviewed at https://reviews.imfreedom.org/r/1381/

pidgin/gtkconv.c file | annotate | diff | comparison | revisions
--- a/pidgin/gtkconv.c	Fri Apr 15 11:13:22 2022 -0500
+++ b/pidgin/gtkconv.c	Fri Apr 15 11:15:37 2022 -0500
@@ -2333,6 +2333,7 @@
 
 	gray_stuff_out(gtkconv);
 	update_typing_icon(gtkconv);
+	g_object_set_data(G_OBJECT(entry), "transient_buddy", NULL);
 	regenerate_options_items(gtkconv->win);
 
 	gtk_window_set_title(GTK_WINDOW(gtkconv->win->window),
@@ -3223,6 +3224,22 @@
 			return FALSE;
 
 		buddy = purple_find_buddy(conv->account, conv->name);
+
+		/* gotta remain bug-compatible :( libpurple < 2.0.2 didn't handle
+                 * removing "isolated" buddy nodes well */
+                if (purple_version_check(2, 0, 2) == NULL) {
+                        if ((buddy == NULL) && (gtkconv->imhtml != NULL)) {
+                                buddy = g_object_get_data(G_OBJECT(gtkconv->imhtml), "transient_buddy");
+                        }
+
+                        if ((buddy == NULL) && (gtkconv->imhtml != NULL)) {
+                                buddy = purple_buddy_new(conv->account, conv->name, NULL);
+                                purple_blist_node_set_flags((PurpleBlistNode *)buddy,
+                                                PURPLE_BLIST_NODE_FLAG_NO_SAVE);
+                                g_object_set_data_full(G_OBJECT(gtkconv->imhtml), "transient_buddy",
+                                                buddy, (GDestroyNotify)purple_buddy_destroy);
+                        }
+                }
 	}
 
 	if (chat)

mercurial