]> jfr.im git - solanum.git/blame - extensions/invex_regonly.c
Note that messages caught in +g/+G are discarded
[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
82436efb 11static void h_can_join(void *);
bb10433e
MQ
12
13mapi_hfn_list_av1 invex_regonly_hfnlist[] = {
82436efb 14 { "can_join", h_can_join },
bb10433e
MQ
15 { NULL, NULL }
16};
17
18DECLARE_MODULE_AV1(invex_regonly, NULL, NULL, NULL, NULL, invex_regonly_hfnlist, "$Revision$");
19
20static void
82436efb 21h_can_join(void *data_)
bb10433e 22{
82436efb 23 hook_data_channel *data = data_;
bb10433e
MQ
24 struct Client *source_p = data->client;
25 struct Channel *chptr = data->chptr;
26 struct Ban *invex = NULL;
27 struct matchset ms;
28 rb_dlink_node *ptr;
29
30 if(data->approved != ERR_NEEDREGGEDNICK)
31 return;
32 if(!ConfigChannel.use_invex)
33 return;
34
35 matchset_for_client(source_p, &ms);
36
37 RB_DLINK_FOREACH(ptr, chptr->invexlist.head)
38 {
39 invex = ptr->data;
40 if (matches_mask(&ms, invex->banstr) ||
41 match_extban(invex->banstr, source_p, chptr, CHFL_INVEX))
42 {
43 data->approved = 0;
44 break;
45 }
46 }
47}