changeset 22448:8802eddbfedc

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.
author Stu Tomlinson <stu@nosnilmot.com>
date Sun, 09 Mar 2008 16:52:07 +0000
parents df336908dd15
children 76b501dfe231 b53bacc6eb6e
files pidgin/gtkblist.c pidgin/gtkconv.c
diffstat 2 files changed, 18 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkblist.c	Sun Mar 09 16:46:04 2008 +0000
+++ b/pidgin/gtkblist.c	Sun Mar 09 16:52:07 2008 +0000
@@ -3132,6 +3132,8 @@
 		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 @@
 			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)
--- a/pidgin/gtkconv.c	Sun Mar 09 16:46:04 2008 +0000
+++ b/pidgin/gtkconv.c	Sun Mar 09 16:52:07 2008 +0000
@@ -4577,14 +4577,12 @@
 	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