subtype= aimutil_get16(workingPtr->data+2);
if((family < maxf) && (subtype+1 < maxs) && (literals[family][subtype] != NULL))
- printf("bleck: null handler for %04x/%04x (%s)\n", family, subtype, literals[family][subtype+1]);
+ faimdprintf(sess, 0, "bleck: null handler for %04x/%04x (%s)\n", family, subtype, literals[family][subtype+1]);
else
- printf("bleck: null handler for %04x/%04x (no literal)\n",family,subtype);
+ faimdprintf(sess, 0, "bleck: null handler for %04x/%04x (no literal)\n",family,subtype);
return 1;
}
if (!conn)
return -1;
- faimdprintf(1, "aim_conn_addhandler: adding for %04x/%04x\n", family, type);
+ faimdprintf(sess, 1, "aim_conn_addhandler: adding for %04x/%04x\n", family, type);
if (!(newcb = (struct aim_rxcblist_t *)calloc(1, sizeof(struct aim_rxcblist_t))))
return -1;
return 0;
}
-faim_internal rxcallback_t aim_callhandler(struct aim_conn_t *conn,
- u_short family,
- u_short type)
+faim_internal rxcallback_t aim_callhandler(struct aim_session_t *sess,
+ struct aim_conn_t *conn,
+ unsigned short family,
+ unsigned short type)
{
struct aim_rxcblist_t *cur;
if (!conn)
return NULL;
- faimdprintf(1, "aim_callhandler: calling for %04x/%04x\n", family, type);
+ faimdprintf(sess, 1, "aim_callhandler: calling for %04x/%04x\n", family, type);
- cur = conn->handlerlist;
- while(cur)
- {
- if ( (cur->family == family) && (cur->type == type) )
- return cur->handler;
- cur = cur->next;
- }
+ for (cur = conn->handlerlist; cur; cur = cur->next) {
+ if ((cur->family == family) && (cur->type == type))
+ return cur->handler;
+ }
- if (type==0xffff)
- return NULL;
+ if (type == AIM_CB_SPECIAL_DEFAULT) {
+ faimdprintf(sess, 1, "aim_callhandler: no default handler for family 0x%04x\n", family);
+ return NULL; /* prevent infinite recursion */
+ }
+
+ faimdprintf(sess, 1, "aim_callhandler: no handler for 0x%04x/0x%04x\n", family, type);
- return aim_callhandler(conn, family, 0xffff);
+ return aim_callhandler(sess, conn, family, AIM_CB_SPECIAL_DEFAULT);
}
faim_internal int aim_callhandler_noparam(struct aim_session_t *sess,
struct command_rx_struct *ptr)
{
rxcallback_t userfunc = NULL;
- userfunc = aim_callhandler(conn, family, type);
+ userfunc = aim_callhandler(sess, conn, family, type);
if (userfunc)
return userfunc(sess, ptr);
return 1; /* XXX */
struct command_rx_struct *workingPtr = NULL;
if (sess->queue_incoming == NULL) {
- faimdprintf(1, "parse_generic: incoming packet queue empty.\n");
+ faimdprintf(sess, 1, "parse_generic: incoming packet queue empty.\n");
return 0;
} else {
workingPtr = sess->queue_incoming;
for (i = 0; workingPtr != NULL; workingPtr = workingPtr->next, i++) {
+ unsigned short family,subtype;
+
/*
* XXX: This is still fairly ugly.
*/
(workingPtr->conn->type != AIM_CONN_TYPE_RENDEZVOUS)) ||
((workingPtr->hdrtype == AIM_FRAMETYPE_OSCAR) &&
(workingPtr->conn->type == AIM_CONN_TYPE_RENDEZVOUS))) {
- printf("faim: rxhandlers: incompatible frame type %d on connection type 0x%04x\n", workingPtr->hdrtype, workingPtr->conn->type);
+ faimdprintf(sess, 0, "rxhandlers: incompatible frame type %d on connection type 0x%04x\n", workingPtr->hdrtype, workingPtr->conn->type);
workingPtr->handled = 1;
continue;
}
- switch(workingPtr->conn->type) {
- case -1:
- /*
- * This can happen if we have a queued command
- * that was recieved after a connection has
- * been terminated. In which case, the handler
- * list has been cleared, and there's nothing we
- * can do for it. We can only cancel it.
- */
- workingPtr->handled = 1;
- break;
- case AIM_CONN_TYPE_AUTH: {
- unsigned long head;
-
- head = aimutil_get32(workingPtr->data);
- if ((head == 0x00000001) && (workingPtr->commandlen == 4)) {
- faimdprintf(1, "got connection ack on auth line\n");
- workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_FLAPVER, workingPtr);
- } else if (workingPtr->hdr.oscar.type == 0x04) {
- /* Used only by the older login protocol */
- workingPtr->handled = aim_authparse(sess, workingPtr);
- } else {
- unsigned short family,subtype;
-
- family = aimutil_get16(workingPtr->data);
- subtype = aimutil_get16(workingPtr->data+2);
-
- switch (family) {
- /* New login protocol */
- case 0x0017:
- if (subtype == 0x0001)
- workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, 0x0017, 0x0001, workingPtr);
- else if (subtype == 0x0003)
- workingPtr->handled = aim_authparse(sess, workingPtr);
- else if (subtype == 0x0007)
- workingPtr->handled = aim_authkeyparse(sess, workingPtr);
- 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, 0x0001, 0xffff, workingPtr);
- break;
-
- case 0x0007:
- 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);
- break;
- } else
- workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, 0x0017, 0xffff, workingPtr);
- break;
-
- default:
- break;
- }
+ if (workingPtr->conn->type == AIM_CONN_TYPE_RENDEZVOUS) {
+ /* make sure that we only get OFT frames on these connections */
+ if (workingPtr->hdrtype != AIM_FRAMETYPE_OFT) {
+ faimdprintf(sess, 0, "internal error: non-OFT frames on OFT connection\n");
+ workingPtr->handled = 1; /* get rid of it */
+ } else {
+ /* XXX: implement this */
+ faimdprintf(sess, 0, "faim: OFT frame!\n");
+ workingPtr->handled = 1; /* get rid of it */
}
- break;
+ continue;
}
- case AIM_CONN_TYPE_BOS: {
- u_short family;
- u_short subtype;
- if (workingPtr->hdr.oscar.type == 0x04) {
- workingPtr->handled = aim_negchan_middle(sess, workingPtr);
- break;
- }
+ if (workingPtr->conn->type == AIM_CONN_TYPE_RENDEZVOUS_OUT) {
+ /* not possible */
+ faimdprintf(sess, 0, "rxdispatch called on RENDEZVOUS_OUT connection!\n");
+ workingPtr->handled = 1;
+ continue;
+ }
- family = aimutil_get16(workingPtr->data);
- subtype = aimutil_get16(workingPtr->data+2);
-
- switch (family) {
- case 0x0000: /* not really a family, but it works */
- if (subtype == 0x0001)
- workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_FLAPVER, workingPtr);
- else
- workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_UNKNOWN, workingPtr);
- break;
- case 0x0001: /* Family: General */
- switch (subtype) {
- case 0x0001:
- workingPtr->handled = aim_parse_generalerrs(sess, workingPtr);
- break;
- case 0x0003:
- workingPtr->handled = aim_parse_hostonline(sess, workingPtr);
- break;
- case 0x0005:
- workingPtr->handled = aim_handleredirect_middle(sess, workingPtr);
- break;
- case 0x0007:
- workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, 0x0001, 0x0007, workingPtr);
- break;
- case 0x000a:
- workingPtr->handled = aim_parse_ratechange_middle(sess, workingPtr);
- break;
- case 0x000f:
- workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, 0x0001, 0x000f, workingPtr);
- break;
- case 0x0010:
- workingPtr->handled = aim_parse_evilnotify_middle(sess, workingPtr);
- break;
- case 0x0013:
- workingPtr->handled = aim_parsemotd_middle(sess, workingPtr);
- break;
- case 0x0018:
- workingPtr->handled = aim_parse_hostversions(sess, workingPtr);
- break;
- default:
- workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, AIM_CB_FAM_GEN, AIM_CB_GEN_DEFAULT, workingPtr);
- break;
- }
- break;
- case 0x0002: /* Family: Location */
- switch (subtype) {
- case 0x0001:
- workingPtr->handled = aim_parse_locateerr(sess, workingPtr);
- break;
- case 0x0003:
- workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, 0x0002, 0x0003, workingPtr);
- break;
- case 0x0006:
- workingPtr->handled = aim_parse_userinfo_middle(sess, workingPtr);
- break;
- default:
- workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, AIM_CB_FAM_LOC, AIM_CB_LOC_DEFAULT, workingPtr);
- break;
- }
- break;
- case 0x0003: /* Family: Buddy List */
- switch (subtype) {
- case 0x0001:
- workingPtr->handled = aim_parse_generalerrs(sess, workingPtr);
- break;
- case 0x0003:
- workingPtr->handled = aim_parse_buddyrights(sess, workingPtr);
- break;
- case 0x000b: /* oncoming buddy */
- workingPtr->handled = aim_parse_oncoming_middle(sess, workingPtr);
- break;
- case 0x000c: /* offgoing buddy */
- workingPtr->handled = aim_parse_offgoing_middle(sess, workingPtr);
- break;
- default:
- workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, AIM_CB_FAM_BUD, AIM_CB_BUD_DEFAULT, workingPtr);
- }
- break;
- case 0x0004: /* Family: Messaging */
- switch (subtype) {
- case 0x0001:
- workingPtr->handled = aim_parse_msgerror_middle(sess, workingPtr);
- break;
- case 0x0005:
- workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, 0x0004, 0x0005, workingPtr);
- break;
- case 0x0006:
- workingPtr->handled = aim_parse_outgoing_im_middle(sess, workingPtr);
- break;
- case 0x0007:
- workingPtr->handled = aim_parse_incoming_im_middle(sess, workingPtr);
- break;
- case 0x000a:
- workingPtr->handled = aim_parse_missedcall(sess, workingPtr);
- break;
- case 0x000c:
- workingPtr->handled = aim_parse_msgack_middle(sess, workingPtr);
- break;
- default:
- workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, AIM_CB_FAM_MSG, AIM_CB_MSG_DEFAULT, workingPtr);
- }
- break;
- case 0x0009:
- if (subtype == 0x0001)
- workingPtr->handled = aim_parse_generalerrs(sess, workingPtr);
- else if (subtype == 0x0003)
- workingPtr->handled = aim_parse_bosrights(sess, workingPtr);
- else
- workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, AIM_CB_FAM_BOS, AIM_CB_BOS_DEFAULT, workingPtr);
- break;
- case 0x000a: /* Family: User lookup */
- switch (subtype) {
- case 0x0001:
- workingPtr->handled = aim_parse_searcherror(sess, workingPtr);
- break;
- case 0x0003:
- 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);
- }
- break;
- case 0x000b: {
- if (subtype == 0x0001)
- workingPtr->handled = aim_parse_generalerrs(sess, workingPtr);
- else if (subtype == 0x0002)
- workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, 0x000b, 0x0002, workingPtr);
- else
- workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, AIM_CB_FAM_STS, AIM_CB_STS_DEFAULT, workingPtr);
- break;
- }
- case 0x0013: {
- printf("lalala: 0x%04x/0x%04x\n", family, subtype);
- break;
- }
- case AIM_CB_FAM_SPECIAL:
- workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, family, subtype, workingPtr);
- break;
- default:
- workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_UNKNOWN, workingPtr);
- break;
- } /* switch(family) */
- break;
- } /* AIM_CONN_TYPE_BOS */
- case AIM_CONN_TYPE_ADS: {
- unsigned short family;
- unsigned short subtype;
+ if ((workingPtr->commandlen == 4) &&
+ (aimutil_get32(workingPtr->data) == 0x00000001)) {
+ workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_FLAPVER, workingPtr);
+ continue;
+ }
- family = aimutil_get16(workingPtr->data);
- subtype= aimutil_get16(workingPtr->data+2);
+ if (workingPtr->hdr.oscar.type == 0x04) {
+ workingPtr->handled = aim_negchan_middle(sess, workingPtr);
+ continue;
+ }
+
+ family = aimutil_get16(workingPtr->data);
+ subtype = aimutil_get16(workingPtr->data+2);
+
+ if (family == 0x0001) {
- 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)) {
+ if (subtype == 0x0001)
+ workingPtr->handled = aim_parse_generalerrs(sess, workingPtr);
+ else if (subtype == 0x0003)
workingPtr->handled = aim_parse_hostonline(sess, workingPtr);
- } else {
- workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, family, subtype, workingPtr);
- }
+ else if (subtype == 0x0005)
+ workingPtr->handled = aim_handleredirect_middle(sess, workingPtr);
+ else if (subtype == 0x0007)
+ workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, 0x0001, 0x0007, workingPtr);
+ else if (subtype == 0x000a)
+ workingPtr->handled = aim_parse_ratechange_middle(sess, workingPtr);
+ else if (subtype == 0x000f)
+ workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, 0x0001, 0x000f, workingPtr);
+ else if (subtype == 0x0010)
+ workingPtr->handled = aim_parse_evilnotify_middle(sess, workingPtr);
+ else if (subtype == 0x0013)
+ workingPtr->handled = aim_parsemotd_middle(sess, workingPtr);
+ else if (subtype == 0x0018)
+ workingPtr->handled = aim_parse_hostversions(sess, workingPtr);
+ else
+ workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, 0x0001, 0xffff, workingPtr);
+
+ } else if (family == 0x0002) {
+
+ if (subtype == 0x0001)
+ workingPtr->handled = aim_parse_locateerr(sess, workingPtr);
+ else if (subtype == 0x0003)
+ workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, 0x0002, 0x0003, workingPtr);
+ else if (subtype == 0x0006)
+ workingPtr->handled = aim_parse_userinfo_middle(sess, workingPtr);
+ else
+ workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, AIM_CB_FAM_LOC, AIM_CB_LOC_DEFAULT, workingPtr);
+
+ } else if (family == 0x0003) {
+
+ if (subtype == 0x0001)
+ workingPtr->handled = aim_parse_generalerrs(sess, workingPtr);
+ else if (subtype == 0x0003)
+ workingPtr->handled = aim_parse_buddyrights(sess, workingPtr);
+ else if (subtype == 0x000b)
+ workingPtr->handled = aim_parse_oncoming_middle(sess, workingPtr);
+ else if (subtype == 0x000c)
+ workingPtr->handled = aim_parse_offgoing_middle(sess, workingPtr);
+ else
+ workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, AIM_CB_FAM_BUD, AIM_CB_BUD_DEFAULT, workingPtr);
+
+ } else if (family == 0x0004) {
+
+ if (subtype == 0x0001)
+ workingPtr->handled = aim_parse_msgerror_middle(sess, workingPtr);
+ else if (subtype == 0x0005)
+ workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, 0x0004, 0x0005, workingPtr);
+ else if (subtype == 0x0006)
+ workingPtr->handled = aim_parse_outgoing_im_middle(sess, workingPtr);
+ else if (subtype == 0x0007)
+ workingPtr->handled = aim_parse_incoming_im_middle(sess, workingPtr);
+ else if (subtype == 0x000a)
+ workingPtr->handled = aim_parse_missedcall(sess, workingPtr);
+ else if (subtype == 0x000c)
+ workingPtr->handled = aim_parse_msgack_middle(sess, workingPtr);
+ else
+ workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, AIM_CB_FAM_MSG, AIM_CB_MSG_DEFAULT, workingPtr);
+
+ } else if (family == 0x0007) {
+
+ 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_CONN_TYPE_CHATNAV: {
- u_short family;
- u_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 if ((family == 0x000d) && (subtype == 0x0009)) {
+
+ } else if (family == 0x0009) {
+
+ if (subtype == 0x0001)
+ workingPtr->handled = aim_parse_generalerrs(sess, workingPtr);
+ else if (subtype == 0x0003)
+ workingPtr->handled = aim_parse_bosrights(sess, workingPtr);
+ else
+ workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, AIM_CB_FAM_BOS, AIM_CB_BOS_DEFAULT, workingPtr);
+
+ } else if (family == 0x000a) {
+
+ if (subtype == 0x0001)
+ workingPtr->handled = aim_parse_searcherror(sess, workingPtr);
+ else if (subtype == 0x0003)
+ workingPtr->handled = aim_parse_searchreply(sess, workingPtr);
+ else
+ workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, AIM_CB_FAM_LOK, AIM_CB_LOK_DEFAULT, workingPtr);
+
+ } else if (family == 0x000b) {
+
+ if (subtype == 0x0001)
+ workingPtr->handled = aim_parse_generalerrs(sess, workingPtr);
+ else if (subtype == 0x0002)
+ workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, 0x000b, 0x0002, workingPtr);
+ else
+ workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, AIM_CB_FAM_STS, AIM_CB_STS_DEFAULT, workingPtr);
+
+ } else if (family == 0x000d) {
+
+ if (subtype == 0x0009)
workingPtr->handled = aim_chatnav_parse_info(sess, workingPtr);
- } else {
- workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, family, subtype, workingPtr);
- }
- break;
- }
- case AIM_CONN_TYPE_CHAT: {
- u_short family, 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) {
- if (subtype == 0x0001)
- workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, 0x0001, 0x0001, workingPtr);
- else 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 == 0x000a)
- workingPtr->handled = aim_parse_ratechange_middle(sess, workingPtr);
- else
- workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, family, subtype, workingPtr);
- } else if (family == 0x000e) {
- if (subtype == 0x0002)
- workingPtr->handled = aim_chat_parse_infoupdate(sess, workingPtr);
- else if (subtype == 0x0003)
- workingPtr->handled = aim_chat_parse_joined(sess, workingPtr);
- else if (subtype == 0x0004)
- workingPtr->handled = aim_chat_parse_leave(sess, workingPtr);
- else if (subtype == 0x0006)
- workingPtr->handled = aim_chat_parse_incoming(sess, workingPtr);
- else
- printf("Chat: unknown snac %04x/%04x\n", family, subtype);
- } else {
- printf("Chat: unknown snac %04x/%04x\n", family, subtype);
- workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_DEFAULT, workingPtr);
- }
- break;
- }
- case AIM_CONN_TYPE_RENDEZVOUS: {
- /* make sure that we only get OFT frames on these connections */
- if (workingPtr->hdrtype != AIM_FRAMETYPE_OFT) {
- printf("faim: internal error: non-OFT frames on OFT connection\n");
- workingPtr->handled = 1; /* get rid of it */
- break;
- }
-
- /* XXX: implement this */
- printf("faim: OFT frame!\n");
-
- break;
- }
- case AIM_CONN_TYPE_RENDEZVOUS_OUT: {
- /* not possible */
- break;
+
+ } else if (family == 0x000e) {
+
+ if (subtype == 0x0002)
+ workingPtr->handled = aim_chat_parse_infoupdate(sess, workingPtr);
+ else if (subtype == 0x0003)
+ workingPtr->handled = aim_chat_parse_joined(sess, workingPtr);
+ else if (subtype == 0x0004)
+ workingPtr->handled = aim_chat_parse_leave(sess, workingPtr);
+ else if (subtype == 0x0006)
+ workingPtr->handled = aim_chat_parse_incoming(sess, workingPtr);
+
+ } else if (family == 0x0013) {
+
+ faimdprintf(sess, 0, "lalala: 0x%04x/0x%04x\n", family, subtype);
+
+ } else if (family == 0x0017) { /* New login protocol */
+
+ if (subtype == 0x0001)
+ workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, 0x0017, 0x0001, workingPtr);
+ else if (subtype == 0x0003)
+ workingPtr->handled = aim_authparse(sess, workingPtr);
+ else if (subtype == 0x0007)
+ workingPtr->handled = aim_authkeyparse(sess, workingPtr);
+ else
+ workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, 0x0017, 0xffff, workingPtr);
+
+ } else if (family == AIM_CB_FAM_SPECIAL) {
+
+ workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, family, subtype, workingPtr);
+
}
- default:
- printf("\ninternal error: unknown connection type (very bad.) (type = %d, fd = %d, commandlen = %02x)\n\n", workingPtr->conn->type, workingPtr->conn->fd, workingPtr->commandlen);
- workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_UNKNOWN, workingPtr);
- break;
- }
+
+ /* Try it raw and see if we can get it to happen... */
+ if (!workingPtr->handled) /* XXX this is probably bad. */
+ workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, family, subtype, workingPtr);
+
}
}
memset(sn, 0, sizeof(sn));
strncpy(sn, (char *)command->data+i, snlen);
- if ((userfunc = aim_callhandler(command->conn, 0x0004, 0x000c)))
+ if ((userfunc = aim_callhandler(sess, command->conn, 0x0004, 0x000c)))
ret = userfunc(sess, command, type, sn);
return ret;
maxavg = aimutil_get32(command->data+i);
i += 4;
- if ((userfunc = aim_callhandler(command->conn, 0x0001, 0x000a)))
+ if ((userfunc = aim_callhandler(sess, command->conn, 0x0001, 0x000a)))
ret = userfunc(sess, command, code, rateclass, windowsize, clear, alert, limit, disconnect, currentavg, maxavg);
return ret;
memset(&userinfo, 0, sizeof(struct aim_userinfo_s));
if (command->commandlen-i)
- i += aim_extractuserinfo(command->data+i, &userinfo);
+ i += aim_extractuserinfo(sess, command->data+i, &userinfo);
- if ((userfunc = aim_callhandler(command->conn, 0x0001, 0x0010)))
+ if ((userfunc = aim_callhandler(sess, command->conn, 0x0001, 0x0010)))
ret = userfunc(sess, command, newevil, &userinfo);
return ret;
return ret;
}
- userfunc = aim_callhandler(command->conn, 0x0001, 0x0013);
+ userfunc = aim_callhandler(sess, command->conn, 0x0001, 0x0013);
if (userfunc)
ret = userfunc(sess, command, id, msg);
for (i = 0; i < famcount; i++)
families[i] = aimutil_get16(command->data+((i*2)+10));
- if ((userfunc = aim_callhandler(command->conn, 0x0001, 0x0003)))
+ if ((userfunc = aim_callhandler(sess, command->conn, 0x0001, 0x0003)))
ret = userfunc(sess, command, famcount, families);
free(families);
status = aimutil_get16(command->data+10);
- if ((userfunc = aim_callhandler(command->conn, 0x0007, 0x0007)))
+ if ((userfunc = aim_callhandler(sess, command->conn, 0x0007, 0x0007)))
ret = userfunc(sess, command, status);
return ret;
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)))
+ if ((userfunc = aim_callhandler(sess, command->conn, 0x0007, subtype)))
userfunc(sess, command, perms, tlv->type, tlv->length, tlv->value, str);
if (tlv)
vercount = (command->commandlen-10)/4;
- if ((userfunc = aim_callhandler(command->conn, 0x0001, 0x0018)))
+ if ((userfunc = aim_callhandler(sess, command->conn, 0x0001, 0x0018)))
ret = userfunc(sess, command, vercount, command->data+10);
return ret;
* Chat hack.
*
*/
- if ((userfunc = aim_callhandler(command->conn, 0x0001, 0x0005)))
+ if ((userfunc = aim_callhandler(sess, command->conn, 0x0001, 0x0005)))
ret = userfunc(sess, command, serviceid, ip, cookie, sess->pendingjoin, (int)sess->pendingjoinexchange);
free(sess->pendingjoin);
sess->pendingjoin = NULL;
} else if (!serviceid || !ip || !cookie) { /* yeep! */
ret = 1;
} else {
- if ((userfunc = aim_callhandler(command->conn, 0x0001, 0x0005)))
+ if ((userfunc = aim_callhandler(sess, command->conn, 0x0001, 0x0005)))
ret = userfunc(sess, command, serviceid, ip, cookie);
}
if (!sess || !command)
return 1;
- faimdprintf(1, "\nRecieved unknown packet:");
+ faimdprintf(sess, 1, "\nRecieved unknown packet:");
for (i = 0; i < command->commandlen; i++)
{
if ((i % 8) == 0)
- faimdprintf(1, "\n\t");
+ faimdprintf(sess, 1, "\n\t");
- faimdprintf(1, "0x%2x ", command->data[i]);
+ faimdprintf(sess, 1, "0x%2x ", command->data[i]);
}
- faimdprintf(1, "\n\n");
+ faimdprintf(sess, 1, "\n\n");
return 1;
}
rxcallback_t userfunc = NULL;
int ret = 1;
+ /* Used only by the older login protocol */
+ /* XXX remove this special case? */
+ if (command->conn->type == AIM_CONN_TYPE_AUTH)
+ return aim_authparse(sess, command);
+
tlvlist = aim_readtlvchain(command->data, command->commandlen);
if (aim_gettlv(tlvlist, 0x0009, 1))
if (aim_gettlv(tlvlist, 0x000b, 1))
msg = aim_gettlv_str(tlvlist, 0x000b, 1);
- if ((userfunc = aim_callhandler(command->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR)))
+ if ((userfunc = aim_callhandler(sess, command->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR)))
ret = userfunc(sess, command, code, msg);
aim_freetlvchain(&tlvlist);
if (command->commandlen > 10)
error = aimutil_get16(command->data+10);
- if ((userfunc = aim_callhandler(command->conn, family, subtype)))
+ if ((userfunc = aim_callhandler(sess, command->conn, family, subtype)))
ret = userfunc(sess, command, error);
return ret;