]> jfr.im git - irc/rqf/shadowircd.git/blame - extensions/sno_farconnect.c
chm_operonly extension: use Unreal's numeric (520)
[irc/rqf/shadowircd.git] / extensions / sno_farconnect.c
CommitLineData
212380e3 1/*
2 * Remote client connect/exit notices on snomask +F (far).
3 * To avoid flooding, connects/exits part of netjoins/netsplits are not shown.
4 * Consequently, it is not possible to use these notices to keep track
5 * of all clients.
6 * -- jilles
7 *
8 * $Id: sno_farconnect.c 1869 2006-08-27 14:24:25Z jilles $
9 */
10
11#include "stdinc.h"
12#include "modules.h"
13#include "client.h"
14#include "hook.h"
15#include "ircd.h"
16#include "send.h"
17#include "s_conf.h"
18#include "snomask.h"
19
20static int _modinit(void);
21static void _moddeinit(void);
22static void h_gcn_new_remote_user(struct Client *);
23static void h_gcn_client_exit(hook_data_client_exit *);
24
25mapi_hfn_list_av1 gcn_hfnlist[] = {
26 { "new_remote_user", (hookfn) h_gcn_new_remote_user },
27 { "client_exit", (hookfn) h_gcn_client_exit },
28 { NULL, NULL }
29};
30
31DECLARE_MODULE_AV1(globalconnexit, _modinit, _moddeinit, NULL, NULL, gcn_hfnlist, "$Revision: 1869 $");
32
33static int
34_modinit(void)
35{
36 /* add the snomask to the available slot */
37 snomask_modes['F'] = find_snomask_slot();
38
39 /* show the fact that we are showing user information in /version */
40 opers_see_all_users = 1;
41
42 return 0;
43}
44
45static void
46_moddeinit(void)
47{
48 /* disable the snomask and remove it from the available list */
49 snomask_modes['F'] = 0;
50}
51
52static void
53h_gcn_new_remote_user(struct Client *source_p)
54{
55
56 if (!HasSentEob(source_p->servptr))
57 return;
58 sendto_realops_snomask_from(snomask_modes['F'], L_ALL, source_p->servptr,
59 "Client connecting: %s (%s@%s) [%s] {%s} [%s]",
60 source_p->name, source_p->username, source_p->orighost,
61 show_ip(NULL, source_p) ? source_p->sockhost : "255.255.255.255",
62 "?", source_p->info);
63}
64
65static void
66h_gcn_client_exit(hook_data_client_exit *hdata)
67{
68 struct Client *source_p;
69
70 source_p = hdata->target;
71
72 if (MyConnect(source_p) || !IsClient(source_p))
73 return;
74 if (!HasSentEob(source_p->servptr))
75 return;
76 sendto_realops_snomask_from(snomask_modes['F'], L_ALL, source_p->servptr,
77 "Client exiting: %s (%s@%s) [%s] [%s]",
78 source_p->name,
79 source_p->username, source_p->host, hdata->comment,
80 show_ip(NULL, source_p) ? source_p->sockhost : "255.255.255.255");
81}