pidgin: 8cd17139: Oh, we don't need a special ui_info fiel...

markdoliner at pidgin.im markdoliner at pidgin.im
Wed Jul 8 16:50:26 EDT 2009


-----------------------------------------------------------------
Revision: 8cd17139719734afe4de1e3393885e491e2cf52e
Ancestor: 4fcb9258ad826a7ff163b0f374e70b4b556ef25c
Author: markdoliner at pidgin.im
Date: 2009-07-08T20:44:16
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/8cd17139719734afe4de1e3393885e491e2cf52e

Modified files:
        finch/finch.c libpurple/protocols/oscar/family_auth.c
        libpurple/protocols/oscar/flap_connection.c
        libpurple/protocols/oscar/oscar.h
        libpurple/protocols/oscar/util.c pidgin/gtkmain.c

ChangeLog: 

Oh, we don't need a special ui_info field for the AIM clientstring
because we can just concat the name and version.  And set the distids
for libpurple, Pidgin and Finch

AOL would like Adium to use 1551 (0x060f)

-------------- next part --------------
============================================================
--- finch/finch.c	3f94729b09f2e6cf53bf7c70fb939633eb587e75
+++ finch/finch.c	65c413612d0991cbe6e1967477a90d62999436f0
@@ -77,6 +77,14 @@ static GHashTable *finch_ui_get_info(voi
 		 */
 		g_hash_table_insert(ui_info, "prpl-aim-clientkey", "ma19sqWV9ymU6UYc");
 		g_hash_table_insert(ui_info, "prpl-icq-clientkey", "ma19sqWV9ymU6UYc");
+
+		/*
+		 * This is the distid for Finch, given to us by AOL.  Please
+		 * don't use this for other applications.  You can just not
+		 * specify a distid and libpurple will use a default.
+		 */
+		g_hash_table_insert(ui_info, "prpl-aim-distid", GINT_TO_POINTER(1552));
+		g_hash_table_insert(ui_info, "prpl-icq-distid", GINT_TO_POINTER(1552));
 	}
 
 	return ui_info;
============================================================
--- libpurple/protocols/oscar/family_auth.c	4e1ea4a17d86e68b9fd0ec40b6e935a852e7c934
+++ libpurple/protocols/oscar/family_auth.c	5acbf1fde446f916d4eacea97088acc6024b53d0
@@ -129,7 +129,6 @@ goddamnicq2(OscarData *od, FlapConnectio
 	GSList *tlvlist = NULL;
 	int passwdlen;
 	guint8 *password_encoded;
-	const char *clientstring;
 	guint32 distrib;
 
 	passwdlen = strlen(password);
@@ -141,9 +140,6 @@ goddamnicq2(OscarData *od, FlapConnectio
 
 	aim_encode_password(password, password_encoded);
 
-	clientstring = oscar_get_ui_info_string(
-			od->icq ? "prpl-icq-clientstring" : "prpl-aim-clientstring",
-			ci->clientstring);
 	distrib = oscar_get_ui_info_int(
 			od->icq ? "prpl-icq-distid" : "prpl-aim-distid",
 			ci->distrib);
@@ -152,8 +148,13 @@ goddamnicq2(OscarData *od, FlapConnectio
 	aim_tlvlist_add_str(&tlvlist, 0x0001, sn);
 	aim_tlvlist_add_raw(&tlvlist, 0x0002, passwdlen, password_encoded);
 
-	if (clientstring)
+	if (ci->clientstring != NULL)
+		aim_tlvlist_add_str(&tlvlist, 0x0003, ci->clientstring);
+	else {
+		gchar *clientstring = oscar_get_clientstring();
 		aim_tlvlist_add_str(&tlvlist, 0x0003, clientstring);
+		g_free(clientstring);
+	}
 	aim_tlvlist_add_16(&tlvlist, 0x0016, (guint16)ci->clientid);
 	aim_tlvlist_add_16(&tlvlist, 0x0017, (guint16)ci->major);
 	aim_tlvlist_add_16(&tlvlist, 0x0018, (guint16)ci->minor);
@@ -219,7 +220,6 @@ aim_send_login(OscarData *od, FlapConnec
 	guint8 digest[16];
 	aim_snacid_t snacid;
 	size_t password_len;
-	const char *clientstring;
 	guint32 distrib;
 
 	if (!ci || !sn || !password)
@@ -247,9 +247,6 @@ aim_send_login(OscarData *od, FlapConnec
 
 	aim_encode_password_md5(password, password_len, key, digest);
 
-	clientstring = oscar_get_ui_info_string(
-			od->icq ? "prpl-icq-clientstring" : "prpl-aim-clientstring",
-			ci->clientstring);
 	distrib = oscar_get_ui_info_int(
 			od->icq ? "prpl-icq-distid" : "prpl-aim-distid",
 			ci->distrib);
@@ -260,8 +257,13 @@ aim_send_login(OscarData *od, FlapConnec
 	aim_tlvlist_add_noval(&tlvlist, 0x004c);
 #endif
 
-	if (clientstring)
+	if (ci->clientstring != NULL)
+		aim_tlvlist_add_str(&tlvlist, 0x0003, ci->clientstring);
+	else {
+		gchar *clientstring = oscar_get_clientstring();
 		aim_tlvlist_add_str(&tlvlist, 0x0003, clientstring);
+		g_free(clientstring);
+	}
 	aim_tlvlist_add_16(&tlvlist, 0x0016, (guint16)ci->clientid);
 	aim_tlvlist_add_16(&tlvlist, 0x0017, (guint16)ci->major);
 	aim_tlvlist_add_16(&tlvlist, 0x0018, (guint16)ci->minor);
============================================================
--- libpurple/protocols/oscar/flap_connection.c	6956076133bd4cd188d52b77c5100ca74b548ddf
+++ libpurple/protocols/oscar/flap_connection.c	fd894ef00a84d9acd64d7479072e1c86947f90e6
@@ -77,19 +77,19 @@ flap_connection_send_version_with_cookie
 {
 	FlapFrame *frame;
 	GSList *tlvlist = NULL;
-	const char *clientstring;
 
 	frame = flap_frame_new(od, 0x01, 1152 + length);
 
 	byte_stream_put32(&frame->data, 0x00000001); /* FLAP Version */
 	aim_tlvlist_add_raw(&tlvlist, 0x0006, length, chipsahoy);
 
-	clientstring = oscar_get_ui_info_string(
-			od->icq ? "prpl-icq-clientstring" : "prpl-aim-clientstring",
-			ci->clientstring);
-
-	if (clientstring != NULL)
+	if (ci->clientstring != NULL)
+		aim_tlvlist_add_str(&tlvlist, 0x0003, ci->clientstring);
+	else {
+		gchar *clientstring = oscar_get_clientstring();
 		aim_tlvlist_add_str(&tlvlist, 0x0003, clientstring);
+		g_free(clientstring);
+	}
 	aim_tlvlist_add_16(&tlvlist, 0x0017, (guint16)ci->major);
 	aim_tlvlist_add_16(&tlvlist, 0x0018, (guint16)ci->minor);
 	aim_tlvlist_add_16(&tlvlist, 0x0019, (guint16)ci->point);
============================================================
--- libpurple/protocols/oscar/oscar.h	20e5cdd3ae57ee664624ab3dfc458c812b07c451
+++ libpurple/protocols/oscar/oscar.h	778c3c2ffc9d791757e8caa92cabf4f6a27e170f
@@ -307,23 +307,25 @@ struct _ClientInfo
 /*
  * We need to use the major-minor-micro versions from the official
  * AIM and ICQ programs here or AOL won't let us use certain features.
+ *
+ * 0x00000611 is the distid given to us by AOL for use as the default
+ * libpurple distid.
  */
-
 #define CLIENTINFO_PURPLE_AIM { \
-	"Purple/" VERSION, \
+	NULL, \
 	0x0109, \
 	0x0005, 0x0001, \
 	0x0000, 0x0bdc, \
-	0x000000d2, \
+	0x00000611, \
 	"us", "en", \
 }
 
 #define CLIENTINFO_PURPLE_ICQ { \
-	"Purple/" VERSION, \
+	NULL, \
 	0x010a, \
 	0x0014, 0x0034, \
 	0x0000, 0x0c18, \
-	0x0000043d, \
+	0x00000611, \
 	"us", "en", \
 }
 
@@ -1529,6 +1531,7 @@ const char *oscar_get_ui_info_string(con
 
 int oscar_get_ui_info_int(const char *str, int default_value);
 const char *oscar_get_ui_info_string(const char *str, const char *default_value);
+gchar *oscar_get_clientstring(void);
 
 guint16 aimutil_iconsum(const guint8 *buf, int buflen);
 int aimutil_tokslen(char *toSearch, int theindex, char dl);
============================================================
--- libpurple/protocols/oscar/util.c	0a84360371e188b68854794730c144b73066a070
+++ libpurple/protocols/oscar/util.c	b46acdff41c4be3d082467271f152750f254c1ef
@@ -42,7 +42,7 @@ int oscar_get_ui_info_int(const char *st
 	ui_info = purple_core_get_ui_info();
 	if (ui_info != NULL) {
 		gpointer value;
-		if (g_hash_table_lookup_extended(ui_info, str, NULL, value))
+		if (g_hash_table_lookup_extended(ui_info, str, NULL, &value))
 			return GPOINTER_TO_INT(value);
 	}
 
@@ -63,6 +63,16 @@ const char *oscar_get_ui_info_string(con
 	return value;
 }
 
+gchar *oscar_get_clientstring(void)
+{
+	const char *name, *version;
+
+	name = oscar_get_ui_info_string("name", "Purple");
+	version = oscar_get_ui_info_string("version", VERSION);
+
+	return g_strdup_printf("%s/%s", name, version);;
+}
+
 /*
  * Tokenizing functions.  Used to portably replace strtok/sep.
  *   -- DMP.
============================================================
--- pidgin/gtkmain.c	21b860b1d0dc3f9bcf39ec557b9dae74118c4e97
+++ pidgin/gtkmain.c	957baa567ba04f3f508ccce8ad6bc0c3f82cf121
@@ -367,6 +367,14 @@ static GHashTable *pidgin_ui_get_info(vo
 		 */
 		g_hash_table_insert(ui_info, "prpl-aim-clientkey", "ma1cSASNCKFtrdv9");
 		g_hash_table_insert(ui_info, "prpl-icq-clientkey", "ma1cSASNCKFtrdv9");
+
+		/*
+		 * This is the distid for Pidgin, given to us by AOL.  Please
+		 * don't use this for other applications.  You can just not
+		 * specify a distid and libpurple will use a default.
+		 */
+		g_hash_table_insert(ui_info, "prpl-aim-distid", GINT_TO_POINTER(1550));
+		g_hash_table_insert(ui_info, "prpl-icq-distid", GINT_TO_POINTER(1550));
 	}
 
 	return ui_info;


More information about the Commits mailing list