besser82 / rpms / pidgin

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