X-Git-Url: http://andersk.mit.edu/gitweb/libfaim.git/blobdiff_plain/d410cf58c1b99101922ced3773b50c72e1dbfe5d..8722e78220c0ae049753eb49db99ebf1216aff40:/utils/faimtest/faimtest.c diff --git a/utils/faimtest/faimtest.c b/utils/faimtest/faimtest.c index 2ad710b..041b08f 100644 --- a/utils/faimtest/faimtest.c +++ b/utils/faimtest/faimtest.c @@ -306,12 +306,10 @@ int main(int argc, char **argv) cmd_gotkey(); } else { if (waitingconn->type == AIM_CONN_TYPE_RENDEZVOUS_OUT) { -#if 0 if (aim_handlerendconnect(&aimsess, waitingconn) < 0) { dprintf("connection error (rend out)\n"); aim_conn_kill(&aimsess, &waitingconn); } -#endif } else { if (aim_get_command(&aimsess, waitingconn) >= 0) { aim_rxdispatch(&aimsess); @@ -319,7 +317,8 @@ int main(int argc, char **argv) dvprintf("connection error (type 0x%04x:0x%04x)\n", waitingconn->type, waitingconn->subtype); /* we should have callbacks for all these, else the library will do the conn_kill for us. */ if (waitingconn->type == AIM_CONN_TYPE_RENDEZVOUS) { - dprintf("connection error: rendezvous connection. you forgot register a disconnect callback, right?\n"); + if (waitingconn->subtype == AIM_CONN_SUBTYPE_OFT_DIRECTIM) + dvprintf("disconnected from %s\n", aim_directim_getsn(waitingconn)); aim_conn_kill(&aimsess, &waitingconn); } else aim_conn_kill(&aimsess, &waitingconn); @@ -402,7 +401,6 @@ int faimtest_parse_connerr(aim_session_t *sess, aim_frame_t *fr, ...) return 1; } -#if 0 static int faimtest_rateresp_auth(aim_session_t *sess, aim_frame_t *fr, ...) { @@ -428,9 +426,6 @@ int faimtest_accountconfirm(aim_session_t *sess, aim_frame_t *fr, ...) return 1; } - -#endif - #if 0 /* * This kind of function is really not legal in the new bstream way... @@ -457,6 +452,28 @@ int faimtest_parse_unknown(aim_session_t *sess, aim_frame_t *fr, ...) } #endif +static int faimtest_infochange(aim_session_t *sess, aim_frame_t *fr, ...) +{ + fu16_t change = 0, perms, type; + int length, str; + char *val; + va_list ap; + + va_start(ap, fr); + change = va_arg(ap, int); + perms = va_arg(ap, fu16_t); + type = va_arg(ap, fu16_t); + length = va_arg(ap, int); + val = va_arg(ap, char *); + str = va_arg(ap, int); + va_end(ap); + + dvprintf("info%s: perms = %d, type = %x, length = %d, val = %s\n", change?" change":"", perms, type, length, str?val:"(not string)"); + + return 1; +} + + int faimtest_handleredirect(aim_session_t *sess, aim_frame_t *fr, ...) { va_list ap; @@ -487,7 +504,6 @@ int faimtest_handleredirect(aim_session_t *sess, aim_frame_t *fr, ...) } #endif } else if (serviceid == 0x0007) { /* Authorizer */ -#if 0 aim_conn_t *tstconn; tstconn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, ip); @@ -497,8 +513,8 @@ int faimtest_handleredirect(aim_session_t *sess, aim_frame_t *fr, ...) aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_FLAPVER, faimtest_flapversion, 0); aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNCOMPLETE, faimtest_conncomplete, 0); aim_conn_addhandler(sess, tstconn, 0x0001, 0x0003, faimtest_serverready, 0); - aim_conn_addhandler(sess, tstconn, 0x0001, 0x0007, faimtest_rateresp, 0); /* rate info */ - aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_GEN, 0x0018, faimtest_hostversions, 0); + aim_conn_addhandler(sess, tstconn, 0x0001, 0x0007, faimtest_rateresp_auth, 0); /* rate info */ + //aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_GEN, 0x0018, faimtest_hostversions, 0); aim_conn_addhandler(sess, tstconn, 0x0007, 0x0007, faimtest_accountconfirm, 0); aim_conn_addhandler(sess, tstconn, 0x0007, 0x0003, faimtest_infochange, 0); aim_conn_addhandler(sess, tstconn, 0x0007, 0x0005, faimtest_infochange, 0); @@ -506,7 +522,6 @@ int faimtest_handleredirect(aim_session_t *sess, aim_frame_t *fr, ...) aim_auth_sendcookie(sess, tstconn, cookie); dprintf("sent cookie to authorizer host\n"); } -#endif } else if (serviceid == 0x000d) { /* ChatNav */ chatnav_redirect(sess, ip, cookie); @@ -543,7 +558,7 @@ static int faimtest_rateresp_bos(aim_session_t *sess, aim_frame_t *fr, ...) aim_bos_ackrateresp(sess, fr->conn); /* ack rate info response */ aim_bos_reqpersonalinfo(sess, fr->conn); aim_bos_reqlocaterights(sess, fr->conn); - aim_bos_setprofile(sess, fr->conn, profile, awaymsg, AIM_CAPS_BUDDYICON | AIM_CAPS_CHAT | AIM_CAPS_GETFILE | AIM_CAPS_SENDFILE | AIM_CAPS_IMIMAGE /*| AIM_CAPS_GAMES | AIM_CAPS_SAVESTOCKS*/); + aim_bos_setprofile(sess, fr->conn, profile, awaymsg, AIM_CAPS_BUDDYICON | AIM_CAPS_CHAT | AIM_CAPS_GETFILE | AIM_CAPS_SENDFILE | AIM_CAPS_IMIMAGE | AIM_CAPS_GAMES | AIM_CAPS_SAVESTOCKS | AIM_CAPS_SENDBUDDYLIST); aim_bos_reqbuddyrights(sess, fr->conn); /* send the buddy list and profile (required, even if empty) */ @@ -980,6 +995,20 @@ static int faimtest_handlecmd(aim_session_t *sess, aim_conn_t *conn, struct aim_ aim_send_im_ext(sess, conn, &args); + } else if (strstr(tmpstr, "havefeat")) { + struct aim_sendimext_args args; + static const char featmsg[] = {"I have nifty features."}; + fu8_t features[] = {0x01, 0x01, 0x01, 0x02, 0x42, 0x43, 0x44, 0x45}; + + args.destsn = userinfo->sn; + args.flags = AIM_IMFLAGS_CUSTOMFEATURES; + args.msg = featmsg; + args.msglen = strlen(featmsg); + args.features = features; + args.featureslen = sizeof(features); + + aim_send_im_ext(sess, conn, &args); + } else if (strstr(tmpstr, "sendicon") && priv->buddyicon) { aim_send_icon(sess, conn, userinfo->sn, priv->buddyicon, priv->buddyiconlen, priv->buddyiconstamp, priv->buddyiconsum); @@ -1042,13 +1071,13 @@ static int faimtest_handlecmd(aim_session_t *sess, aim_conn_t *conn, struct aim_ aim_getinfo(sess, conn, "midendian", AIM_GETINFO_GENERALINFO); aim_getinfo(sess, conn, "midendian", AIM_GETINFO_AWAYMESSAGE); - } else if (!strncmp(tmpstr, "open directim", 13)) { + } else if (strstr(tmpstr, "open directim")) { - directim_start(sess, conn, (strlen(tmpstr) < 14)?userinfo->sn:tmpstr+14); + directim_start(sess, conn, userinfo->sn); - } else if(!(strncmp(tmpstr, "lookup", 6))) { + } else if(strstr(tmpstr, "lookup")) { - aim_usersearch_address(sess, conn, tmpstr+7); + aim_usersearch_address(sess, conn, "mid@auk.cx"); } else if (!strncmp(tmpstr, "reqsendmsg", 10)) { @@ -1105,6 +1134,7 @@ static int faimtest_handlecmd(aim_session_t *sess, aim_conn_t *conn, struct aim_ */ static int faimtest_parse_incoming_im_chan1(aim_session_t *sess, aim_conn_t *conn, struct aim_userinfo_s *userinfo, va_list ap) { + struct faimtest_priv *priv = (struct faimtest_priv *)sess->aux_data; char *tmpstr; struct aim_incomingim_ch1_args *args; int clienttype = AIM_CLIENTTYPE_UNKNOWN; @@ -1113,7 +1143,7 @@ static int faimtest_parse_incoming_im_chan1(aim_session_t *sess, aim_conn_t *con args = va_arg(ap, struct aim_incomingim_ch1_args *); va_end(ap); - clienttype = aim_fingerprintclient(args->fingerprint, args->finlen); + clienttype = aim_fingerprintclient(args->features, args->featureslen); dvprintf("faimtest: icbm: sn = \"%s\"\n", userinfo->sn); dvprintf("faimtest: icbm: probable client type: %d\n", clienttype); @@ -1209,6 +1239,9 @@ static int faimtest_parse_incoming_im_chan1(aim_session_t *sess, aim_conn_t *con } + if (priv->buddyicon && (args->icbmflags & AIM_IMFLAGS_BUDDYREQ)) + aim_send_icon(sess, conn, userinfo->sn, priv->buddyicon, priv->buddyiconlen, priv->buddyiconstamp, priv->buddyiconsum); + return 1; } @@ -1272,7 +1305,7 @@ static int faimtest_parse_incoming_im_chan2(aim_session_t *sess, aim_conn_t *con } else if (args->reqclass == AIM_CAPS_BUDDYICON) { - dvprintf("faimtest: Buddy Icon from %s, length = %u\n", userinfo->sn, args->info.icon.length); + dvprintf("faimtest: Buddy Icon from %s, length = %lu\n", userinfo->sn, args->info.icon.length); } else { @@ -1305,31 +1338,6 @@ static int faimtest_parse_incoming_im(aim_session_t *sess, aim_frame_t *fr, ...) return 1; } -#ifdef MID_REWROTE_ALL_THE_CRAP -static int faimtest_infochange(aim_session_t *sess, aim_frame_t *fr, ...) -{ - fu16_t change = 0, perms, type; - int length, str; - char *val; - va_list ap; - - va_start(ap, fr); - perms = va_arg(ap, fu16_t); - type = va_arg(ap, fu16_t); - length = va_arg(ap, int); - val = va_arg(ap, char *); - str = va_arg(ap, int); - va_end(ap); - - if (aimutil_get16(command->data+2) == 0x0005) - change = 1; - - dvprintf("info%s: perms = %d, type = %x, length = %d, val = %s\n", change?" change":"", perms, type, length, str?val:"(not string)"); - - return 1; -} -#endif - static int faimtest_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) { struct aim_userinfo_s *userinfo;