X-Git-Url: http://andersk.mit.edu/gitweb/libfaim.git/blobdiff_plain/871e2fd07a6381b9e2dcacc27608541ca826e3d6..9dbda50b270a3c43faabc65753a1b2d26e628efc:/aim_rxhandlers.c diff --git a/aim_rxhandlers.c b/aim_rxhandlers.c index 4f5cf74..df0c499 100644 --- a/aim_rxhandlers.c +++ b/aim_rxhandlers.c @@ -228,14 +228,14 @@ faim_export int aim_clearhandlers(struct aim_conn_t *conn) if (!conn) return -1; - cur = conn->handlerlist; - while(cur) { + for (cur = conn->handlerlist; cur; ) { struct aim_rxcblist_t *tmp; tmp = cur->next; free(cur); cur = tmp; } + conn->handlerlist = NULL; return 0; } @@ -343,16 +343,17 @@ faim_export int aim_rxdispatch(struct aim_session_t *sess) workingPtr->handled = 1; break; case AIM_CONN_TYPE_AUTH: { - u_long head; + unsigned long head; head = aimutil_get32(workingPtr->data); - if (head == 0x00000001) { + if ((head == 0x00000001) && (workingPtr->commandlen == 4)) { faimdprintf(1, "got connection ack on auth line\n"); - workingPtr->handled = 1; - } else if (workingPtr->hdr.oscar.type == 0x0004) { + 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 { - u_short family,subtype; + unsigned short family,subtype; family = aimutil_get16(workingPtr->data); subtype = aimutil_get16(workingPtr->data+2); @@ -404,7 +405,7 @@ faim_export int aim_rxdispatch(struct aim_session_t *sess) switch (family) { case 0x0000: /* not really a family, but it works */ if (subtype == 0x0001) - workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, 0x0000, 0x0001, workingPtr); + 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; @@ -540,10 +541,9 @@ faim_export int aim_rxdispatch(struct aim_session_t *sess) u_short subtype; family = aimutil_get16(workingPtr->data); subtype= aimutil_get16(workingPtr->data+2); - - if ((family == 0x0002) && (subtype == 0x0006)) { - workingPtr->handled = 1; - aim_conn_setstatus(workingPtr->conn, AIM_CONN_STATUS_READY); + + 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 == 0x000d) && (subtype == 0x0009)) { workingPtr->handled = aim_chatnav_parse_info(sess, workingPtr); } else { @@ -557,9 +557,9 @@ faim_export int aim_rxdispatch(struct aim_session_t *sess) family = aimutil_get16(workingPtr->data); subtype= aimutil_get16(workingPtr->data+2); - if ((family == 0x0000) && (subtype == 0x00001)) - workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, 0x0000, 0x0001, workingPtr); - else 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) { if (subtype == 0x0001) workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, 0x0001, 0x0001, workingPtr); else if (subtype == 0x0003) @@ -781,9 +781,10 @@ faim_internal int aim_handleredirect_middle(struct aim_session_t *sess, */ userfunc = aim_callhandler(command->conn, 0x0001, 0x0005); if (userfunc) - ret = userfunc(sess, command, serviceid, ip, cookie, sess->pendingjoin); + ret = userfunc(sess, command, serviceid, ip, cookie, sess->pendingjoin, (int)sess->pendingjoinexchange); free(sess->pendingjoin); sess->pendingjoin = NULL; + sess->pendingjoinexchange = 0; } else { @@ -803,6 +804,9 @@ faim_internal int aim_parse_unknown(struct aim_session_t *sess, { u_int i = 0; + if (!sess || !command) + return 1; + faimdprintf(1, "\nRecieved unknown packet:"); for (i = 0; i < command->commandlen; i++)