]>
Commit | Line | Data |
---|---|---|
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 const char sno_desc[] = | |
19 | "Adds server notices for global XLINEs, KLINEs, and DLINEs"; | |
20 | ||
21 | static void h_gla_client_exit(hook_data_client_exit *); | |
22 | ||
23 | mapi_hfn_list_av1 gla_hfnlist[] = { | |
24 | { "client_exit", (hookfn) h_gla_client_exit }, | |
25 | { NULL, NULL } | |
26 | }; | |
27 | ||
28 | DECLARE_MODULE_AV2(globallineactive, NULL, NULL, NULL, NULL, gla_hfnlist, NULL, NULL, sno_desc); | |
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, | |
49 | "K/DLINE active for %s[%s@%s]", | |
50 | source_p->name, source_p->username, source_p->host); | |
51 | } | |
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 | } | |
64 | } |