0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-26 00:32:35 +01:00

can_kick hook, based on the ircd-seven one.

This commit is contained in:
William Pitcock 2009-04-20 09:20:11 -05:00
parent 84405686ac
commit 5f8d323c59
3 changed files with 27 additions and 0 deletions

View file

@ -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;

View file

@ -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';

View file

@ -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()