changeset 2917:93e2c99ccf50

[gaim-migrate @ 2930] sync committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sat, 22 Dec 2001 04:02:29 +0000
parents 4254491c722b
children 4df759d607f3
files src/protocols/oscar/aim.h src/protocols/oscar/ft.c src/protocols/oscar/info.c
diffstat 3 files changed, 20 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/oscar/aim.h	Sat Dec 22 03:38:20 2001 +0000
+++ b/src/protocols/oscar/aim.h	Sat Dec 22 04:02:29 2001 +0000
@@ -857,6 +857,7 @@
 
 #define AIM_GETINFO_GENERALINFO 0x00001
 #define AIM_GETINFO_AWAYMESSAGE 0x00003
+#define AIM_GETINFO_CAPABILITIES 0x0004
 
 struct aim_invite_priv {
 	char *sn;
--- a/src/protocols/oscar/ft.c	Sat Dec 22 03:38:20 2001 +0000
+++ b/src/protocols/oscar/ft.c	Sat Dec 22 04:02:29 2001 +0000
@@ -4,6 +4,7 @@
  */
 
 #define FAIM_INTERNAL
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
--- a/src/protocols/oscar/info.c	Sat Dec 22 03:38:20 2001 +0000
+++ b/src/protocols/oscar/info.c	Sat Dec 22 04:02:29 2001 +0000
@@ -23,9 +23,6 @@
 	if (!sess || !conn || !sn)
 		return -EINVAL;
 
-	if ((infotype != AIM_GETINFO_GENERALINFO) && (infotype != AIM_GETINFO_AWAYMESSAGE))
-		return -EINVAL;
-
 	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 12+1+strlen(sn))))
 		return -ENOMEM;
 
@@ -601,7 +598,8 @@
 	inforeq = (struct aim_priv_inforeq *)origsnac->data;
 
 	if ((inforeq->infotype != AIM_GETINFO_GENERALINFO) &&
-			(inforeq->infotype != AIM_GETINFO_AWAYMESSAGE)) {
+			(inforeq->infotype != AIM_GETINFO_AWAYMESSAGE) &&
+			(inforeq->infotype != AIM_GETINFO_CAPABILITIES)) {
 		faimdprintf(sess, 0, "parse_userinfo_middle: unknown infotype in request! (0x%04x)\n", inforeq->infotype);
 		return 0;
 	}
@@ -614,18 +612,30 @@
 	 * Depending on what informational text was requested, different
 	 * TLVs will appear here.
 	 *
-	 * Profile will be 1 and 2, away message will be 3 and 4.
+	 * Profile will be 1 and 2, away message will be 3 and 4, caps
+	 * will be 5.
 	 */
-	if (aim_gettlv(tlvlist, 0x0001, 1)) {
+	if (inforeq->infotype == AIM_GETINFO_GENERALINFO) {
 		text_encoding = aim_gettlv_str(tlvlist, 0x0001, 1);
 		text = aim_gettlv_str(tlvlist, 0x0002, 1);
-	} else if (aim_gettlv(tlvlist, 0x0003, 1)) {
+	} else if (inforeq->infotype == AIM_GETINFO_AWAYMESSAGE) {
 		text_encoding = aim_gettlv_str(tlvlist, 0x0003, 1);
 		text = aim_gettlv_str(tlvlist, 0x0004, 1);
+	} else if (inforeq->infotype == AIM_GETINFO_CAPABILITIES) {
+		aim_tlv_t *ct;
+
+		if ((ct = aim_gettlv(tlvlist, 0x0005, 1))) {
+			aim_bstream_t cbs;
+
+			aim_bstream_init(&cbs, ct->value, ct->length);
+
+			userinfo.capabilities = aim_getcap(sess, &cbs, ct->length);
+			userinfo.capspresent = 1;
+		}
 	}
 
 	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
-		ret = userfunc(sess, rx, &userinfo, text_encoding, text, inforeq->infotype);
+		ret = userfunc(sess, rx, &userinfo, inforeq->infotype, text_encoding, text);
 
 	free(text_encoding);
 	free(text);