]>
Commit | Line | Data |
---|---|---|
212380e3 AC |
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 | |
212380e3 AC |
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 | ||
84b4c058 EM |
25 | static const char sno_desc[] = |
26 | "Adds server notices for global XLINEs, KLINEs, and DLINEs"; | |
27 | ||
a278a4fc | 28 | DECLARE_MODULE_AV2(globallineactive, NULL, NULL, NULL, NULL, gla_hfnlist, NULL, NULL, sno_desc); |
212380e3 AC |
29 | |
30 | static void | |
31 | h_gla_client_exit(hook_data_client_exit *hdata) | |
32 | { | |
33 | struct Client *source_p; | |
34 | ||
35 | source_p = hdata->target; | |
36 | ||
37 | if (MyConnect(source_p) || !IsClient(source_p)) | |
38 | return; | |
39 | if (!strcmp(hdata->comment, "Bad user info")) | |
40 | { | |
41 | sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr, | |
42 | "XLINE active for %s[%s@%s]", | |
43 | source_p->name, source_p->username, source_p->host); | |
44 | } | |
45 | else if (ConfigFileEntry.kline_reason != NULL && | |
46 | !strcmp(hdata->comment, ConfigFileEntry.kline_reason)) | |
47 | { | |
48 | sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr, | |
170703fe | 49 | "K/DLINE active for %s[%s@%s]", |
212380e3 AC |
50 | source_p->name, source_p->username, source_p->host); |
51 | } | |
fb47b366 JT |
52 | else if (!strncmp(hdata->comment, "Temporary K-line ", 17)) |
53 | { | |
54 | sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr, | |
55 | "K/DLINE active for %s[%s@%s]", | |
56 | source_p->name, source_p->username, source_p->host); | |
57 | } | |
58 | else if (!strncmp(hdata->comment, "Temporary D-line ", 17)) | |
59 | { | |
60 | sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr, | |
61 | "K/DLINE active for %s[%s@%s]", | |
62 | source_p->name, source_p->username, source_p->host); | |
63 | } | |
212380e3 | 64 | } |