From 6fbd119b63d166f3ab3435fb275259882e3ee2e8 Mon Sep 17 00:00:00 2001 From: "Hercules.ws" Date: Mon, 25 Apr 2016 01:38:38 +0200 Subject: HPM Hooks Update Signed-off-by: HerculesWSAPI --- src/common/HPMDataCheck.h | 1 + .../HPMHooking/HPMHooking_map.HPMHooksCore.inc | 12 +++ .../HPMHooking/HPMHooking_map.HookingPoints.inc | 3 + src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 91 ++++++++++++++++++++-- 4 files changed, 101 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h index 86fcb671d..3d25d7330 100644 --- a/src/common/HPMDataCheck.h +++ b/src/common/HPMDataCheck.h @@ -414,6 +414,7 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { #ifdef MAP_IRC_BOT_H { "irc_bot_interface", sizeof(struct irc_bot_interface), SERVER_TYPE_MAP }, { "irc_func", sizeof(struct irc_func), SERVER_TYPE_MAP }, + { "message_flood", sizeof(struct message_flood), SERVER_TYPE_MAP }, #else #define MAP_IRC_BOT_H #endif // MAP_IRC_BOT_H diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index 4cc79a78c..9fe5dbd58 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -2614,6 +2614,10 @@ struct { struct HPMHookPoint *HP_ircbot_identify_timer_post; struct HPMHookPoint *HP_ircbot_join_timer_pre; struct HPMHookPoint *HP_ircbot_join_timer_post; + struct HPMHookPoint *HP_ircbot_queue_timer_pre; + struct HPMHookPoint *HP_ircbot_queue_timer_post; + struct HPMHookPoint *HP_ircbot_queue_pre; + struct HPMHookPoint *HP_ircbot_queue_post; struct HPMHookPoint *HP_ircbot_send_pre; struct HPMHookPoint *HP_ircbot_send_post; struct HPMHookPoint *HP_ircbot_relay_pre; @@ -2622,6 +2626,8 @@ struct { struct HPMHookPoint *HP_ircbot_pong_post; struct HPMHookPoint *HP_ircbot_privmsg_pre; struct HPMHookPoint *HP_ircbot_privmsg_post; + struct HPMHookPoint *HP_ircbot_privmsg_ctcp_pre; + struct HPMHookPoint *HP_ircbot_privmsg_ctcp_post; struct HPMHookPoint *HP_ircbot_userjoin_pre; struct HPMHookPoint *HP_ircbot_userjoin_post; struct HPMHookPoint *HP_ircbot_userleave_pre; @@ -8503,6 +8509,10 @@ struct { int HP_ircbot_identify_timer_post; int HP_ircbot_join_timer_pre; int HP_ircbot_join_timer_post; + int HP_ircbot_queue_timer_pre; + int HP_ircbot_queue_timer_post; + int HP_ircbot_queue_pre; + int HP_ircbot_queue_post; int HP_ircbot_send_pre; int HP_ircbot_send_post; int HP_ircbot_relay_pre; @@ -8511,6 +8521,8 @@ struct { int HP_ircbot_pong_post; int HP_ircbot_privmsg_pre; int HP_ircbot_privmsg_post; + int HP_ircbot_privmsg_ctcp_pre; + int HP_ircbot_privmsg_ctcp_post; int HP_ircbot_userjoin_pre; int HP_ircbot_userjoin_post; int HP_ircbot_userleave_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 951416b08..35f057def 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -1339,10 +1339,13 @@ struct HookingPointData HookingPoints[] = { { HP_POP(ircbot->connect_timer, HP_ircbot_connect_timer) }, { HP_POP(ircbot->identify_timer, HP_ircbot_identify_timer) }, { HP_POP(ircbot->join_timer, HP_ircbot_join_timer) }, + { HP_POP(ircbot->queue_timer, HP_ircbot_queue_timer) }, + { HP_POP(ircbot->queue, HP_ircbot_queue) }, { HP_POP(ircbot->send, HP_ircbot_send) }, { HP_POP(ircbot->relay, HP_ircbot_relay) }, { HP_POP(ircbot->pong, HP_ircbot_pong) }, { HP_POP(ircbot->privmsg, HP_ircbot_privmsg) }, + { HP_POP(ircbot->privmsg_ctcp, HP_ircbot_privmsg_ctcp) }, { HP_POP(ircbot->userjoin, HP_ircbot_userjoin) }, { HP_POP(ircbot->userleave, HP_ircbot_userleave) }, { HP_POP(ircbot->usernick, HP_ircbot_usernick) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 1526dd3f1..bd9be84bd 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -34383,14 +34383,67 @@ int HP_ircbot_join_timer(int tid, int64 tick, int id, intptr_t data) { } return retVal___; } -void HP_ircbot_send(char *str) { +int HP_ircbot_queue_timer(int tid, int64 tick, int id, intptr_t data) { int hIndex = 0; - if( HPMHooks.count.HP_ircbot_send_pre ) { + int retVal___ = 0; + if( HPMHooks.count.HP_ircbot_queue_timer_pre ) { + int (*preHookFunc) (int *tid, int64 *tick, int *id, intptr_t *data); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_ircbot_queue_timer_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_ircbot_queue_timer_pre[hIndex].func; + retVal___ = preHookFunc(&tid, &tick, &id, &data); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.ircbot.queue_timer(tid, tick, id, data); + } + if( HPMHooks.count.HP_ircbot_queue_timer_post ) { + int (*postHookFunc) (int retVal___, int *tid, int64 *tick, int *id, intptr_t *data); + for(hIndex = 0; hIndex < HPMHooks.count.HP_ircbot_queue_timer_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_ircbot_queue_timer_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &tid, &tick, &id, &data); + } + } + return retVal___; +} +void HP_ircbot_queue(char *str) { + int hIndex = 0; + if( HPMHooks.count.HP_ircbot_queue_pre ) { void (*preHookFunc) (char *str); *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_ircbot_queue_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_ircbot_queue_pre[hIndex].func; + preHookFunc(str); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.ircbot.queue(str); + } + if( HPMHooks.count.HP_ircbot_queue_post ) { + void (*postHookFunc) (char *str); + for(hIndex = 0; hIndex < HPMHooks.count.HP_ircbot_queue_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_ircbot_queue_post[hIndex].func; + postHookFunc(str); + } + } + return; +} +void HP_ircbot_send(char *str, bool force) { + int hIndex = 0; + if( HPMHooks.count.HP_ircbot_send_pre ) { + void (*preHookFunc) (char *str, bool *force); + *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_ircbot_send_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_ircbot_send_pre[hIndex].func; - preHookFunc(str); + preHookFunc(str, &force); } if( *HPMforce_return ) { *HPMforce_return = false; @@ -34398,13 +34451,13 @@ void HP_ircbot_send(char *str) { } } { - HPMHooks.source.ircbot.send(str); + HPMHooks.source.ircbot.send(str, force); } if( HPMHooks.count.HP_ircbot_send_post ) { - void (*postHookFunc) (char *str); + void (*postHookFunc) (char *str, bool *force); for(hIndex = 0; hIndex < HPMHooks.count.HP_ircbot_send_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_ircbot_send_post[hIndex].func; - postHookFunc(str); + postHookFunc(str, &force); } } return; @@ -34487,6 +34540,32 @@ void HP_ircbot_privmsg(int fd, char *cmd, char *source, char *target, char *msg) } return; } +void HP_ircbot_privmsg_ctcp(int fd, char *cmd, char *source, char *target, char *msg) { + int hIndex = 0; + if( HPMHooks.count.HP_ircbot_privmsg_ctcp_pre ) { + void (*preHookFunc) (int *fd, char *cmd, char *source, char *target, char *msg); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_ircbot_privmsg_ctcp_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_ircbot_privmsg_ctcp_pre[hIndex].func; + preHookFunc(&fd, cmd, source, target, msg); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.ircbot.privmsg_ctcp(fd, cmd, source, target, msg); + } + if( HPMHooks.count.HP_ircbot_privmsg_ctcp_post ) { + void (*postHookFunc) (int *fd, char *cmd, char *source, char *target, char *msg); + for(hIndex = 0; hIndex < HPMHooks.count.HP_ircbot_privmsg_ctcp_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_ircbot_privmsg_ctcp_post[hIndex].func; + postHookFunc(&fd, cmd, source, target, msg); + } + } + return; +} void HP_ircbot_userjoin(int fd, char *cmd, char *source, char *target, char *msg) { int hIndex = 0; if( HPMHooks.count.HP_ircbot_userjoin_pre ) { -- cgit v1.2.3-60-g2f50