mirror of
https://github.com/matrix-construct/construct
synced 2024-12-28 00:14:07 +01:00
Add a hook for get_channel_access().
This commit is contained in:
parent
6ca4dec95a
commit
749d8c11dd
2 changed files with 16 additions and 2 deletions
|
@ -62,6 +62,7 @@ static struct ChCapCombo chcap_combos[NCHCAP_COMBOS];
|
||||||
static void free_topic(struct Channel *chptr);
|
static void free_topic(struct Channel *chptr);
|
||||||
|
|
||||||
static int h_can_join;
|
static int h_can_join;
|
||||||
|
int h_get_channel_access;
|
||||||
|
|
||||||
/* init_channels()
|
/* init_channels()
|
||||||
*
|
*
|
||||||
|
@ -78,6 +79,7 @@ init_channels(void)
|
||||||
member_heap = rb_bh_create(sizeof(struct membership), MEMBER_HEAP_SIZE, "member_heap");
|
member_heap = rb_bh_create(sizeof(struct membership), MEMBER_HEAP_SIZE, "member_heap");
|
||||||
|
|
||||||
h_can_join = register_hook("can_join");
|
h_can_join = register_hook("can_join");
|
||||||
|
h_get_channel_access = register_hook("get_channel_access");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
16
src/chmode.c
16
src/chmode.c
|
@ -71,6 +71,8 @@ char cflagsmyinfo[256];
|
||||||
|
|
||||||
int chmode_flags[256];
|
int chmode_flags[256];
|
||||||
|
|
||||||
|
extern int h_get_channel_access;
|
||||||
|
|
||||||
/* OPTIMIZE ME! -- dwr */
|
/* OPTIMIZE ME! -- dwr */
|
||||||
void
|
void
|
||||||
construct_cflags_strings(void)
|
construct_cflags_strings(void)
|
||||||
|
@ -187,10 +189,20 @@ cflag_orphan(char c_)
|
||||||
static int
|
static int
|
||||||
get_channel_access(struct Client *source_p, struct membership *msptr)
|
get_channel_access(struct Client *source_p, struct membership *msptr)
|
||||||
{
|
{
|
||||||
if(!MyClient(source_p) || is_chanop(msptr))
|
hook_data_channel_approval moduledata;
|
||||||
|
|
||||||
|
if(!MyClient(source_p))
|
||||||
return CHFL_CHANOP;
|
return CHFL_CHANOP;
|
||||||
|
|
||||||
return CHFL_PEON;
|
moduledata.client = source_p;
|
||||||
|
moduledata.chptr = msptr->chptr;
|
||||||
|
moduledata.msptr = msptr;
|
||||||
|
moduledata.target = NULL;
|
||||||
|
moduledata.approved = is_chanop(msptr) ? CHFL_CHANOP : CHFL_PEON;
|
||||||
|
|
||||||
|
call_hook(h_get_channel_access, &moduledata);
|
||||||
|
|
||||||
|
return moduledata.approved;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add_id()
|
/* add_id()
|
||||||
|
|
Loading…
Reference in a new issue