changeset 31426:1203778744d0

gtkimhtml: Display "<3" instead of "&lt;3" after too many smileys in convo I encountered this in a long-lived, active MUC. Interestingly, this may have persisted even after I disabled smileys and restarted (I'm unsure whether I restarted or not). I also don't know why this works, other than it does.
author Paul Aurich <paul@darkrain42.org>
date Tue, 30 Nov 2010 06:06:14 +0000
parents 18d56b13fe8b
children 873cd5e068c4 c7f0decf419b
files ChangeLog pidgin/gtkimhtml.c
diffstat 2 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Nov 29 07:13:08 2010 +0000
+++ b/ChangeLog	Tue Nov 30 06:06:14 2010 +0000
@@ -5,6 +5,12 @@
 	* Fix the exceptions in purple-remote on Python 2.6+. (Ari Pollak)
 	  (#12151)
 
+	Pidgin:
+	* When a conversation has reached the maximum limit on the number
+	  of smileys, display the text representation of the smiley properly
+	  when it contains HTML-escapable characters (e.g. "<3" was previously
+	  displayed as "&lt;3").
+
 	libpurple:
 	* Fix multipart parsing when '=' is included in the boundary for
 	  purple_mime_document_parse. (Jakub Adam) (#11598)
--- a/pidgin/gtkimhtml.c	Mon Nov 29 07:13:08 2010 +0000
+++ b/pidgin/gtkimhtml.c	Tue Nov 30 06:06:14 2010 +0000
@@ -4905,18 +4905,20 @@
 	 * are apparently pretty inefficient.  Hopefully we can remove this
 	 * restriction when we're using a better HTML widget.
 	 */
+	unescaped = purple_unescape_html(smiley);
 	numsmileys_thismsg = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(imhtml), "gtkimhtml_numsmileys_thismsg"));
 	if (numsmileys_thismsg >= 30) {
-		gtk_text_buffer_insert(imhtml->text_buffer, iter, smiley, -1);
+		gtk_text_buffer_insert(imhtml->text_buffer, iter, unescaped, -1);
+		g_free(unescaped);
 		return;
 	}
 	numsmileys_total = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(imhtml), "gtkimhtml_numsmileys_total"));
 	if (numsmileys_total >= 300) {
-		gtk_text_buffer_insert(imhtml->text_buffer, iter, smiley, -1);
+		gtk_text_buffer_insert(imhtml->text_buffer, iter, unescaped, -1);
+		g_free(unescaped);
 		return;
 	}
 
-	unescaped = purple_unescape_html(smiley);
 	imhtml_smiley = gtk_imhtml_smiley_get(imhtml, sml, unescaped);
 
 	if (imhtml->format_functions & GTK_IMHTML_SMILEY) {
@@ -4991,7 +4993,7 @@
 		g_object_set_data(G_OBJECT(imhtml), "gtkimhtml_numsmileys_thismsg", GINT_TO_POINTER(numsmileys_thismsg + 1));
 		g_object_set_data(G_OBJECT(imhtml), "gtkimhtml_numsmileys_total", GINT_TO_POINTER(numsmileys_total + 1));
 	} else {
-		gtk_text_buffer_insert(imhtml->text_buffer, iter, smiley, -1);
+		gtk_text_buffer_insert(imhtml->text_buffer, iter, unescaped, -1);
 	}
 
 	if (ebox) {