changeset 29732:1e9f8f54dff4

Support receiving HTML-formatted messages for ICQ. I should have let a summer of code student do this, but curiosity got the best of me.
author Mark Doliner <mark@kingant.net>
date Thu, 15 Apr 2010 00:55:02 +0000
parents 2e0dffa155db
children c66e766acb06
files ChangeLog libpurple/protocols/oscar/family_icbm.c libpurple/protocols/oscar/oscar.c libpurple/protocols/oscar/oscar.h
diffstat 4 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Apr 15 00:49:01 2010 +0000
+++ b/ChangeLog	Thu Apr 15 00:55:02 2010 +0000
@@ -65,6 +65,7 @@
 	  password on reconnect when "Remember Password" is not checked and
 	  authentication fails due to an incorrect password.  (This is the same
 	  behavior as the legacy authentication method)
+	* Support receiving HTML-formatted messages for ICQ.
 
 	MSN:
 	* Support for version 9 of the MSN protocol has been removed.  This
--- a/libpurple/protocols/oscar/family_icbm.c	Thu Apr 15 00:49:01 2010 +0000
+++ b/libpurple/protocols/oscar/family_icbm.c	Thu Apr 15 00:55:02 2010 +0000
@@ -274,6 +274,7 @@
 			| AIM_IMPARAM_FLAG_MISSED_CALLS_ENABLED
 			| AIM_IMPARAM_FLAG_EVENTS_ALLOWED
 			| AIM_IMPARAM_FLAG_SMS_SUPPORTED
+			| AIM_IMPARAM_FLAG_SEND_ME_HTML_FOR_ICQ
 			| AIM_IMPARAM_FLAG_OFFLINE_MSGS_ALLOWED;
 	params.maxmsglen = 8000;
 	params.minmsginterval = 0;
--- a/libpurple/protocols/oscar/oscar.c	Thu Apr 15 00:49:01 2010 +0000
+++ b/libpurple/protocols/oscar/oscar.c	Thu Apr 15 00:55:02 2010 +0000
@@ -2494,8 +2494,15 @@
 	 *
 	 * Note: There *may* be some clients which send messages as HTML formatted -
 	 *       they need to be special-cased somehow.
+	 *
+	 * Update: Newer ICQ clients have started sending IMs as HTML.  We can
+	 * distinguish HTML IMs from non-HTML IMs by looking at the features.  If
+	 * the features are "0x 01 06" then the message is plain text.  If the
+	 * features are "0x 01" then the message is HTML.
 	 */
-	if (od->icq && oscar_util_valid_name_icq(userinfo->bn)) {
+	if (od->icq && oscar_util_valid_name_icq(userinfo->bn)
+			&& (args->featureslen != 1 || args->features[0] != 0x01))
+	{
 		/* being recevied by ICQ from ICQ - escape HTML so it is displayed as sent */
 		gchar *tmp2 = g_markup_escape_text(tmp, -1);
 		g_free(tmp);
@@ -4731,6 +4738,10 @@
 			   encoded" (and instead, assumes them to be UTF-8).
 			   For more details, see SF issue 1179452.
 			*/
+			/*
+			 * WTF?  Why would we want to send messages as "ANSI" when we
+			 * could use UTF-8?
+			 */
 			if (buddy && PURPLE_BUDDY_IS_ONLINE(buddy)) {
 				args.features = features_icq;
 				args.featureslen = sizeof(features_icq);
--- a/libpurple/protocols/oscar/oscar.h	Thu Apr 15 00:49:01 2010 +0000
+++ b/libpurple/protocols/oscar/oscar.h	Thu Apr 15 00:55:02 2010 +0000
@@ -746,6 +746,7 @@
 #define AIM_IMPARAM_FLAG_EVENTS_ALLOWED         0x00000008
 #define AIM_IMPARAM_FLAG_SMS_SUPPORTED          0x00000010
 #define AIM_IMPARAM_FLAG_OFFLINE_MSGS_ALLOWED   0x00000100
+#define AIM_IMPARAM_FLAG_SEND_ME_HTML_FOR_ICQ   0x00000400
 
 /* This is what the server will give you if you don't set them yourself. */
 /* This is probably out of date. */