+ return 1;
+}
+
+int faimtest_chatnav_info(struct aim_session_t *sess, struct command_rx_struct *command, ...)
+{
+ unsigned short type;
+ va_list ap;
+
+ va_start(ap, command);
+ type = va_arg(ap, int);
+
+ switch(type) {
+ case 0x0002: {
+ int maxrooms;
+ struct aim_chat_exchangeinfo *exchanges;
+ int exchangecount,i = 0;
+
+ maxrooms = va_arg(ap, int);
+ exchangecount = va_arg(ap, int);
+ exchanges = va_arg(ap, struct aim_chat_exchangeinfo *);
+ va_end(ap);
+
+ printf("faimtest: chat info: Chat Rights:\n");
+ printf("faimtest: chat info: \tMax Concurrent Rooms: %d\n", maxrooms);
+
+ printf("faimtest: chat info: \tExchange List: (%d total)\n", exchangecount);
+ while (i < exchangecount) {
+ printf("faimtest: chat info: \t\t%x: %s (%s/%s)\n",
+ exchanges[i].number,
+ exchanges[i].name,
+ exchanges[i].charset1,
+ exchanges[i].lang1);
+ i++;
+ }
+
+ }
+ break;
+ case 0x0008: {
+ char *fqcn, *name, *ck;
+ unsigned short instance, flags, maxmsglen, maxoccupancy, unknown, exchange;
+ unsigned char createperms;
+ unsigned long createtime;
+
+ fqcn = va_arg(ap, char *);
+ instance = va_arg(ap, int);
+ exchange = va_arg(ap, int);
+ flags = va_arg(ap, int);
+ createtime = va_arg(ap, unsigned long);
+ maxmsglen = va_arg(ap, int);
+ maxoccupancy = va_arg(ap, int);
+ createperms = va_arg(ap, int);
+ unknown = va_arg(ap, int);
+ name = va_arg(ap, char *);
+ ck = va_arg(ap, char *);
+ va_end(ap);
+
+ printf("faimtest: recieved room create reply for %s/0x%04x\n", fqcn, exchange);
+ }
+ break;
+ default:
+ va_end(ap);
+ printf("faimtest: chatnav info: unknown type (%04x)\n", type);
+ }
+ return 1;
+}
+
+int faimtest_parse_connerr(struct aim_session_t *sess, struct command_rx_struct *command, ...)
+{
+ va_list ap;
+ unsigned short code;
+ char *msg = NULL;
+
+ va_start(ap, command);
+ code = va_arg(ap, int);
+ msg = va_arg(ap, char *);
+ va_end(ap);
+
+ printf("faimtest: connerr: Code 0x%04x: %s\n", code, msg);
+ aim_conn_kill(sess, &command->conn); /* this will break the main loop */
+
+ return 1;
+}
+
+int faimtest_debugconn_connect(struct aim_session_t *sess, struct command_rx_struct *command, ...)
+{
+ printf("faimtest: connecting to an aimdebugd!\n");
+
+ /* convert the authorizer connection to a BOS connection */
+ command->conn->type = AIM_CONN_TYPE_BOS;
+
+ aim_conn_addhandler(sess, command->conn, AIM_CB_FAM_MSG, AIM_CB_MSG_INCOMING, faimtest_parse_incoming_im, 0);
+
+ /* tell the aimddebugd we're ready */
+ aim_debugconn_sendconnect(sess, command->conn);
+
+ /* go right into main loop (don't open a BOS connection, etc) */
+ return 1;
+}
+
+/*
+ * Recieved in response to an IM sent with the AIM_IMFLAGS_ACK option.
+ */
+int faimtest_parse_msgack(struct aim_session_t *sess, struct command_rx_struct *command, ...)
+{
+ va_list ap;
+ unsigned short type;
+ char *sn = NULL;
+
+ va_start(ap, command);
+ type = va_arg(ap, int);
+ sn = va_arg(ap, char *);
+ va_end(ap);
+
+ printf("faimtest: msgack: 0x%04x / %s\n", type, sn);
+
+ return 1;
+}
+
+#ifdef FILESUPPORT
+int faimtest_getfile_filereq(struct aim_session_t *ses, struct command_rx_struct *command, ...)
+{
+ va_list ap;
+ struct aim_conn_t *oftconn;
+ struct aim_fileheader_t *fh;
+ char *cookie;
+
+ va_start(ap, command);
+ oftconn = va_arg(ap, struct aim_conn_t *);
+ fh = va_arg(ap, struct aim_fileheader_t *);
+ cookie = va_arg(ap, char *);
+ va_end(ap);
+
+ printf("faimtest: request for file %s.\n", fh->name);
+
+ return 1;
+}
+
+
+int faimtest_getfile_filesend(struct aim_session_t *sess, struct command_rx_struct *command, ...)
+{
+ va_list ap;
+ struct aim_conn_t *oftconn;
+ struct aim_fileheader_t *fh;
+ char *path, *cookie;
+
+ FILE *file;
+
+ va_start(ap, command);
+ oftconn = va_arg(ap, struct aim_conn_t *);
+ fh = va_arg(ap, struct aim_fileheader_t *);
+ cookie = va_arg(ap, char *);
+ va_end(ap);
+
+ printf("faimtest: sending file %s.\n", fh->name);
+
+ if( (path = (char *)calloc(1, strlen(sess->oft.listingdir) +strlen(fh->name)+2)) == NULL) {
+ perror("calloc:");
+ printf("faimtest: error in calloc of path\n");
+ return 0; /* XXX: no idea what winaim expects here =) */
+ }
+
+ snprintf(path, strlen(sess->oft.listingdir)+strlen(fh->name)+2, "%s/%s", sess->oft.listingdir, fh->name);
+
+
+ if( (file = fopen(path, "r")) == NULL) {
+ printf("faimtest: getfile_send fopen failed for %s. damn.\n", path);
+ return 0;
+ }
+
+ if (aim_getfile_send(oftconn, file, fh) == -1) {
+ printf("faimtest: getfile_send failed. damn.\n");
+ } else {
+ printf("faimtest: looks like getfile went clean\n");
+ }
+
+ free(fh);
+ return 1;
+}
+
+int faimtest_getfile_complete(struct aim_session_t *sess, struct command_rx_struct *command, ...)
+{
+ va_list ap;
+ struct aim_conn_t *conn;
+ struct aim_fileheader_t *fh;
+
+ va_start(ap, command);
+ conn = va_arg(ap, struct aim_conn_t *);
+ fh = va_arg(ap, struct aim_fileheader_t *);
+ va_end(ap);
+
+ printf("faimtest: completed file transfer for %s.\n", fh->name);
+
+ /* aim_conn_kill(sess, &conn); */ /* we'll let winaim close the conn */
+ return 1;
+}
+
+int faimtest_getfile_disconnect(struct aim_session_t *sess, struct command_rx_struct *command, ...)
+{
+ va_list ap;
+ struct aim_conn_t *conn;
+ char *sn;
+
+ va_start(ap, command);
+ conn = va_arg(ap, struct aim_conn_t *);
+ sn = va_arg(ap, char *);
+ va_end(ap);
+
+ aim_conn_kill(sess, &conn);
+
+ printf("faimtest: getfile: disconnected from %s\n", sn);
+ return 1;