changeset 4102:c5ce82228a2f

[gaim-migrate @ 4317] Cooley enough, @mac.com screen names can sign on without any additional changes. There are a few problems, though. This fixes one of them: -SNAC error saying "Not supported by host" or something similar at signon, because gaim requests a redirect to the email notification server, but this is not supported for ICQ and @mac.com accounts (I don't know why ICQ accounts don't give the error). Anyway, so this fixes the problem by only requesting the redirect if the screen name has an email address associated with it. I made it so the auth reply info is stored in the oscar session struct. There are some other useful variables there, and I think it's just cleaner to store the whole thing than the little bits and pieces. I heard someone complain about your_uin@pager.icq.com spam, so I'm thinking it'd be good if there were a way to disable those types of messages. WinICQ has a nice little preferences thingy, I think. I dunno, maybe I could add a checkbox to the account window? committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 19 Dec 2002 20:38:12 +0000
parents 003e0a02d6b9
children caa7701b67d1
files src/protocols/oscar/aim.h src/protocols/oscar/auth.c src/protocols/oscar/conn.c src/protocols/oscar/icq.c src/protocols/oscar/im.c src/protocols/oscar/oscar.c
diffstat 6 files changed, 67 insertions(+), 44 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/oscar/aim.h	Thu Dec 19 20:33:57 2002 +0000
+++ b/src/protocols/oscar/aim.h	Thu Dec 19 20:38:12 2002 +0000
@@ -377,6 +377,7 @@
 		aim_frame_t *holding_queue;
 	} ssi;
 
+	struct aim_authresp_info *authinfo;
 	struct aim_emailinfo *emailinfo;
 
 	/* Connection information */
--- a/src/protocols/oscar/auth.c	Thu Dec 19 20:33:57 2002 +0000
+++ b/src/protocols/oscar/auth.c	Thu Dec 19 20:38:12 2002 +0000
@@ -348,10 +348,11 @@
 {
 	aim_tlvlist_t *tlvlist;
 	aim_rxcallback_t userfunc;
-	struct aim_authresp_info info;
+	struct aim_authresp_info *info;
 	int ret = 0;
 
-	memset(&info, 0, sizeof(info));
+	info = (struct aim_authresp_info *)malloc(sizeof(struct aim_authresp_info));
+	memset(info, 0, sizeof(struct aim_authresp_info));
 
 	/*
 	 * Read block of TLVs.  All further data is derived
@@ -364,8 +365,8 @@
 	 */
 	memset(sess->sn, 0, sizeof(sess->sn));
 	if (aim_gettlv(tlvlist, 0x0001, 1)) {
-		info.sn = aim_gettlv_str(tlvlist, 0x0001, 1);
-		strncpy(sess->sn, info.sn, sizeof(sess->sn));
+		info->sn = aim_gettlv_str(tlvlist, 0x0001, 1);
+		strncpy(sess->sn, info->sn, sizeof(sess->sn));
 	}
 
 	/*
@@ -373,15 +374,15 @@
 	 * have an error url.
 	 */
 	if (aim_gettlv(tlvlist, 0x0008, 1)) 
-		info.errorcode = aim_gettlv16(tlvlist, 0x0008, 1);
+		info->errorcode = aim_gettlv16(tlvlist, 0x0008, 1);
 	if (aim_gettlv(tlvlist, 0x0004, 1))
-		info.errorurl = aim_gettlv_str(tlvlist, 0x0004, 1);
+		info->errorurl = aim_gettlv_str(tlvlist, 0x0004, 1);
 
 	/*
 	 * BOS server address.
 	 */
 	if (aim_gettlv(tlvlist, 0x0005, 1))
-		info.bosip = aim_gettlv_str(tlvlist, 0x0005, 1);
+		info->bosip = aim_gettlv_str(tlvlist, 0x0005, 1);
 
 	/*
 	 * Authorization cookie.
@@ -391,19 +392,21 @@
 
 		tmptlv = aim_gettlv(tlvlist, 0x0006, 1);
 
-		info.cookie = tmptlv->value;
+		info->cookie = tmptlv->value;
 	}
 
 	/*
 	 * The email address attached to this account
-	 *   Not available for ICQ logins.
+	 *   Not available for ICQ or @mac.com logins.
+	 *   If you receive this TLV, then you are allowed to use 
+	 *   family 0x0018 to check the status of your email.
 	 */
 	if (aim_gettlv(tlvlist, 0x0011, 1))
-		info.email = aim_gettlv_str(tlvlist, 0x0011, 1);
+		info->email = aim_gettlv_str(tlvlist, 0x0011, 1);
 
 	/*
 	 * The registration status.  (Not real sure what it means.)
-	 *   Not available for ICQ logins.
+	 *   Not available for ICQ or @mac.com logins.
 	 *
 	 *   1 = No disclosure
 	 *   2 = Limited disclosure
@@ -412,29 +415,31 @@
 	 * This has to do with whether your email address is available
 	 * to other users or not.  AFAIK, this feature is no longer used.
 	 *
+	 * Means you can use the admin family? (0x0007)
+	 *
 	 */
 	if (aim_gettlv(tlvlist, 0x0013, 1))
-		info.regstatus = aim_gettlv16(tlvlist, 0x0013, 1);
+		info->regstatus = aim_gettlv16(tlvlist, 0x0013, 1);
 
 	if (aim_gettlv(tlvlist, 0x0040, 1))
-		info.latestbeta.build = aim_gettlv32(tlvlist, 0x0040, 1);
+		info->latestbeta.build = aim_gettlv32(tlvlist, 0x0040, 1);
 	if (aim_gettlv(tlvlist, 0x0041, 1))
-		info.latestbeta.url = aim_gettlv_str(tlvlist, 0x0041, 1);
+		info->latestbeta.url = aim_gettlv_str(tlvlist, 0x0041, 1);
 	if (aim_gettlv(tlvlist, 0x0042, 1))
-		info.latestbeta.info = aim_gettlv_str(tlvlist, 0x0042, 1);
+		info->latestbeta.info = aim_gettlv_str(tlvlist, 0x0042, 1);
 	if (aim_gettlv(tlvlist, 0x0043, 1))
-		info.latestbeta.name = aim_gettlv_str(tlvlist, 0x0043, 1);
+		info->latestbeta.name = aim_gettlv_str(tlvlist, 0x0043, 1);
 	if (aim_gettlv(tlvlist, 0x0048, 1))
 		; /* no idea what this is */
 
 	if (aim_gettlv(tlvlist, 0x0044, 1))
-		info.latestrelease.build = aim_gettlv32(tlvlist, 0x0044, 1);
+		info->latestrelease.build = aim_gettlv32(tlvlist, 0x0044, 1);
 	if (aim_gettlv(tlvlist, 0x0045, 1))
-		info.latestrelease.url = aim_gettlv_str(tlvlist, 0x0045, 1);
+		info->latestrelease.url = aim_gettlv_str(tlvlist, 0x0045, 1);
 	if (aim_gettlv(tlvlist, 0x0046, 1))
-		info.latestrelease.info = aim_gettlv_str(tlvlist, 0x0046, 1);
+		info->latestrelease.info = aim_gettlv_str(tlvlist, 0x0046, 1);
 	if (aim_gettlv(tlvlist, 0x0047, 1))
-		info.latestrelease.name = aim_gettlv_str(tlvlist, 0x0047, 1);
+		info->latestrelease.name = aim_gettlv_str(tlvlist, 0x0047, 1);
 	if (aim_gettlv(tlvlist, 0x0049, 1))
 		; /* no idea what this is */
 
@@ -442,22 +447,18 @@
 	 * URL to change password.
 	 */
 	if (aim_gettlv(tlvlist, 0x0054, 1))
-		info.chpassurl = aim_gettlv_str(tlvlist, 0x0054, 1);
+		info->chpassurl = aim_gettlv_str(tlvlist, 0x0054, 1);
+
+	/*
+	 * Unknown.  Seen on an @mac.com screen name with value of 0x003f
+	 */
+	if (aim_gettlv(tlvlist, 0x0055, 1))
+		;
+
+	sess->authinfo = info;
 
 	if ((userfunc = aim_callhandler(sess, rx->conn, snac ? snac->family : 0x0017, snac ? snac->subtype : 0x0003)))
-		ret = userfunc(sess, rx, &info);
-
-	free(info.sn);
-	free(info.bosip);
-	free(info.errorurl);
-	free(info.email);
-	free(info.chpassurl);
-	free(info.latestrelease.name);
-	free(info.latestrelease.url);
-	free(info.latestrelease.info);
-	free(info.latestbeta.name);
-	free(info.latestbeta.url);
-	free(info.latestbeta.info);
+		ret = userfunc(sess, rx, info);
 
 	aim_freetlvchain(&tlvlist);
 
@@ -488,6 +489,24 @@
 	return ret;
 }
 
+static void auth_shutdown(aim_session_t *sess, aim_module_t *mod)
+{
+	if (sess->authinfo) {
+		free(sess->authinfo->sn);
+		free(sess->authinfo->bosip);
+		free(sess->authinfo->errorurl);
+		free(sess->authinfo->email);
+		free(sess->authinfo->chpassurl);
+		free(sess->authinfo->latestrelease.name);
+		free(sess->authinfo->latestrelease.url);
+		free(sess->authinfo->latestrelease.info);
+		free(sess->authinfo->latestbeta.name);
+		free(sess->authinfo->latestbeta.url);
+		free(sess->authinfo->latestbeta.info);
+		free(sess->authinfo);
+	}
+}
+
 static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
 {
 
@@ -507,6 +526,7 @@
 	mod->flags = 0;
 	strncpy(mod->name, "auth", sizeof(mod->name));
 	mod->snachandler = snachandler;
+	mod->shutdown = auth_shutdown;
 
 	return 0;
 }
--- a/src/protocols/oscar/conn.c	Thu Dec 19 20:33:57 2002 +0000
+++ b/src/protocols/oscar/conn.c	Thu Dec 19 20:38:12 2002 +0000
@@ -885,6 +885,7 @@
 	sess->ssi.items = NULL;
 	sess->ssi.timestamp = (time_t)0;
 
+	sess->authinfo = NULL;
 	sess->emailinfo = NULL;
 
 	/*
--- a/src/protocols/oscar/icq.c	Thu Dec 19 20:33:57 2002 +0000
+++ b/src/protocols/oscar/icq.c	Thu Dec 19 20:38:12 2002 +0000
@@ -173,7 +173,6 @@
 	faimdprintf(sess, 1, "icq response: %d bytes, %ld, 0x%04x, 0x%04x\n", cmdlen, ouruin, cmd, reqid);
 
 	if (cmd == 0x0041) { /* offline message */
-		fu16_t msglen;
 		struct aim_icq_offlinemsg msg;
 		aim_rxcallback_t userfunc;
 
--- a/src/protocols/oscar/im.c	Thu Dec 19 20:33:57 2002 +0000
+++ b/src/protocols/oscar/im.c	Thu Dec 19 20:38:12 2002 +0000
@@ -37,14 +37,15 @@
  *
  *
  * Heres the current collection:
- *  0501 0003 0101 0101 01       AOL Mobile Communicator, WinAIM 1.0.414
- *  0501 0003 0101 0201 01       WinAIM 2.0.847, 2.1.1187, 3.0.1464, 
- *                                      4.3.2229, 4.4.2286
- *  0501 0004 0101 0102 0101     WinAIM 4.1.2010, libfaim (right here)
- *  0501 0003 0101 02            WinAIM 5
- *  0501 0001 01                 iChat x.x
- *  0501 0001 0101 01            AOL v6.0, CompuServe 2000 v6.0, any
- *                                      TOC client
+ *  0501 0003 0101 0101 01	AOL Mobile Communicator, WinAIM 1.0.414
+ *  0501 0003 0101 0201 01	WinAIM 2.0.847, 2.1.1187, 3.0.1464, 
+ *					4.3.2229, 4.4.2286
+ *  0501 0004 0101 0102 0101	WinAIM 4.1.2010, libfaim (right here)
+ *  0501 0003 0101 02		WinAIM 5
+ *  0501 0001 01		iChat x.x
+ *  0501 0001 0101 01		AOL v6.0, CompuServe 2000 v6.0, any
+ *				TOC client
+ *  0501 0002 0106		WinICQ 5.45.1.3777.85
  *
  * Note that in this function, only the feature bytes are tested, since
  * the rest will always be the same.
--- a/src/protocols/oscar/oscar.c	Thu Dec 19 20:33:57 2002 +0000
+++ b/src/protocols/oscar/oscar.c	Thu Dec 19 20:38:12 2002 +0000
@@ -3156,7 +3156,8 @@
 	aim_icq_reqofflinemsgs(sess);
 
 	aim_reqservice(sess, fr->conn, AIM_CONN_TYPE_CHATNAV);
-	aim_reqservice(sess, fr->conn, AIM_CONN_TYPE_EMAIL);
+	if (sess->authinfo->email)
+		aim_reqservice(sess, fr->conn, AIM_CONN_TYPE_EMAIL);
 
 	if (!odata->icq) {
 		debug_printf("ssi: requesting ssi list\n");