]> jfr.im git - solanum.git/blame - extensions/invex_regonly.c
Add `solanum.chat/oper` capablity (#217)
[solanum.git] / extensions / invex_regonly.c
CommitLineData
bb10433e
MQ
1/*
2 * invex_regonly.c Allow invite exemptions to bypass registered-only (+r)
3 */
4#include "stdinc.h"
5#include "modules.h"
6#include "hook.h"
7#include "channel.h"
8#include "s_conf.h"
9#include "numeric.h"
10
11static void h_can_join(hook_data_channel *);
12
13mapi_hfn_list_av1 invex_regonly_hfnlist[] = {
14 { "can_join", (hookfn) h_can_join },
15 { NULL, NULL }
16};
17
18DECLARE_MODULE_AV1(invex_regonly, NULL, NULL, NULL, NULL, invex_regonly_hfnlist, "$Revision$");
19
20static void
21h_can_join(hook_data_channel *data)
22{
23 struct Client *source_p = data->client;
24 struct Channel *chptr = data->chptr;
25 struct Ban *invex = NULL;
26 struct matchset ms;
27 rb_dlink_node *ptr;
28
29 if(data->approved != ERR_NEEDREGGEDNICK)
30 return;
31 if(!ConfigChannel.use_invex)
32 return;
33
34 matchset_for_client(source_p, &ms);
35
36 RB_DLINK_FOREACH(ptr, chptr->invexlist.head)
37 {
38 invex = ptr->data;
39 if (matches_mask(&ms, invex->banstr) ||
40 match_extban(invex->banstr, source_p, chptr, CHFL_INVEX))
41 {
42 data->approved = 0;
43 break;
44 }
45 }
46}