From 355982c549cb58e2188751e073997e89785fbd49 Mon Sep 17 00:00:00 2001 From: mid Date: Tue, 12 Dec 2000 23:15:24 +0000 Subject: [PATCH] - Tue Dec 12 23:02:41 UTC 2000 - Got pissed off at sess->logininfo. Got rid of it. - Now pass all that stuff in as varargs, like it should be. - *** Look at the changes to faimtest. You'll also need to change anything in your code that references sess->logininfo to reference sess->sn instead. The rest of the other info is now unavailable (it was before, too, it just didnt look like it). - A few other minor cleanups. - Added aim_gettlv8/16/32, aim_puttlv_8, and aim_addtlvtochain_noval. - Added that short 0x004a TLV to the auth request, like WinAIM 4.3. --- CHANGES | 11 +++ aim_login.c | 136 ++++++++++++++++++++------------------ aim_tlv.c | 112 +++++++++++++++++++++++++++++++ faim/aim.h | 32 ++++----- utils/faimtest/faimtest.c | 96 +++++++++++++++------------ 5 files changed, 263 insertions(+), 124 deletions(-) diff --git a/CHANGES b/CHANGES index 5b00742..4f8bcf4 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,17 @@ No release numbers ------------------ + - Tue Dec 12 23:02:41 UTC 2000 + - Got pissed off at sess->logininfo. Got rid of it. + - Now pass all that stuff in as varargs, like it should be. + - *** Look at the changes to faimtest. You'll also need to + change anything in your code that references sess->logininfo + to reference sess->sn instead. The rest of the other info + is now unavailable (it was before, too, it just didnt look like it). + - A few other minor cleanups. + - Added aim_gettlv8/16/32, aim_puttlv_8, and aim_addtlvtochain_noval. + - Added that short 0x004a TLV to the auth request, like WinAIM 4.3. + - Mon Dec 4 23:46:35 UTC 2000 - Add exchange to the create response callback (doh!) diff --git a/aim_login.c b/aim_login.c index 51aedd4..4c4a2e6 100644 --- a/aim_login.c +++ b/aim_login.c @@ -132,6 +132,17 @@ faim_export int aim_request_login(struct aim_session_t *sess, * encode_password(). See that function for their * stupid method of doing it. * + * Latest WinAIM: + * clientstring = "AOL Instant Messenger (SM), version 4.3.2188/WIN32" + * major2 = 0x0109 + * major = 0x0400 + * minor = 0x0003 + * minor2 = 0x0000 + * build = 0x088c + * unknown = 0x00000086 + * lang = "en" + * country = "us" + * unknown4a = 0x01 */ faim_export int aim_send_login (struct aim_session_t *sess, struct aim_conn_t *conn, @@ -188,7 +199,9 @@ faim_export int aim_send_login (struct aim_session_t *sess, curbyte += aim_puttlv_32(newpacket->data+curbyte, 0x0014, clientinfo->unknown); curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0009, 0x0015); + curbyte += aim_puttlv_8(newpacket->data+curbyte, 0x004a, 0x01); } else { + /* Use very specific version numbers, to further indicate the hack. */ curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0016, 0x010a); curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0017, 0x0004); curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0018, 0x003c); @@ -272,7 +285,7 @@ static int aim_encode_password(const char *password, unsigned char *encoded) * It can be either an error or a success, depending on the * precense of certain TLVs. * - * The client should check the value of logininfo->errorcode. If + * The client should check the value passed as errorcode. If * its nonzero, there was an error. * */ @@ -281,10 +294,10 @@ faim_internal int aim_authparse(struct aim_session_t *sess, { struct aim_tlvlist_t *tlvlist; int ret = 1; - char *sn; rxcallback_t userfunc = NULL; - - memset(&sess->logininfo, 0x00, sizeof(sess->logininfo)); + char *sn = NULL, *bosip = NULL, *errurl = NULL, *email = NULL; + unsigned char *cookie = NULL; + int errorcode = 0, regstatus = 0; /* * Read block of TLVs. All further data is derived @@ -301,74 +314,69 @@ faim_internal int aim_authparse(struct aim_session_t *sess, /* * No matter what, we should have a screen name. */ - sn = aim_gettlv_str(tlvlist, 0x0001, 1); - strncpy(sess->logininfo.screen_name, sn, strlen(sn)); - free(sn); + memset(sess->sn, 0, sizeof(sess->sn)); + if (aim_gettlv(tlvlist, 0x0001, 1)) { + sn = aim_gettlv_str(tlvlist, 0x0001, 1); + strncpy(sess->sn, sn, sizeof(sess->sn)); + } /* * Check for an error code. If so, we should also * have an error url. */ - if (aim_gettlv(tlvlist, 0x0008, 1)) { - struct aim_tlv_t *errtlv; - errtlv = aim_gettlv(tlvlist, 0x0008, 1); - sess->logininfo.errorcode = aimutil_get16(errtlv->value); - sess->logininfo.errorurl = aim_gettlv_str(tlvlist, 0x0004, 1); - } - /* - * If we have both an IP number (0x0005) and a cookie (0x0006), - * then the login was successful. + if (aim_gettlv(tlvlist, 0x0008, 1)) + errorcode = aim_gettlv16(tlvlist, 0x0008, 1); + if (aim_gettlv(tlvlist, 0x0004, 1)) + errurl = aim_gettlv_str(tlvlist, 0x0004, 1); + + /* + * BOS server address. */ - else if (aim_gettlv(tlvlist, 0x0005, 1) && aim_gettlv(tlvlist, 0x0006, 1) - /*aim_gettlv(tlvlist, 0x0006, 1)->length*/) { + if (aim_gettlv(tlvlist, 0x0005, 1)) + bosip = aim_gettlv_str(tlvlist, 0x0005, 1); + + /* + * Authorization cookie. + */ + if (aim_gettlv(tlvlist, 0x0006, 1)) { struct aim_tlv_t *tmptlv; - /* - * IP address of BOS server. - */ - sess->logininfo.BOSIP = aim_gettlv_str(tlvlist, 0x0005, 1); - - /* - * Authorization Cookie - */ tmptlv = aim_gettlv(tlvlist, 0x0006, 1); - memcpy(sess->logininfo.cookie, tmptlv->value, AIM_COOKIELEN); - - /* - * The email address attached to this account - * Not available for ICQ logins. - */ - if (aim_gettlv(tlvlist, 0x0011, 1)) - sess->logininfo.email = aim_gettlv_str(tlvlist, 0x0011, 1); - - /* - * The registration status. (Not real sure what it means.) - * Not available for ICQ logins. - */ - if ((tmptlv = aim_gettlv(tlvlist, 0x0013, 1))) - sess->logininfo.regstatus = aimutil_get16(tmptlv->value); - + + if ((cookie = malloc(tmptlv->length))) + memcpy(cookie, tmptlv->value, tmptlv->length); } - userfunc = aim_callhandler(command->conn, 0x0017, 0x0003); + /* + * The email address attached to this account + * Not available for ICQ logins. + */ + if (aim_gettlv(tlvlist, 0x0011, 1)) + email = aim_gettlv_str(tlvlist, 0x0011, 1); + + /* + * The registration status. (Not real sure what it means.) + * Not available for ICQ logins. + */ + if (aim_gettlv(tlvlist, 0x0013, 1)) + regstatus = aim_gettlv16(tlvlist, 0x0013, 1); - if (userfunc) - ret = userfunc(sess, command); - aim_freetlvchain(&tlvlist); + if ((userfunc = aim_callhandler(command->conn, 0x0017, 0x0003))) + ret = userfunc(sess, command, sn, errorcode, errurl, regstatus, email, bosip, cookie); - if (sess->logininfo.BOSIP) { - free(sess->logininfo.BOSIP); - sess->logininfo.BOSIP = NULL; - } - if (sess->logininfo.email) { - free(sess->logininfo.email); - sess->logininfo.email = NULL; - } - if (sess->logininfo.errorurl) { - free(sess->logininfo.errorurl); - sess->logininfo.errorurl = NULL; - } + + if (sn) + free(sn); + if (bosip) + free(bosip); + if (errurl) + free(errurl); + if (email) + free(email); + if (cookie) + free(cookie); + aim_freetlvchain(&tlvlist); return ret; } @@ -409,7 +417,8 @@ faim_internal int aim_authkeyparse(struct aim_session_t *sess, struct command_rx */ faim_export unsigned long aim_sendauthresp(struct aim_session_t *sess, struct aim_conn_t *conn, - char *sn, char *bosip, + char *sn, int errorcode, + char *errorurl, char *bosip, char *cookie, char *email, int regstatus) { @@ -424,11 +433,11 @@ faim_export unsigned long aim_sendauthresp(struct aim_session_t *sess, if (sn) aim_addtlvtochain_str(&tlvlist, 0x0001, sn, strlen(sn)); else - aim_addtlvtochain_str(&tlvlist, 0x0001, sess->logininfo.screen_name, strlen(sess->logininfo.screen_name)); + aim_addtlvtochain_str(&tlvlist, 0x0001, sess->sn, strlen(sess->sn)); - if (sess->logininfo.errorcode) { - aim_addtlvtochain16(&tlvlist, 0x0008, sess->logininfo.errorcode); - aim_addtlvtochain_str(&tlvlist, 0x0004, sess->logininfo.errorurl, strlen(sess->logininfo.errorurl)); + if (errorcode) { + aim_addtlvtochain16(&tlvlist, 0x0008, errorcode); + aim_addtlvtochain_str(&tlvlist, 0x0004, errorurl, strlen(errorurl)); } else { aim_addtlvtochain_str(&tlvlist, 0x0005, bosip, strlen(bosip)); aim_addtlvtochain_str(&tlvlist, 0x0006, cookie, AIM_COOKIELEN); @@ -438,6 +447,7 @@ faim_export unsigned long aim_sendauthresp(struct aim_session_t *sess, tx->commandlen = aim_writetlvchain(tx->data, tx->commandlen, &tlvlist); tx->lock = 0; + return aim_tx_enqueue(sess, tx); } diff --git a/aim_tlv.c b/aim_tlv.c index b5f69a0..5279367 100644 --- a/aim_tlv.c +++ b/aim_tlv.c @@ -321,6 +321,41 @@ faim_export int aim_addtlvtochain_caps(struct aim_tlvlist_t **list, unsigned sho return newtl->tlv->length; } +/** + * aim_addtlvtochain_noval - Add a blank TLV to a TLV chain + * @list: Destination chain + * @type: TLV type to add + * + * Adds a TLV with a zero length to a TLV chain. + * + */ +faim_internal int aim_addtlvtochain_noval(struct aim_tlvlist_t **list, unsigned short type) +{ + struct aim_tlvlist_t *newtlv; + struct aim_tlvlist_t *cur; + + newtlv = (struct aim_tlvlist_t *)malloc(sizeof(struct aim_tlvlist_t)); + memset(newtlv, 0x00, sizeof(struct aim_tlvlist_t)); + + newtlv->tlv = aim_createtlv(); + newtlv->tlv->type = type; + newtlv->tlv->length = 0; + newtlv->tlv->value = NULL; + + newtlv->next = NULL; + + if (*list == NULL) { + *list = newtlv; + } else if ((*list)->next == NULL) { + (*list)->next = newtlv; + } else { + for(cur = *list; cur->next; cur = cur->next) + ; + cur->next = newtlv; + } + return newtlv->tlv->length; +} + /** * aim_writetlvchain - Write a TLV chain into a data buffer. * @buf: Destination buffer @@ -420,6 +455,63 @@ faim_export char *aim_gettlv_str(struct aim_tlvlist_t *list, u_short type, int n return newstr; } +/** + * aim_gettlv8 - Retrieve the Nth TLV in chain as a 8bit integer. + * @list: Source TLV chain + * @type: TLV type to search for + * @nth: Index of TLV to return + * + * Same as aim_gettlv(), except that the return value is a + * 8bit integer instead of an aim_tlv_t. + * + */ +faim_internal unsigned char aim_gettlv8(struct aim_tlvlist_t *list, unsigned short type, int num) +{ + struct aim_tlv_t *tlv; + + if (!(tlv = aim_gettlv(list, type, num)) || !tlv->value) + return 0; /* erm */ + return aimutil_get8(tlv->value); +} + +/** + * aim_gettlv16 - Retrieve the Nth TLV in chain as a 16bit integer. + * @list: Source TLV chain + * @type: TLV type to search for + * @nth: Index of TLV to return + * + * Same as aim_gettlv(), except that the return value is a + * 16bit integer instead of an aim_tlv_t. + * + */ +faim_internal unsigned short aim_gettlv16(struct aim_tlvlist_t *list, unsigned short type, int num) +{ + struct aim_tlv_t *tlv; + + if (!(tlv = aim_gettlv(list, type, num)) || !tlv->value) + return 0; /* erm */ + return aimutil_get16(tlv->value); +} + +/** + * aim_gettlv32 - Retrieve the Nth TLV in chain as a 32bit integer. + * @list: Source TLV chain + * @type: TLV type to search for + * @nth: Index of TLV to return + * + * Same as aim_gettlv(), except that the return value is a + * 32bit integer instead of an aim_tlv_t. + * + */ +faim_internal unsigned long aim_gettlv32(struct aim_tlvlist_t *list, unsigned short type, int num) +{ + struct aim_tlv_t *tlv; + + if (!(tlv = aim_gettlv(list, type, num)) || !tlv->value) + return 0; /* erm */ + return aimutil_get32(tlv->value); +} + /** * aim_grabtlv - Grab a single TLV from a data buffer * @src: Source data buffer (must be at least 4 bytes long) @@ -549,6 +641,26 @@ faim_export int aim_freetlv(struct aim_tlv_t **oldtlv) return 0; } +/** + * aim_puttlv_8 - Write a one-byte TLV. + * @buf: Destination buffer + * @t: TLV type + * @v: Value + * + * Writes a TLV with a one-byte integer value portion. + * + */ +faim_export int aim_puttlv_8(unsigned char *buf, unsigned short t, unsigned char v) +{ + int curbyte=0; + + curbyte += aimutil_put16(buf+curbyte, (unsigned short)(t&0xffff)); + curbyte += aimutil_put16(buf+curbyte, (unsigned short)0x0001); + curbyte += aimutil_put8(buf+curbyte, (unsigned char)(v&0xff)); + + return curbyte; +} + /** * aim_puttlv_16 - Write a two-byte TLV. * @buf: Destination buffer diff --git a/faim/aim.h b/faim/aim.h index 8e345a4..a83632d 100644 --- a/faim/aim.h +++ b/faim/aim.h @@ -142,22 +142,6 @@ #define AIM_MD5_STRING "AOL Instant Messenger (SM)" -/* - * Login info. Passes information from the Authorization - * stage of login to the service (BOS, etc) connection - * phase. - * - */ -struct aim_login_struct { - char screen_name[MAXSNLEN+1]; - char *BOSIP; - unsigned char cookie[AIM_COOKIELEN]; - char *email; - u_short regstatus; - char *errorurl; - u_short errorcode; -}; - /* * Client info. Filled in by the client and passed * in to aim_login(). The information ends up @@ -297,21 +281,24 @@ struct aim_session_t { /* ---- Client Accessible ------------------------ */ /* - * Login information. See definition above. + * Our screen name. * */ - struct aim_login_struct logininfo; + char sn[MAXSNLEN+1]; /* * Pointer to anything the client wants to * explicitly associate with this session. + * + * This is for use in the callbacks mainly. In any + * callback, you can access this with sess->aux_data. + * */ void *aux_data; /* * OFT Data */ - struct aim_oft_session_t oft; /* ---- Internal Use Only ------------------------ */ @@ -419,9 +406,13 @@ faim_internal struct aim_tlv_t *aim_grabtlv(u_char *src); faim_internal struct aim_tlv_t *aim_grabtlvstr(u_char *src); faim_internal struct aim_tlv_t *aim_gettlv(struct aim_tlvlist_t *, u_short, int); faim_internal char *aim_gettlv_str(struct aim_tlvlist_t *, u_short, int); +faim_internal unsigned char aim_gettlv8(struct aim_tlvlist_t *list, unsigned short type, int num); +faim_internal unsigned short aim_gettlv16(struct aim_tlvlist_t *list, unsigned short type, int num); +faim_internal unsigned long aim_gettlv32(struct aim_tlvlist_t *list, unsigned short type, int num); faim_internal int aim_puttlv (u_char *dest, struct aim_tlv_t *newtlv); faim_internal struct aim_tlv_t *aim_createtlv(void); faim_internal int aim_freetlv(struct aim_tlv_t **oldtlv); +faim_export int aim_puttlv_8(unsigned char *buf, unsigned short t, unsigned char v); faim_internal int aim_puttlv_16(u_char *, u_short, u_short); faim_internal int aim_puttlv_32(u_char *, u_short, u_long); faim_internal int aim_puttlv_str(u_char *buf, u_short t, int l, char *v); @@ -430,6 +421,7 @@ faim_internal int aim_addtlvtochain16(struct aim_tlvlist_t **list, unsigned shor faim_internal int aim_addtlvtochain32(struct aim_tlvlist_t **list, unsigned short type, unsigned long val); faim_internal int aim_addtlvtochain_str(struct aim_tlvlist_t **list, unsigned short type, char *str, int len); faim_internal int aim_addtlvtochain_caps(struct aim_tlvlist_t **list, unsigned short type, unsigned short caps); +faim_internal int aim_addtlvtochain_noval(struct aim_tlvlist_t **list, unsigned short type); faim_internal int aim_counttlvchain(struct aim_tlvlist_t **list); /* @@ -460,7 +452,7 @@ faim_export int aim_getfile_send(struct aim_conn_t *conn, FILE *tosend, struct a faim_export int aim_sendconnack(struct aim_session_t *sess, struct aim_conn_t *conn); faim_export int aim_request_login (struct aim_session_t *sess, struct aim_conn_t *conn, char *sn); faim_export int aim_send_login (struct aim_session_t *, struct aim_conn_t *, char *, char *, struct client_info_s *, char *key); -faim_export unsigned long aim_sendauthresp(struct aim_session_t *sess, struct aim_conn_t *conn, char *sn, char *bosip, char *cookie, char *email, int regstatus); +faim_export unsigned long aim_sendauthresp(struct aim_session_t *sess, struct aim_conn_t *conn, char *sn, int errorcode, char *errorurl, char *bosip, char *cookie, char *email, int regstatus); faim_export int aim_gencookie(unsigned char *buf); faim_export int aim_sendserverready(struct aim_session_t *sess, struct aim_conn_t *conn); faim_internal int aim_authkeyparse(struct aim_session_t *sess, struct command_rx_struct *command); diff --git a/utils/faimtest/faimtest.c b/utils/faimtest/faimtest.c index 795bf96..a8b8437 100644 --- a/utils/faimtest/faimtest.c +++ b/utils/faimtest/faimtest.c @@ -546,63 +546,77 @@ int faimtest_handleredirect(struct aim_session_t *sess, struct command_rx_struct int faimtest_parse_authresp(struct aim_session_t *sess, struct command_rx_struct *command, ...) { + va_list ap; struct aim_conn_t *bosconn = NULL; + char *sn = NULL, *bosip = NULL, *errurl = NULL, *email = NULL; + unsigned char *cookie = NULL; + int errorcode = 0, regstatus = 0; + va_start(ap, command); + sn = va_arg(ap, char *); + errorcode = va_arg(ap, int); + errurl = va_arg(ap, char *); + regstatus = va_arg(ap, int); + email = va_arg(ap, char *); + bosip = va_arg(ap, char *); + cookie = va_arg(ap, unsigned char *); + va_end(ap); - printf("Screen name: %s\n", sess->logininfo.screen_name); + printf("Screen name: %s\n", sn); /* * Check for error. */ - if (sess->logininfo.errorcode) - { - printf("Login Error Code 0x%04x\n", sess->logininfo.errorcode); - printf("Error URL: %s\n", sess->logininfo.errorurl); - aim_conn_kill(sess, &command->conn); - exit(0); /* XXX: should return in order to let the above things get free()'d. */ - } + if (errorcode || !bosip || !cookie) { + printf("Login Error Code 0x%04x\n", errorcode); + printf("Error URL: %s\n", errurl); + aim_conn_kill(sess, &command->conn); + return 1; + } - printf("Reg status: %2d\n", sess->logininfo.regstatus); - printf("Email: %s\n", sess->logininfo.email); - printf("BOS IP: %s\n", sess->logininfo.BOSIP); + printf("Reg status: %2d\n", regstatus); + printf("Email: %s\n", email); + printf("BOS IP: %s\n", bosip); printf("Closing auth connection...\n"); aim_conn_kill(sess, &command->conn); - bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, sess->logininfo.BOSIP); - if (bosconn == NULL) { + if (!(bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, bosip))) { fprintf(stderr, "faimtest: could not connect to BOS: internal error\n"); + return 1; } else if (bosconn->status & AIM_CONN_STATUS_CONNERR) { fprintf(stderr, "faimtest: could not connect to BOS\n"); aim_conn_kill(sess, &bosconn); - } else { - aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNCOMPLETE, faimtest_conncomplete, 0); - aim_conn_addhandler(sess, bosconn, 0x0009, 0x0003, faimtest_bosrights, 0); - aim_conn_addhandler(sess, bosconn, 0x0001, 0x0007, faimtest_rateresp, 0); /* rate info */ - aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ACK, AIM_CB_ACK_ACK, NULL, 0); - aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_SERVERREADY, faimtest_serverready, 0); - aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_RATEINFO, NULL, 0); - aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_REDIRECT, faimtest_handleredirect, 0); - aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_STS, AIM_CB_STS_SETREPORTINTERVAL, faimtest_reportinterval, 0); - aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_RIGHTSINFO, faimtest_parse_buddyrights, 0); - aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_ONCOMING, faimtest_parse_oncoming, 0); - aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_OFFGOING, faimtest_parse_offgoing, 0); - aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_INCOMING, faimtest_parse_incoming_im, 0); - aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_ERROR, faimtest_parse_locerr, 0); - aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MISSEDCALL, faimtest_parse_misses, 0); - aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_RATECHANGE, faimtest_parse_ratechange, 0); - aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_EVIL, faimtest_parse_evilnotify, 0); - aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ERROR, faimtest_parse_msgerr, 0); - aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_USERINFO, faimtest_parse_userinfo, 0); - aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ACK, faimtest_parse_msgack, 0); - - aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_CTN, AIM_CB_CTN_DEFAULT, aim_parse_unknown, 0); - aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_DEFAULT, aim_parse_unknown, 0); - aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_MOTD, faimtest_parse_motd, 0); + return 1; + } + + aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNCOMPLETE, faimtest_conncomplete, 0); + aim_conn_addhandler(sess, bosconn, 0x0009, 0x0003, faimtest_bosrights, 0); + aim_conn_addhandler(sess, bosconn, 0x0001, 0x0007, faimtest_rateresp, 0); /* rate info */ + aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ACK, AIM_CB_ACK_ACK, NULL, 0); + aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_SERVERREADY, faimtest_serverready, 0); + aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_RATEINFO, NULL, 0); + aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_REDIRECT, faimtest_handleredirect, 0); + aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_STS, AIM_CB_STS_SETREPORTINTERVAL, faimtest_reportinterval, 0); + aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_RIGHTSINFO, faimtest_parse_buddyrights, 0); + aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_ONCOMING, faimtest_parse_oncoming, 0); + aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_OFFGOING, faimtest_parse_offgoing, 0); + aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_INCOMING, faimtest_parse_incoming_im, 0); + aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_ERROR, faimtest_parse_locerr, 0); + aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MISSEDCALL, faimtest_parse_misses, 0); + aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_RATECHANGE, faimtest_parse_ratechange, 0); + aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_EVIL, faimtest_parse_evilnotify, 0); + aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ERROR, faimtest_parse_msgerr, 0); + aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_USERINFO, faimtest_parse_userinfo, 0); + aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ACK, faimtest_parse_msgack, 0); + + aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_CTN, AIM_CB_CTN_DEFAULT, aim_parse_unknown, 0); + aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_DEFAULT, aim_parse_unknown, 0); + aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_MOTD, faimtest_parse_motd, 0); - aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, faimtest_parse_connerr, 0); + aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, faimtest_parse_connerr, 0); - aim_auth_sendcookie(sess, bosconn, sess->logininfo.cookie); - } + aim_auth_sendcookie(sess, bosconn, cookie); + return 1; } @@ -1299,7 +1313,7 @@ int faimtest_chat_incomingmsg(struct aim_session_t *sess, struct command_rx_stru /* * Do an echo for testing purposes. But not for ourselves ("oops!") */ - if (strcmp(userinfo->sn, sess->logininfo.screen_name) != 0) + if (strcmp(userinfo->sn, sess->sn) != 0) { sprintf(tmpbuf, "(%s said \"%s\")", userinfo->sn, msg); aim_chat_send_im(sess, command->conn, tmpbuf); -- 2.45.1