From 06bc8607f1e3a6ba570f2c7e686c025a2e29860e Mon Sep 17 00:00:00 2001 From: mid Date: Fri, 15 Dec 2000 21:55:39 +0000 Subject: [PATCH] - Fri Dec 15 21:51:32 UTC 2000 - Add more info to evilnotify callback - Add a few values to aim_cbtypes.h --- CHANGES | 4 ++++ aim_rxhandlers.c | 25 +++++++++++-------------- faim/aim_cbtypes.h | 2 ++ utils/faimtest/faimtest.c | 17 ++++++++++++++--- 4 files changed, 31 insertions(+), 17 deletions(-) diff --git a/CHANGES b/CHANGES index 53311f4..bda46f4 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,10 @@ No release numbers ------------------ + - Fri Dec 15 21:51:32 UTC 2000 + - Add more info to evilnotify callback + - Add a few values to aim_cbtypes.h + - Fri Dec 15 20:41:15 UTC 2000 - Revise README - Make aimdebugd compile diff --git a/aim_rxhandlers.c b/aim_rxhandlers.c index c0a8c72..076f99b 100644 --- a/aim_rxhandlers.c +++ b/aim_rxhandlers.c @@ -700,25 +700,22 @@ faim_internal int aim_parse_ratechange_middle(struct aim_session_t *sess, struct faim_internal int aim_parse_evilnotify_middle(struct aim_session_t *sess, struct command_rx_struct *command) { rxcallback_t userfunc = NULL; - int ret = 1, pos; - char *sn = NULL; - - if(command->commandlen < 12) /* a warning level dec sends this */ - return 1; - - if ((pos = aimutil_get8(command->data+ 12)) > MAXSNLEN) - return 1; + int ret = 1; + int i; + unsigned short newevil; + struct aim_userinfo_s userinfo; - if(!(sn = (char *)calloc(1, pos+1))) - return 1; + i = 10; + newevil = aimutil_get16(command->data+10); + i += 2; - memcpy(sn, command->data+13, pos); + memset(&userinfo, 0, sizeof(struct aim_userinfo_s)); + if (command->commandlen-i) + i += aim_extractuserinfo(command->data+i, &userinfo); if ((userfunc = aim_callhandler(command->conn, 0x0001, 0x0010))) - ret = userfunc(sess, command, sn); + ret = userfunc(sess, command, newevil, &userinfo); - free(sn); - return ret; } diff --git a/faim/aim_cbtypes.h b/faim/aim_cbtypes.h index c0705ba..a18be3f 100644 --- a/faim/aim_cbtypes.h +++ b/faim/aim_cbtypes.h @@ -128,6 +128,8 @@ * SNAC Family: Misc BOS Services. */ #define AIM_CB_BOS_ERROR 0x0001 +#define AIM_CB_BOS_RIGHTSQUERY 0x0002 +#define AIM_CB_BOS_RIGHTS 0x0003 #define AIM_CB_BOS_DEFAULT 0xffff /* diff --git a/utils/faimtest/faimtest.c b/utils/faimtest/faimtest.c index 5370a49..fc0acaf 100644 --- a/utils/faimtest/faimtest.c +++ b/utils/faimtest/faimtest.c @@ -1621,6 +1621,7 @@ int faimtest_parse_ratechange(struct aim_session_t *sess, struct command_rx_stru /* * Known parameter ID's... + * 0x0001 Warnings * 0x0003 BOS (normal ICBMs, userinfo requests, etc) * 0x0005 Chat messages */ @@ -1690,13 +1691,23 @@ int faimtest_parse_ratechange(struct aim_session_t *sess, struct command_rx_stru int faimtest_parse_evilnotify(struct aim_session_t *sess, struct command_rx_struct *command, ...) { va_list ap; - char *sn; + int newevil; + struct aim_userinfo_s *userinfo; va_start(ap, command); - sn = va_arg(ap, char *); + newevil = va_arg(ap, int); + userinfo = va_arg(ap, struct aim_userinfo_s *); va_end(ap); - printf("faimtest: warning from: %s\n", sn); + /* + * Evil Notifications that are lacking userinfo->sn are anon-warns + * if they are an evil increases, but are not warnings at all if its + * a decrease (its the natural backoff happening). + * + * newevil is passed as an int representing the new evil value times + * ten. + */ + printf("faimtest: evil level change: new value = %2.1f%% (caused by %s)\n", ((float)newevil)/10, (userinfo && strlen(userinfo->sn))?userinfo->sn:"anonymous"); return 1; } -- 2.45.1