Add a hook for get_channel_access().

This commit is contained in:
William Pitcock 2010-12-06 22:57:28 -06:00
parent 6ca4dec95a
commit 749d8c11dd
2 changed files with 16 additions and 2 deletions

View file

@ -62,6 +62,7 @@ static struct ChCapCombo chcap_combos[NCHCAP_COMBOS];
static void free_topic(struct Channel *chptr);
static int h_can_join;
int h_get_channel_access;
/* init_channels()
*
@ -78,6 +79,7 @@ init_channels(void)
member_heap = rb_bh_create(sizeof(struct membership), MEMBER_HEAP_SIZE, "member_heap");
h_can_join = register_hook("can_join");
h_get_channel_access = register_hook("get_channel_access");
}
/*

View file

@ -71,6 +71,8 @@ char cflagsmyinfo[256];
int chmode_flags[256];
extern int h_get_channel_access;
/* OPTIMIZE ME! -- dwr */
void
construct_cflags_strings(void)
@ -187,10 +189,20 @@ cflag_orphan(char c_)
static int
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_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()