]> jfr.im git - irc/rqf/shadowircd.git/blame - extensions/sno_farconnect.c
Backed out changeset c04f6578869c
[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 *
212380e3 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#include "snomask.h"
18
19static int _modinit(void);
20static void _moddeinit(void);
21static void h_gcn_new_remote_user(struct Client *);
22static void h_gcn_client_exit(hook_data_client_exit *);
23
24mapi_hfn_list_av1 gcn_hfnlist[] = {
25 { "new_remote_user", (hookfn) h_gcn_new_remote_user },
26 { "client_exit", (hookfn) h_gcn_client_exit },
27 { NULL, NULL }
28};
29
30DECLARE_MODULE_AV1(globalconnexit, _modinit, _moddeinit, NULL, NULL, gcn_hfnlist, "$Revision: 1869 $");
31
32static int
33_modinit(void)
34{
35 /* add the snomask to the available slot */
36 snomask_modes['F'] = find_snomask_slot();
37
38 /* show the fact that we are showing user information in /version */
39 opers_see_all_users = 1;
40
41 return 0;
42}
43
44static void
45_moddeinit(void)
46{
47 /* disable the snomask and remove it from the available list */
48 snomask_modes['F'] = 0;
49}
50
51static void
52h_gcn_new_remote_user(struct Client *source_p)
53{
54
55 if (!HasSentEob(source_p->servptr))
56 return;
57 sendto_realops_snomask_from(snomask_modes['F'], L_ALL, source_p->servptr,
58 "Client connecting: %s (%s@%s) [%s] {%s} [%s]",
59 source_p->name, source_p->username, source_p->orighost,
60 show_ip(NULL, source_p) ? source_p->sockhost : "255.255.255.255",
61 "?", source_p->info);
62}
63
64static void
65h_gcn_client_exit(hook_data_client_exit *hdata)
66{
67 struct Client *source_p;
68
69 source_p = hdata->target;
70
71 if (MyConnect(source_p) || !IsClient(source_p))
72 return;
73 if (!HasSentEob(source_p->servptr))
74 return;
75 sendto_realops_snomask_from(snomask_modes['F'], L_ALL, source_p->servptr,
76 "Client exiting: %s (%s@%s) [%s] [%s]",
77 source_p->name,
78 source_p->username, source_p->host, hdata->comment,
79 show_ip(NULL, source_p) ? source_p->sockhost : "255.255.255.255");
80}