pidgin: ce1e2f95: Support receiving HTML-formatted message...

markdoliner at pidgin.im markdoliner at pidgin.im
Wed Apr 14 21:00:33 EDT 2010


-----------------------------------------------------------------
Revision: ce1e2f95d94016f0d80e1803674712b9559b70d5
Ancestor: 3999d4e3f56273a63d5a9362914694c792cecc61
Author: markdoliner at pidgin.im
Date: 2010-04-15T00:55:02
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/ce1e2f95d94016f0d80e1803674712b9559b70d5

Modified files:
        ChangeLog libpurple/protocols/oscar/family_icbm.c
        libpurple/protocols/oscar/oscar.c
        libpurple/protocols/oscar/oscar.h

ChangeLog: 

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.

-------------- next part --------------
============================================================
--- ChangeLog	eb4018f97066a68b42048119114be523fc0c772d
+++ ChangeLog	57d012f97ff2a914382cf3c742a88143f97d5f6d
@@ -65,6 +65,7 @@ version 2.7.0 (??/??/????):
 	  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
============================================================
--- libpurple/protocols/oscar/family_icbm.c	63cf3ce56103c92c60734f538fcc8fd768ec13c1
+++ libpurple/protocols/oscar/family_icbm.c	fe06ada266557477a7233fbc4bd48cdef5849db7
@@ -274,6 +274,7 @@ static int aim_im_paraminfo(OscarData *o
 			| 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;
============================================================
--- libpurple/protocols/oscar/oscar.c	e3b05ea62c59df9de9d055efb5f1469fe1eb73eb
+++ libpurple/protocols/oscar/oscar.c	2aa81cbdb38122b4efafb7404b8fb82c7c599c1f
@@ -2494,8 +2494,15 @@ static int incomingim_chan1(OscarData *o
 	 *
 	 * 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 @@ oscar_send_im(PurpleConnection *gc, cons
 			   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);
============================================================
--- libpurple/protocols/oscar/oscar.h	208580bf173f00407f666a1bd3c4b82ae80066b5
+++ libpurple/protocols/oscar/oscar.h	fc6010babfdea02cdecb5dcd6e8d46548a7210b5
@@ -746,6 +746,7 @@ void aim_ads_requestads(OscarData *od, F
 #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. */


More information about the Commits mailing list