pidgin: f1716162: Fix Topic in chat node tooltips, and tur...

nosnilmot at pidgin.im nosnilmot at pidgin.im
Sun Mar 9 12:55:56 EDT 2008


-----------------------------------------------------------------
Revision: f1716162f34382d8889f8e4288a808f067b91eb1
Ancestor: 27f42a916b4ccc5fb352aa24fbdabc9e70b5523f
Author: nosnilmot at pidgin.im
Date: 2008-03-09T16:52:07
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/f1716162f34382d8889f8e4288a808f067b91eb1

Modified files:
        pidgin/gtkblist.c pidgin/gtkconv.c

ChangeLog: 

Fix Topic in chat node tooltips, and turn on using the transient chat node
for chats not on the buddy list when building tooltips. I hope this doesn't
break too much.

-------------- next part --------------
============================================================
--- pidgin/gtkblist.c	40b00b9f87f4d081cfcc0243cc8056bb0b6cc0ec
+++ pidgin/gtkblist.c	95ec8600374e086dbd2ff5eb1ca732f98af01ad2
@@ -3132,6 +3132,8 @@ static char *pidgin_get_tooltip_text(Pur
 		GList *cur;
 		struct proto_chat_entry *pce;
 		char *name, *value;
+		const char *chat_name;
+		PurpleConversation *conv;
 		PidginBlistNode *bnode = node->ui_data;
 
 		chat = (PurpleChat *)node;
@@ -3145,11 +3147,22 @@ static char *pidgin_get_tooltip_text(Pur
 			g_free(tmp);
 		}
 
-		if (bnode && bnode->conv.conv &&
-				prpl_info && (prpl_info->options & OPT_PROTO_CHAT_TOPIC) &&
-				!purple_conv_chat_has_left(PURPLE_CONV_CHAT(bnode->conv.conv))) {
-			const char *topic = purple_conv_chat_get_topic(PURPLE_CONV_CHAT(bnode->conv.conv));
+		if (bnode && bnode->conv.conv) {
+			conv = bnode->conv.conv;
+		} else {
+			if (prpl_info && prpl_info->get_chat_name)
+				chat_name = prpl_info->get_chat_name(chat->components);
+			else
+				chat_name = purple_chat_get_name(chat);
+
+			conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, chat_name,
+					chat->account);
+		}
+		if (conv && prpl_info && (prpl_info->options & OPT_PROTO_CHAT_TOPIC) &&
+				!purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) {
+			char *topic = g_markup_escape_text(purple_conv_chat_get_topic(PURPLE_CONV_CHAT(conv)), -1);
 			g_string_append_printf(str, _("\n<b>Topic:</b> %s"), topic ? topic : _("(no topic set)"));
+			g_free(topic);
 		}
 
 		if (prpl_info->chat_info != NULL)
============================================================
--- pidgin/gtkconv.c	25b28a0e5bdaac0b5fd1f644061200d1f76ed77e
+++ pidgin/gtkconv.c	7057bf38b1eb4bf08b1b783e3a81aa95fdd56a8a
@@ -4577,14 +4577,12 @@ pidgin_conv_create_tooltip(GtkWidget *ti
 	conv = gtkconv->active_conv;
 	if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) {
 		node = (PurpleBlistNode*)(purple_blist_find_chat(conv->account, conv->name));
-#if 0
-		/* Using the transient blist nodes to show the tooltip doesn't quite work yet. */
 		if (!node)
 			node = g_object_get_data(G_OBJECT(gtkconv->imhtml), "transient_chat");
-#endif
 	} else {
 		node = (PurpleBlistNode*)(purple_find_buddy(conv->account, conv->name));
 #if 0
+		/* Using the transient blist nodes to show the tooltip doesn't quite work yet. */
 		if (!node)
 			node = g_object_get_data(G_OBJECT(gtkconv->imhtml), "transient_buddy");
 #endif


More information about the Commits mailing list