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