changeset 27099:48bfcbe20b11

merge of '86d7e4c199cf2a62e48fd6fe79e35e3c80cc7926' and 'ddd8012e657f100977759e1d1312576b04b464b9'
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Thu, 11 Jun 2009 05:07:15 +0000
parents 28b5fcfb7444 (diff) d679d47c82be (current diff)
children 710cb8df1b69
files
diffstat 2 files changed, 34 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/oscar/family_auth.c	Thu Jun 11 02:21:44 2009 +0000
+++ b/libpurple/protocols/oscar/family_auth.c	Thu Jun 11 05:07:15 2009 +0000
@@ -129,6 +129,8 @@
 	GSList *tlvlist = NULL;
 	int passwdlen;
 	guint8 *password_encoded;
+	const char *clientstring;
+	guint32 distrib;
 
 	passwdlen = strlen(password);
 	password_encoded = (guint8 *)g_malloc(passwdlen+1);
@@ -139,18 +141,25 @@
 
 	aim_encode_password(password, password_encoded);
 
+	clientstring = purple_prefs_get_string("/plugins/prpl/oscar/clientstring");
+	if (clientstring == NULL)
+		clientstring = ci->clientstring;
+	distrib = purple_prefs_get_int("/plugins/prpl/oscar/distid");
+	if ((gint32)distrib == -1)
+		distrib = ci->distrib;
+
 	byte_stream_put32(&frame->data, 0x00000001); /* FLAP Version */
 	aim_tlvlist_add_str(&tlvlist, 0x0001, sn);
 	aim_tlvlist_add_raw(&tlvlist, 0x0002, passwdlen, password_encoded);
 
-	if (ci->clientstring)
-		aim_tlvlist_add_str(&tlvlist, 0x0003, ci->clientstring);
+	if (clientstring)
+		aim_tlvlist_add_str(&tlvlist, 0x0003, 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);
 	aim_tlvlist_add_16(&tlvlist, 0x0019, (guint16)ci->point);
 	aim_tlvlist_add_16(&tlvlist, 0x001a, (guint16)ci->build);
-	aim_tlvlist_add_32(&tlvlist, 0x0014, (guint32)ci->distrib); /* distribution chan */
+	aim_tlvlist_add_32(&tlvlist, 0x0014, distrib); /* distribution chan */
 	aim_tlvlist_add_str(&tlvlist, 0x000f, ci->lang);
 	aim_tlvlist_add_str(&tlvlist, 0x000e, ci->country);
 
@@ -210,6 +219,8 @@
 	guint8 digest[16];
 	aim_snacid_t snacid;
 	size_t password_len;
+	const char *clientstring;
+	guint32 distrib;
 
 	if (!ci || !sn || !password)
 		return -EINVAL;
@@ -236,20 +247,27 @@
 
 	aim_encode_password_md5(password, password_len, key, digest);
 
+	clientstring = purple_prefs_get_string("/plugins/prpl/oscar/clientstring");
+	if (clientstring == NULL)
+		clientstring = ci->clientstring;
+	distrib = purple_prefs_get_int("/plugins/prpl/oscar/distid");
+	if ((gint32)distrib == -1)
+		distrib = ci->distrib;
+
 	aim_tlvlist_add_raw(&tlvlist, 0x0025, 16, digest);
 
 #ifndef USE_OLD_MD5
 	aim_tlvlist_add_noval(&tlvlist, 0x004c);
 #endif
 
-	if (ci->clientstring)
-		aim_tlvlist_add_str(&tlvlist, 0x0003, ci->clientstring);
+	if (clientstring)
+		aim_tlvlist_add_str(&tlvlist, 0x0003, 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);
 	aim_tlvlist_add_16(&tlvlist, 0x0019, (guint16)ci->point);
 	aim_tlvlist_add_16(&tlvlist, 0x001a, (guint16)ci->build);
-	aim_tlvlist_add_32(&tlvlist, 0x0014, (guint32)ci->distrib);
+	aim_tlvlist_add_32(&tlvlist, 0x0014, distrib);
 	aim_tlvlist_add_str(&tlvlist, 0x000f, ci->lang);
 	aim_tlvlist_add_str(&tlvlist, 0x000e, ci->country);
 
--- a/libpurple/protocols/oscar/oscar.c	Thu Jun 11 02:21:44 2009 +0000
+++ b/libpurple/protocols/oscar/oscar.c	Thu Jun 11 05:07:15 2009 +0000
@@ -7022,6 +7022,16 @@
 	/* Preferences */
 	purple_prefs_add_none("/plugins/prpl/oscar");
 	purple_prefs_add_bool("/plugins/prpl/oscar/recent_buddies", FALSE);
+
+	/*
+	 * These two preferences will normally not be changed.  UIs can optionally
+	 * use them to override these two version fields which are sent to the
+	 * server when logging in.  AOL requested this change to allow clients to
+	 * use custom values.
+	 */
+	purple_prefs_add_string("/plugins/prpl/oscar/clientstring", NULL);
+	purple_prefs_add_int("/plugins/prpl/oscar/distid", -1);
+
 	purple_prefs_remove("/plugins/prpl/oscar/show_idle");
 	purple_prefs_remove("/plugins/prpl/oscar/always_use_rv_proxy");