+ struct faimtest_priv *priv = (struct faimtest_priv *)sess->aux_data;
+
+ if (!strncmp(tmpstr, "disconnect", 10)) {
+
+ logout(sess);
+
+ } else if (strstr(tmpstr, "goodday")) {
+
+ aim_send_im(sess, conn, userinfo->sn, AIM_IMFLAGS_ACK, "Good day to you too.");
+
+ } else if (strstr(tmpstr, "haveicon") && priv->buddyicon) {
+ struct aim_sendimext_args args;
+ static const char iconmsg[] = {"I have an icon"};
+
+ args.destsn = userinfo->sn;
+ args.flags = AIM_IMFLAGS_HASICON;
+ args.msg = iconmsg;
+ args.msglen = strlen(iconmsg);
+ args.iconlen = priv->buddyiconlen;
+ args.iconstamp = priv->buddyiconstamp;
+ args.iconsum = priv->buddyiconsum;
+
+ aim_send_im_ext(sess, conn, &args);
+
+ } else if (strstr(tmpstr, "sendbin")) {
+ struct aim_sendimext_args args;
+ static const unsigned char data[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
+ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
+ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
+ };
+
+ /*
+ * I put this here as a demonstration of how to send
+ * arbitrary binary data via OSCAR ICBM's without the need
+ * for escape or baseN encoding of any sort.
+ *
+ * Apparently if you set the charset to something WinAIM
+ * doesn't recognize, it will completly ignore the message.
+ * That is, it will not display anything in the conversation
+ * window for the user that recieved it.
+ *
+ * HOWEVER, if they do not have a conversation window open
+ * for you, a new one will be created, but it will not have
+ * any messages in it. Therefore sending these things could
+ * be a great way to seemingly subliminally convince people
+ * to talk to you...
+ *
+ */
+ args.destsn = userinfo->sn;
+ args.flags = AIM_IMFLAGS_CUSTOMCHARSET;
+ args.charset = args.charsubset = 0x4242;
+ args.msg = data;
+ args.msglen = sizeof(data);
+
+ aim_send_im_ext(sess, conn, &args);
+
+ } else if (strstr(tmpstr, "sendmulti")) {
+ struct aim_sendimext_args args;
+ aim_mpmsg_t mpm;
+ static const fu16_t unidata[] = { /* "UNICODE." */
+ 0x0055, 0x004e, 0x0049, 0x0043,
+ 0x004f, 0x0044, 0x0045, 0x002e,
+ };
+ static const int unidatalen = 8;
+
+ /*
+ * This is how multipart messages should be sent.
+ *
+ * This should render as:
+ * "Part 1, ASCII. UNICODE.Part 3, ASCII. "
+ */
+
+ aim_mpmsg_init(sess, &mpm);
+
+ aim_mpmsg_addascii(sess, &mpm, "Part 1, ASCII. ");
+ aim_mpmsg_addunicode(sess, &mpm, unidata, unidatalen);
+ aim_mpmsg_addascii(sess, &mpm, "Part 3, ASCII. ");
+
+ args.destsn = userinfo->sn;
+ args.flags = AIM_IMFLAGS_MULTIPART;
+ args.mpmsg = &mpm;
+
+ aim_send_im_ext(sess, conn, &args);
+
+ aim_mpmsg_free(sess, &mpm);
+
+ } else if (strstr(tmpstr, "sendprebin")) {
+ static const unsigned char data[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
+ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
+ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
+ };
+ struct aim_sendimext_args args;
+ aim_mpmsg_t mpm;
+
+ /*
+ * This demonstrates sending a human-readable preamble,
+ * and then arbitrary binary data.
+ *
+ * This means that you can very inconspicuously send binary
+ * attachments to other users. In WinAIM, this appears as
+ * though it only had the ASCII portion.
+ *
+ */
+
+ aim_mpmsg_init(sess, &mpm);
+
+ aim_mpmsg_addascii(sess, &mpm, "This message has binary data.");
+ aim_mpmsg_addraw(sess, &mpm, 0x4242, 0x4242, data, sizeof(data));
+
+ args.destsn = userinfo->sn;
+ args.flags = AIM_IMFLAGS_MULTIPART;
+ args.mpmsg = &mpm;
+
+ aim_send_im_ext(sess, conn, &args);
+
+ aim_mpmsg_free(sess, &mpm);
+
+ } 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);
+
+ } else if (strstr(tmpstr, "warnme")) {
+
+ dprintf("faimtest: icbm: sending non-anon warning\n");
+ aim_send_warning(sess, conn, userinfo->sn, 0);
+
+ } else if (strstr(tmpstr, "anonwarn")) {
+
+ dprintf("faimtest: icbm: sending anon warning\n");
+ aim_send_warning(sess, conn, userinfo->sn, AIM_WARN_ANON);
+
+ } else if (strstr(tmpstr, "setdirectoryinfo")) {
+
+ dprintf("faimtest: icbm: sending backwards profile data\n");
+ aim_setdirectoryinfo(sess, conn, "tsrif", "elddim", "tsal", "nediam", "emankcin", "teerts", "ytic", "etats", "piz", 0, 1);
+
+ } else if (strstr(tmpstr, "setinterests")) {
+
+ dprintf("faimtest: icbm: setting fun interests\n");
+ aim_setuserinterests(sess, conn, "interest1", "interest2", "interest3", "interest4", "interest5", 1);
+
+ } else if (!strncmp(tmpstr, "getfile", 7)) {
+
+ if (!priv->ohcaptainmycaptain) {
+
+ aim_send_im(sess, conn, userinfo->sn, AIM_IMFLAGS_ACK, "I have no owner!");
+
+ } else
+ getfile_start(sess, conn, (strlen(tmpstr) < 8)?priv->ohcaptainmycaptain:tmpstr+8);
+
+ } else if (!strncmp(tmpstr, "open chatnav", 12)) {
+
+ aim_bos_reqservice(sess, conn, AIM_CONN_TYPE_CHATNAV);
+
+ } else if (!strncmp(tmpstr, "create", 6)) {
+
+ aim_chatnav_createroom(sess,aim_getconn_type(sess, AIM_CONN_TYPE_CHATNAV), (strlen(tmpstr) < 7)?"WorldDomination":tmpstr+7, 0x0004);
+
+ } else if (!strncmp(tmpstr, "close chatnav", 13)) {
+ aim_conn_t *chatnavconn;
+
+ if ((chatnavconn = aim_getconn_type(sess, AIM_CONN_TYPE_CHATNAV)))
+ aim_conn_kill(sess, &chatnavconn);
+
+ } else if (!strncmp(tmpstr, "join", 4)) {
+
+ aim_chat_join(sess, conn, 0x0004, "worlddomination", 0x0000);
+
+ } else if (!strncmp(tmpstr, "leave", 5)) {
+
+ aim_chat_leaveroom(sess, "worlddomination");
+
+ } else if (!strncmp(tmpstr, "getinfo", 7)) {
+
+ aim_getinfo(sess, conn, "75784102", AIM_GETINFO_GENERALINFO);
+ aim_getinfo(sess, conn, "15853637", AIM_GETINFO_AWAYMESSAGE);
+ aim_getinfo(sess, conn, "midendian", AIM_GETINFO_GENERALINFO);
+ aim_getinfo(sess, conn, "midendian", AIM_GETINFO_AWAYMESSAGE);
+
+ } else if (strstr(tmpstr, "open directim")) {
+
+ directim_start(sess, conn, userinfo->sn);
+
+ } else if(strstr(tmpstr, "lookup")) {
+
+ aim_usersearch_address(sess, conn, "mid@auk.cx");
+
+ } else if (!strncmp(tmpstr, "reqsendmsg", 10)) {
+
+ aim_send_im(sess, conn, priv->ohcaptainmycaptain, 0, "sendmsg 7900");
+
+ } else if (!strncmp(tmpstr, "reqauth", 7)) {
+
+ aim_bos_reqservice(sess, conn, AIM_CONN_TYPE_AUTH);
+
+ } else if (!strncmp(tmpstr, "reqconfirm", 10)) {
+
+ aim_auth_reqconfirm(sess, aim_getconn_type(sess, AIM_CONN_TYPE_AUTH));
+
+ } else if (!strncmp(tmpstr, "reqemail", 8)) {
+
+ aim_auth_getinfo(sess, aim_getconn_type(sess, AIM_CONN_TYPE_AUTH), 0x0011);
+
+ } else if (!strncmp(tmpstr, "changepass", 8)) {
+
+ aim_auth_changepasswd(sess, aim_getconn_type(sess, AIM_CONN_TYPE_AUTH), "NEWPASSWORD", "OLDPASSWORD");
+
+ } else if (!strncmp(tmpstr, "setemail", 8)) {
+
+ aim_auth_setemail(sess, aim_getconn_type(sess, AIM_CONN_TYPE_AUTH), "NEWEMAILADDRESS");
+
+ } else if (!strncmp(tmpstr, "sendmsg", 7)) {
+ int i;
+
+ i = atoi(tmpstr+8);
+ if (i < 10000) {
+ char *newbuf;
+ int z;
+
+ newbuf = malloc(i+1);
+ for (z = 0; z < i; z++)
+ newbuf[z] = (z % 10)+0x30;
+ newbuf[i] = '\0';
+ aim_send_im(sess, conn, userinfo->sn, 0, newbuf);
+ free(newbuf);
+ }
+
+ } else {
+
+ dprintf("unknown command.\n");
+ aim_add_buddy(sess, conn, userinfo->sn);
+
+ }
+
+ return 0;