*
*/
+#define FAIM_INTERNAL
#include <faim/aim.h>
/*
else
workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, 0x0017, 0xffff, workingPtr);
break;
+
case 0x0001:
if (subtype == 0x0003)
workingPtr->handled = aim_parse_hostonline(sess, workingPtr);
+ else if (subtype == 0x0007)
+ workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, 0x0001, 0x0007, workingPtr);
+ else if (subtype == 0x0018)
+ workingPtr->handled = aim_parse_hostversions(sess, workingPtr);
else
- workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, 0x0017, 0xffff, workingPtr);
+ workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, 0x0001, 0xffff, workingPtr);
break;
+
case 0x0007:
- if (subtype == 0x0005)
- workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, AIM_CB_FAM_ADM, AIM_CB_ADM_INFOCHANGE_REPLY, workingPtr);
+ if (subtype == 0x0003)
+ workingPtr->handled = aim_parse_infochange(sess, workingPtr);
+ else if (subtype == 0x0005)
+ workingPtr->handled = aim_parse_infochange(sess, workingPtr);
+ else if (subtype == 0x0007)
+ workingPtr->handled = aim_parse_accountconfirm(sess, workingPtr);
break;
+
case AIM_CB_FAM_SPECIAL:
if (subtype == AIM_CB_SPECIAL_DEBUGCONN_CONNECT) {
workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, family, subtype, workingPtr);
} else
workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, 0x0017, 0xffff, workingPtr);
break;
+
default:
break;
}
case 0x000a: /* Family: User lookup */
switch (subtype) {
case 0x0001:
- workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, 0x000a, 0x0001, workingPtr);
+ workingPtr->handled = aim_parse_searcherror(sess, workingPtr);
break;
case 0x0003:
- workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, 0x000a, 0x0003, workingPtr);
+ workingPtr->handled = aim_parse_searchreply(sess, workingPtr);
break;
default:
workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, AIM_CB_FAM_LOK, AIM_CB_LOK_DEFAULT, workingPtr);
} /* switch(family) */
break;
} /* AIM_CONN_TYPE_BOS */
+ case AIM_CONN_TYPE_ADS: {
+ unsigned short family;
+ unsigned short subtype;
+
+ family = aimutil_get16(workingPtr->data);
+ subtype= aimutil_get16(workingPtr->data+2);
+
+ if ((family == 0x0000) && (subtype == 0x00001)) {
+ workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_FLAPVER, workingPtr);
+ } else if ((family == 0x0001) && (subtype == 0x0003)) {
+ workingPtr->handled = aim_parse_hostonline(sess, workingPtr);
+ } else {
+ workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, family, subtype, workingPtr);
+ }
+ break;
+ }
case AIM_CONN_TYPE_CHATNAV: {
u_short family;
u_short subtype;
return ret;
}
+/*
+ * The Rate Limiting System, An Abridged Guide to Nonsense.
+ *
+ * OSCAR defines several 'rate classes'. Each class has seperate
+ * rate limiting properties (limit level, alert level, disconnect
+ * level, etc), and a set of SNAC family/type pairs associated with
+ * it. The rate classes, their limiting properties, and the definitions
+ * of which SNACs are belong to which class, are defined in the
+ * Rate Response packet at login to each host.
+ *
+ * Logically, all rate offenses within one class count against further
+ * offenses for other SNACs in the same class (ie, sending messages
+ * too fast will limit the number of user info requests you can send,
+ * since those two SNACs are in the same rate class).
+ *
+ * Since the rate classes are defined dynamically at login, the values
+ * below may change. But they seem to be fairly constant.
+ *
+ * Currently, BOS defines five rate classes, with the commonly used
+ * members as follows...
+ *
+ * Rate class 0x0001:
+ * - Everything thats not in any of the other classes
+ *
+ * Rate class 0x0002:
+ * - Buddy list add/remove
+ * - Permit list add/remove
+ * - Deny list add/remove
+ *
+ * Rate class 0x0003:
+ * - User information requests
+ * - Outgoing ICBMs
+ *
+ * Rate class 0x0004:
+ * - A few unknowns: 2/9, 2/b, and f/2
+ *
+ * Rate class 0x0005:
+ * - Chat room create
+ * - Outgoing chat ICBMs
+ *
+ * The only other thing of note is that class 5 (chat) has slightly looser
+ * limiting properties than class 3 (normal messages). But thats just a
+ * small bit of trivia for you.
+ *
+ * The last thing that needs to be learned about the rate limiting
+ * system is how the actual numbers relate to the passing of time. This
+ * seems to be a big mystery.
+ *
+ */
faim_internal int aim_parse_ratechange_middle(struct aim_session_t *sess, struct command_rx_struct *command)
{
rxcallback_t userfunc = NULL;
int ret = 1;
int i;
int code;
- unsigned long parmid, windowsize, clear, alert, limit, disconnect;
+ unsigned long rateclass, windowsize, clear, alert, limit, disconnect;
unsigned long currentavg, maxavg;
i = 10;
code = aimutil_get16(command->data+i);
i += 2;
- parmid = aimutil_get16(command->data+i);
+ rateclass = aimutil_get16(command->data+i);
i += 2;
windowsize = aimutil_get32(command->data+i);
i += 4;
if ((userfunc = aim_callhandler(command->conn, 0x0001, 0x000a)))
- ret = userfunc(sess, command, code, parmid, windowsize, clear, alert, limit, disconnect, currentavg, maxavg);
+ ret = userfunc(sess, command, code, rateclass, windowsize, clear, alert, limit, disconnect, currentavg, maxavg);
return ret;
}
return ret;
}
+faim_internal int aim_parse_accountconfirm(struct aim_session_t *sess,
+ struct command_rx_struct *command)
+{
+ rxcallback_t userfunc = NULL;
+ int ret = 1;
+ int status = -1;
+
+ status = aimutil_get16(command->data+10);
+
+ if ((userfunc = aim_callhandler(command->conn, 0x0007, 0x0007)))
+ ret = userfunc(sess, command, status);
+
+ return ret;
+}
+
+faim_internal int aim_parse_infochange(struct aim_session_t *sess,
+ struct command_rx_struct *command)
+{
+ unsigned short subtype; /* called for both reply and change-reply */
+ int i;
+
+ subtype = aimutil_get16(command->data+2);
+
+ /*
+ * struct {
+ * unsigned short perms;
+ * unsigned short tlvcount;
+ * aim_tlv_t tlvs[tlvcount];
+ * } admin_info[n];
+ */
+ for (i = 10; i < command->commandlen; ) {
+ int perms, tlvcount;
+
+ perms = aimutil_get16(command->data+i);
+ i += 2;
+
+ tlvcount = aimutil_get16(command->data+i);
+ i += 2;
+
+ while (tlvcount) {
+ rxcallback_t userfunc;
+ struct aim_tlv_t *tlv;
+ int str = 0;
+
+ if ((aimutil_get16(command->data+i) == 0x0011) ||
+ (aimutil_get16(command->data+i) == 0x0004))
+ str = 1;
+
+ if (str)
+ tlv = aim_grabtlvstr(command->data+i);
+ else
+ tlv = aim_grabtlv(command->data+i);
+
+ /* XXX fix so its only called once for the entire packet */
+ if ((userfunc = aim_callhandler(command->conn, 0x0007, subtype)))
+ userfunc(sess, command, perms, tlv->type, tlv->length, tlv->value, str);
+
+ if (tlv)
+ i += 2+2+tlv->length;
+
+ if (tlv && tlv->value)
+ free(tlv->value);
+ if (tlv)
+ free(tlv);
+
+ tlvcount--;
+ }
+ }
+
+ return 1;
+}
+
faim_internal int aim_parse_hostversions(struct aim_session_t *sess,
struct command_rx_struct *command, ...)
{