diff src/protocols/yahoo/util.c @ 8375:1556970088d4

[gaim-migrate @ 9102] quoth marv: " I like "What You Get Is What You Get" better. This fixes a problem where yahoo was sending < and > to the core when it wasn't html, and so gtkimhtml wasn't displaying part of the message. It's fixed by making the prpl escape it first. While I was add it, it made it display "Buzz!!" when someone buzzes you, instead of it saying that they said <ding>. Note that the official client uses red letters, all caps, and 3 !'s, and makes the window shake, so what we do is pretty mild. I also fixed a compile warning." committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Mon, 01 Mar 2004 05:13:45 +0000
parents ee32e030c9be
children 7e9fdaab7163
line wrap: on
line diff
--- a/src/protocols/yahoo/util.c	Mon Mar 01 02:51:13 2004 +0000
+++ b/src/protocols/yahoo/util.c	Mon Mar 01 05:13:45 2004 +0000
@@ -170,6 +170,19 @@
 	/* remove these once we have proper support for <FADE> and <ALT> */
 	g_hash_table_insert(ht, "</fade>", "");
 	g_hash_table_insert(ht, "</alt>", "");
+
+	/* these are the normal html yahoo sends (besides <font>).
+	 * anything else will get turned into &lt;tag&gt;, so if I forgot
+	 * about something, please add it. Why Yahoo! has to send unescaped
+	 * <'s and >'s that aren't supposed to be html is beyond me.
+	 */
+	g_hash_table_insert(ht, "<b>", "<b>");
+	g_hash_table_insert(ht, "<i>", "<i>");
+	g_hash_table_insert(ht, "<u>", "<u>");
+
+	g_hash_table_insert(ht, "</b>", "</b>");
+	g_hash_table_insert(ht, "</i>", "</i>");
+	g_hash_table_insert(ht, "</u>", "</u>");
 }
 
 void yahoo_dest_colorht()
@@ -259,7 +272,7 @@
 			while (j++ < xs) {
 				if (x[j] != '>')
 					if (j == xs) {
-						g_string_append_c(s, '<');
+						g_string_append(s, "&lt;");
 						nomoreendtags = 1;
 					}
 					else
@@ -282,7 +295,7 @@
 					} else if (!strncmp(tmp->str, "<font ", 6)) {
 						_font_tags_fix_size(tmp, s);
 					} else {
-						g_string_append_c(s, '<');
+						g_string_append(s, "&lt;");
 						g_string_free(tmp, TRUE);
 						break;
 					}
@@ -297,7 +310,12 @@
 
 
 		} else {
-			g_string_append_c(s, x[i]);
+			if (x[i] == '<')
+				g_string_append(s, "&lt;");
+			else if (x[i] == '>')
+				g_string_append(s, "&gt;");
+			else
+				g_string_append_c(s, x[i]);
 		}
 	}