From 749d8c11ddebc3c1ee52bbd4f5eed1aa5a12e66c Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Mon, 6 Dec 2010 22:57:28 -0600 Subject: [PATCH] Add a hook for get_channel_access(). --- src/channel.c | 2 ++ src/chmode.c | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/channel.c b/src/channel.c index 6151ec7e3..004c6fbf8 100644 --- a/src/channel.c +++ b/src/channel.c @@ -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"); } /* diff --git a/src/chmode.c b/src/chmode.c index 559ba7b52..9e1432456 100644 --- a/src/chmode.c +++ b/src/chmode.c @@ -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()