changeset 8995:9caf796e74aa

[gaim-migrate @ 9770] "Luke, if you get a chance, could you commit this? It should improve the HTML escaping situation between Gaim and other AIM and ICQ clients. I haven't actually applied it locally or tested it, but it looks ok to me. I would do it myself, but there are other changes in my oscar.c that aren't ready to commit, and I want to go to sleep so I can wake up tomorrow... I'll probably be out of town climbing until Sunday night... "--Mark Doliner "Below is an email I nearly sent you, before deciding to test & document the failure cases I knew of. http://www.nosnilmot.com/gaim/oscar-html.txt shows how current CVS behaves sending the string "<foo>" between GaimICQ/GaimAIM/ICQLite/WinAIM in various combinations After that testing I couldn't help trying to fix it :) The attached patch, from my testing, resolves all those marked with "XX" so that what is received matches what the user sent. The code might not be the most efficient and may contain redundant bits but I've had enough of this for now, 2 Windows crashes which caused VMWare to be weird and half break my keyboard and require restarting X. The patch might want a bit more testing, especially with iChat (I'm unable to test with that). Maybe committing it to CVS might get it some more testing though ;-)" --Stu Tomlinson committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Fri, 21 May 2004 11:55:08 +0000
parents c5825a04fb97
children 702ef9105fa4
files src/protocols/oscar/oscar.c
diffstat 1 files changed, 28 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/oscar/oscar.c	Fri May 21 04:06:15 2004 +0000
+++ b/src/protocols/oscar/oscar.c	Fri May 21 11:55:08 2004 +0000
@@ -3087,11 +3087,16 @@
 	}
 
 	/*
-	 * If the message is being sent to an ICQ user then strip any HTML,
-	 * because HTML should not be sent over ICQ as a means to format a message.
+	 * If the message is being received by an ICQ user then escape any HTML,
+	 * because HTML should is not sent over ICQ as a means to format a message.
+	 * so any HTML we receive is intended to be displayed
+	 *
+	 * Note: There *may* be some clients which send messages as HTML formatted -
+	 *       they need to be special-cased somehow.
 	 */
-	if (isdigit(gaim_account_get_username(account)[0])) {
-		gchar *tmp2 = gaim_markup_strip_html(tmp);
+	if (isdigit(gaim_account_get_username(account)[0]) && isdigit(userinfo->sn[0])) {
+		/* being recevied by ICQ from ICQ - escape HTML so it is displayed as sent */
+		gchar *tmp2 = gaim_escape_html(tmp);
 		g_free(tmp);
 		tmp = tmp2;
 	}
@@ -5152,12 +5157,25 @@
 		 * If we're IMing an ICQ user then send newlines as CR/LF and
 		 * strip all HTML
 		 */
-		if (isdigit(name[0])) {
-			tmpmsg2 = gaim_markup_strip_html(message);
-			tmpmsg = gaim_str_add_cr(tmpmsg2);
-			g_free(tmpmsg2);
-		} else
-			tmpmsg = gaim_strdup_withhtml(message);
+		if (isdigit(name[0]) ) {
+			/* being sent to an ICQ user */
+			if (!isdigit(gaim_account_get_username(gc->account)[0])) {
+				/* from an AIM user - ICQ receiving from AIM *expects the messsage to be HTML formatted* */
+				tmpmsg = gaim_str_add_cr(message);
+			} else {
+				/* from an ICQ user - do nothing */
+				tmpmsg = g_strdup(message);
+			}
+		} else {
+			/* being sent to an AIM user */
+			if (isdigit(gaim_account_get_username(gc->account)[0])) {
+				/* from an ICQ user */
+				tmpmsg2 = gaim_strdup_withhtml(message);
+				tmpmsg = gaim_escape_html(tmpmsg2);
+				g_free(tmpmsg2);
+			} else
+				tmpmsg = gaim_strdup_withhtml(message);
+		}
 		len = strlen(tmpmsg);
 
 		args.flags |= oscar_encoding_check(tmpmsg);