This repository has been archived by the owner on Jun 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 102
/
sno_farconnect.c
82 lines (68 loc) · 2.2 KB
/
sno_farconnect.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
* Remote client connect/exit notices on snomask +F (far).
* To avoid flooding, connects/exits part of netjoins/netsplits are not shown.
* Consequently, it is not possible to use these notices to keep track
* of all clients.
* -- jilles
*/
#include "stdinc.h"
#include "modules.h"
#include "client.h"
#include "hook.h"
#include "ircd.h"
#include "send.h"
#include "s_conf.h"
#include "snomask.h"
static const char sno_desc[] =
"Adds server notice mask +F that allows operators to receive notices for connections on other servers";
static int _modinit(void);
static void _moddeinit(void);
static void h_gcn_new_remote_user(struct Client *);
static void h_gcn_client_exit(hook_data_client_exit *);
mapi_hfn_list_av1 gcn_hfnlist[] = {
{ "new_remote_user", (hookfn) h_gcn_new_remote_user },
{ "client_exit", (hookfn) h_gcn_client_exit },
{ NULL, NULL }
};
DECLARE_MODULE_AV2(globalconnexit, _modinit, _moddeinit, NULL, NULL, gcn_hfnlist, NULL, NULL, sno_desc);
static int
_modinit(void)
{
/* add the snomask to the available slot */
snomask_modes['F'] = find_snomask_slot();
/* show the fact that we are showing user information in /version */
opers_see_all_users = true;
return 0;
}
static void
_moddeinit(void)
{
/* disable the snomask and remove it from the available list */
snomask_modes['F'] = 0;
}
static void
h_gcn_new_remote_user(struct Client *source_p)
{
if (!HasSentEob(source_p->servptr))
return;
sendto_realops_snomask_from(snomask_modes['F'], L_ALL, source_p->servptr,
"Client connecting: %s (%s@%s) [%s] {%s} [%s]",
source_p->name, source_p->username, source_p->orighost,
show_ip(NULL, source_p) ? source_p->sockhost : "255.255.255.255",
"?", source_p->info);
}
static void
h_gcn_client_exit(hook_data_client_exit *hdata)
{
struct Client *source_p;
source_p = hdata->target;
if (MyConnect(source_p) || !IsClient(source_p))
return;
if (!HasSentEob(source_p->servptr))
return;
sendto_realops_snomask_from(snomask_modes['F'], L_ALL, source_p->servptr,
"Client exiting: %s (%s@%s) [%s] [%s]",
source_p->name,
source_p->username, source_p->host, hdata->comment,
show_ip(NULL, source_p) ? source_p->sockhost : "255.255.255.255");
}