]> jfr.im git - solanum.git/blob - extensions/sno_globalkline.c
Move irc_* data structures to librb.
[solanum.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
10 #include "stdinc.h"
11 #include "modules.h"
12 #include "client.h"
13 #include "hook.h"
14 #include "ircd.h"
15 #include "send.h"
16 #include "s_conf.h"
17
18 static void h_gla_client_exit(hook_data_client_exit *);
19
20 mapi_hfn_list_av1 gla_hfnlist[] = {
21 { "client_exit", (hookfn) h_gla_client_exit },
22 { NULL, NULL }
23 };
24
25 DECLARE_MODULE_AV1(globallineactive, NULL, NULL, NULL, NULL, gla_hfnlist, "$Revision: 613 $");
26
27 static void
28 h_gla_client_exit(hook_data_client_exit *hdata)
29 {
30 struct Client *source_p;
31
32 source_p = hdata->target;
33
34 if (MyConnect(source_p) || !IsClient(source_p))
35 return;
36 if (!strcmp(hdata->comment, "Bad user info"))
37 {
38 sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
39 "XLINE active for %s[%s@%s]",
40 source_p->name, source_p->username, source_p->host);
41 }
42 else if (ConfigFileEntry.kline_reason != NULL &&
43 !strcmp(hdata->comment, ConfigFileEntry.kline_reason))
44 {
45 sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
46 "K/DLINE active for %s[%s@%s]",
47 source_p->name, source_p->username, source_p->host);
48 }
49 else if (!strncmp(hdata->comment, "Temporary K-line ", 17))
50 {
51 sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
52 "K/DLINE active for %s[%s@%s]",
53 source_p->name, source_p->username, source_p->host);
54 }
55 else if (!strncmp(hdata->comment, "Temporary D-line ", 17))
56 {
57 sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
58 "K/DLINE active for %s[%s@%s]",
59 source_p->name, source_p->username, source_p->host);
60 }
61 }