changeset 22435:5c72a6c071db

Escape conversation title for use in infopane so that ampersands don't generate invalid markup
author Stu Tomlinson <stu@nosnilmot.com>
date Sun, 09 Mar 2008 16:43:33 +0000
parents 48d09d62912e
children df336908dd15
files ChangeLog pidgin/gtkconv.c
diffstat 2 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Mar 09 13:53:47 2008 +0000
+++ b/ChangeLog	Sun Mar 09 16:43:33 2008 +0000
@@ -21,6 +21,8 @@
 	* Remove a workaround for older versions gstreamer that was causing
 	  crashes on some non-Linux systems such as HPUX
 	* Fix some cases of the conversation input entry area being 1 pixel high
+	* Fix for displaying channel & buddy names in conversation window when
+	  they have '&' in them
 
 	Finch:
 	* Fix compiling with Glib older than 2.6
--- a/pidgin/gtkconv.c	Sun Mar 09 13:53:47 2008 +0000
+++ b/pidgin/gtkconv.c	Sun Mar 09 16:43:33 2008 +0000
@@ -6494,14 +6494,16 @@
 			}
 		} else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) {
 			const char *topic = gtkconv->u.chat->topic_text ? gtk_entry_get_text(GTK_ENTRY(gtkconv->u.chat->topic_text)) : NULL;
-			char *esc = NULL;
+			char *esc = NULL, *tmp;
 #if GTK_CHECK_VERSION(2,6,0)
 			esc = topic ? g_markup_escape_text(topic, -1) : NULL;
 #else
 			/* GTK < 2.6 doesn't have auto ellipsization, so we do a crude
 			 * trucation to prevent forcing the window to be as wide as the topic */
 			int len = 0;
-			char *c, *tmp = g_strdup(topic);
+			char *c;
+
+			tmp = g_strdup(topic);
 			c = tmp;
 			while(*c && len < 72) {
 				c = g_utf8_next_char(c);
@@ -6516,11 +6518,12 @@
 			esc = tmp ? g_markup_escape_text(tmp, -1) : NULL;
 			g_free(tmp);
 #endif
+			tmp = g_markup_escape_text(purple_conversation_get_title(conv), -1);
 			markup = g_strdup_printf("%s%s<span color='%s' size='smaller'>%s</span>",
-						purple_conversation_get_title(conv),
-						esc  && *esc ? "\n" : "",
+						tmp, esc  && *esc ? "\n" : "",
 						pidgin_get_dim_grey_string(gtkconv->infopane),
 						esc ? esc : "");
+			g_free(tmp);
 			g_free(esc);
 		}
 		gtk_list_store_set(gtkconv->infopane_model, &(gtkconv->infopane_iter),