diff --git a/include/hook.h b/include/hook.h index b1bad117..120fe7c2 100644 --- a/include/hook.h +++ b/include/hook.h @@ -29,6 +29,7 @@ extern int h_umode_changed; extern int h_new_local_user; extern int h_new_remote_user; extern int h_introduce_client; +extern int h_can_kick; void init_hook(void); int register_hook(const char *name); @@ -70,6 +71,14 @@ typedef struct char *key; } hook_data_channel_activity; +typedef struct +{ + struct Client *client; + struct Channel *chptr; + struct Client *target; + int approved; +} hook_data_channel_approval; + typedef struct { struct Client *client; diff --git a/modules/core/m_kick.c b/modules/core/m_kick.c index c87a1a50..88befacd 100644 --- a/modules/core/m_kick.c +++ b/modules/core/m_kick.c @@ -37,6 +37,7 @@ #include "hash.h" #include "packet.h" #include "s_serv.h" +#include "hook.h" static int m_kick(struct Client *, struct Client *, int, const char **); #define mg_kick { m_kick, 3 } @@ -157,6 +158,21 @@ m_kick(struct Client *client_p, struct Client *source_p, int parc, const char *p return 0; } + if(MyClient(source_p)) + { + hook_data_channel_approval hookdata; + + hookdata.client = source_p; + hookdata.chptr = chptr; + hookdata.target = who; + hookdata.approved = 1; + + call_hook(h_can_kick, &hookdata); + + if (!hookdata.approved) + return 0; + } + comment = LOCAL_COPY((EmptyString(parv[3])) ? who->name : parv[3]); if(strlen(comment) > (size_t) REASONLEN) comment[REASONLEN] = '\0'; diff --git a/src/hook.c b/src/hook.c index 79a9a107..91b64134 100644 --- a/src/hook.c +++ b/src/hook.c @@ -63,6 +63,7 @@ int h_umode_changed; int h_new_local_user; int h_new_remote_user; int h_introduce_client; +int h_can_kick; void init_hook(void) @@ -85,6 +86,7 @@ init_hook(void) h_new_local_user = register_hook("new_local_user"); h_new_remote_user = register_hook("new_remote_user"); h_introduce_client = register_hook("introduce_client"); + h_can_kick = register_hook("can_kick"); } /* grow_hooktable()