]> jfr.im git - solanum.git/blob - extensions/drain.c
extensions/extb_extgecos: support CIDR masks in $x extbans (#414)
[solanum.git] / extensions / drain.c
1 #include "stdinc.h"
2 #include "modules.h"
3 #include "hook.h"
4 #include "client.h"
5 #include "s_conf.h"
6
7 static void check_new_user(void *data);
8 mapi_hfn_list_av1 drain_hfnlist[] = {
9 { "new_local_user", check_new_user },
10 { NULL, NULL }
11 };
12
13 static const char drain_desc[] = "Prevents new, non-exempt users from connecting to this server.";
14
15 DECLARE_MODULE_AV2(drain, NULL, NULL, NULL, NULL,
16 drain_hfnlist, NULL, NULL, drain_desc);
17
18
19 static void
20 check_new_user(void *vdata)
21 {
22 struct Client *source_p = vdata;
23 const char *drain_reason = ConfigFileEntry.drain_reason;
24
25 if (IsAnyDead(source_p))
26 return;
27
28 if (drain_reason == NULL)
29 drain_reason = "This server is not accepting connections.";
30
31 if (IsExemptKline(source_p))
32 return;
33
34 exit_client(source_p, source_p, &me, drain_reason);
35 }