]> jfr.im git - irc/rqf/shadowircd.git/blob - extensions/sno_globalkline.c
a654c4889c02a2dbba09ac7462ac609a668a8c7b
[irc/rqf/shadowircd.git] / extensions / sno_globalkline.c
1 /*
2 * Shows notices if remote clients exit with "Bad user info" or
3 * ConfigFileEntry.kline_reason.
4 * Assumes client_exit is enabled so users can't fake these reasons,
5 * and kline_reason is enabled and the same everywhere.
6 * Yes, this is a hack, but it is simple and avoids sending
7 * more data across servers -- jilles
8 *
9 * $Id: sno_globalkline.c 613 2006-01-29 03:03:02Z nenolod $
10 */
11
12 #include "stdinc.h"
13 #include "modules.h"
14 #include "client.h"
15 #include "hook.h"
16 #include "ircd.h"
17 #include "send.h"
18 #include "s_conf.h"
19
20 static void h_gla_client_exit(hook_data_client_exit *);
21
22 mapi_hfn_list_av1 gla_hfnlist[] = {
23 { "client_exit", (hookfn) h_gla_client_exit },
24 { NULL, NULL }
25 };
26
27 DECLARE_MODULE_AV1(globallineactive, NULL, NULL, NULL, NULL, gla_hfnlist, "$Revision: 613 $");
28
29 static void
30 h_gla_client_exit(hook_data_client_exit *hdata)
31 {
32 struct Client *source_p;
33
34 source_p = hdata->target;
35
36 if (MyConnect(source_p) || !IsClient(source_p))
37 return;
38 if (!strcmp(hdata->comment, "Bad user info"))
39 {
40 sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
41 "XLINE active for %s[%s@%s]",
42 source_p->name, source_p->username, source_p->host);
43 }
44 else if (ConfigFileEntry.kline_reason != NULL &&
45 !strcmp(hdata->comment, ConfigFileEntry.kline_reason))
46 {
47 sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
48 "K/DLINE active for %s[%s@%s]",
49 source_p->name, source_p->username, source_p->host);
50 }
51 else if (!strncmp(hdata->comment, "Temporary K-line ", 17))
52 {
53 sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
54 "K/DLINE active for %s[%s@%s]",
55 source_p->name, source_p->username, source_p->host);
56 }
57 else if (!strncmp(hdata->comment, "Temporary D-line ", 17))
58 {
59 sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
60 "K/DLINE active for %s[%s@%s]",
61 source_p->name, source_p->username, source_p->host);
62 }
63 }