besser82 / rpms / pidgin

Forked from rpms/pidgin 6 years ago
Clone
280401c
Manually edited to make it compile
280401c
-----------------------------------------------------------------
280401c
Revision: 3c30f64efedafc379b6536852bbb3b6ef5f1f6c9
280401c
Ancestor: 0e263caa5d687101e436029f2f8d09053ae06e23
280401c
Author: ivan.komarov@soc.pidgin.im
280401c
Date: 05/03/2010 09:49:14 PM
280401c
Branch: im.pidgin.soc.2010.icq-tlc
280401c
280401c
Modified files:
280401c
        libpurple/protocols/oscar/oscar.c
280401c
280401c
ChangeLog: 
280401c
280401c
Two small fixes to improve sending/receiving HTML-formatted messages
280401c
over ICQ.
280401c
  * Treat all incoming messages as HTML because a) this is what the official
280401c
    client does and b) we don't have a reliable way to check if a message is
280401c
    HTML anyway.
280401c
  * Wrap outgoing HTML in proper HTML tags to make ICQ6 happy.
280401c
This was tested with ICQ 6/7, Miranda, Trillian, QIP, and iChat.
280401c
280401c
============================================================
280401c
--- libpurple/protocols/oscar/oscar.c	ec79d8d9fcba376be091b363977e8f23c748eff2
280401c
+++ libpurple/protocols/oscar/oscar.c	f60533d05cd497bf87168ca7e6f259539ce18fd8
280401c
@@ -2486,32 +2486,6 @@ static int incomingim_chan1(OscarData *o
280401c
 	tmp = g_string_free(message, FALSE);
280401c
 
280401c
 	/*
280401c
-	 * If the message is from an ICQ user and to an ICQ user then escape any HTML,
280401c
-	 * because HTML is not sent over ICQ as a means to format a message.
280401c
-	 * So any HTML we receive is intended to be displayed.  Also, \r\n must be
280401c
-	 * replaced with 
280401c
-	 *
280401c
-	 * Note: There *may* be some clients which send messages as HTML formatted -
280401c
-	 *       they need to be special-cased somehow.
280401c
-	 *
280401c
-	 * Update: Newer ICQ clients have started sending IMs as HTML.  We can
280401c
-	 * distinguish HTML IMs from non-HTML IMs by looking at the features.  If
280401c
-	 * the features are "0x 01 06" then the message is plain text.  If the
280401c
-	 * features are "0x 01" then the message is HTML.
280401c
-	 */
280401c
-	if (od->icq && oscar_util_valid_name_icq(userinfo->bn)
280401c
-			&& (args->featureslen != 1 || args->features[0] != 0x01))
280401c
-	{
280401c
-		/* being recevied by ICQ from ICQ - escape HTML so it is displayed as sent */
280401c
-		gchar *tmp2 = g_markup_escape_text(tmp, -1);
280401c
-		g_free(tmp);
280401c
-		tmp = tmp2;
280401c
-		tmp2 = purple_strreplace(tmp, "\r\n", "
");
280401c
-		g_free(tmp);
280401c
-		tmp = tmp2;
280401c
-	}
280401c
-
280401c
-	/*
280401c
 	 * Convert iChat color tags to normal font tags.
280401c
 	 */
280401c
 	if (purple_markup_find_tag("body", tmp, &start, &end, &attribs))
280401c
@@ -4787,7 +4761,8 @@ oscar_send_im(PurpleConnection *gc, cons
280401c
 			tmp2 = purple_markup_strip_html(tmp1);
280401c
 			is_html = FALSE;
280401c
 		} else {
280401c
-			tmp2 = g_strdup(tmp1);
280401c
+			/* ICQ 6 wants its HTML wrapped in these tags. Oblige it. */
280401c
+			tmp2 = g_strdup_printf("<HTML><BODY>%s</BODY></HTML>", tmp1);
280401c
 			is_html = TRUE;
280401c
 		}
280401c
 		g_free(tmp1);