changeset 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 e7463be62fb1
children 7e9fdaab7163
files plugins/ssl/ssl-gnutls.c src/protocols/yahoo/util.c src/protocols/yahoo/yahoo.c
diffstat 3 files changed, 35 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/ssl/ssl-gnutls.c	Mon Mar 01 02:51:13 2004 +0000
+++ b/plugins/ssl/ssl-gnutls.c	Mon Mar 01 05:13:45 2004 +0000
@@ -96,10 +96,10 @@
 
 	gnutls_transport_set_ptr(gnutls_data->session, GINT_TO_POINTER(source));
 
-	gaim_debug_info("gnutls", "Handshaking\n");
 
 	do
 	{
+		gaim_debug_info("gnutls", "Handshaking\n");
 		ret = gnutls_handshake(gnutls_data->session);
 	}
 	while ((ret == GNUTLS_E_AGAIN) || (ret == GNUTLS_E_INTERRUPTED));
--- 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]);
 		}
 	}
 
--- a/src/protocols/yahoo/yahoo.c	Mon Mar 01 02:51:13 2004 +0000
+++ b/src/protocols/yahoo/yahoo.c	Mon Mar 01 05:13:45 2004 +0000
@@ -751,6 +751,17 @@
 
 		m = yahoo_string_decode(gc, im->msg, im->utf8);
 		gaim_str_strip_cr(m);
+
+		if (!strcmp(m, "<ding>")) {
+			GaimConversation *c = gaim_conversation_new(GAIM_CONV_IM,
+			                                            gaim_connection_get_account(gc), im->from);
+			gaim_conv_im_write(GAIM_CONV_IM(c), "", _("Buzz!!"), GAIM_MESSAGE_NICK|GAIM_MESSAGE_RECV,
+			                   im->time);
+			g_free(m);
+			g_free(im);
+			continue;
+		}
+
 		m2 = yahoo_codes_to_html(m);
 		g_free(m);
 		serv_got_im(gc, im->from, m2, 0, im->time);
@@ -1136,7 +1147,7 @@
 	unsigned char		digest2[20];
 	unsigned char		comparison_src[20]; 
 	unsigned char		magic_key_char[4];
-	unsigned char		*magic_ptr;
+	const unsigned char		*magic_ptr;
 
 	unsigned int		magic[64];
 	unsigned int		magic_work = 0;
@@ -1168,7 +1179,7 @@
 	 */
 	
 	magic_ptr = seed;
-	
+
 	while (*magic_ptr != (int)NULL) {
 		char   *loc;