]> jfr.im git - solanum.git/blob - extensions/sno_globaloper.c
m_stats: z: remove unnecessary casting and fix format strings
[solanum.git] / extensions / sno_globaloper.c
1 /*
2 * Remote oper up notices.
3 */
4
5 #include "stdinc.h"
6 #include "modules.h"
7 #include "client.h"
8 #include "hook.h"
9 #include "ircd.h"
10 #include "send.h"
11 #include "s_conf.h"
12 #include "snomask.h"
13
14 static const char sno_desc[] =
15 "Adds server notices for remote oper up";
16
17 static void h_sgo_umode_changed(void *);
18
19 mapi_hfn_list_av1 sgo_hfnlist[] = {
20 { "umode_changed", h_sgo_umode_changed },
21 { NULL, NULL }
22 };
23
24 DECLARE_MODULE_AV2(sno_globaloper, NULL, NULL, NULL, NULL, sgo_hfnlist, NULL, NULL, sno_desc);
25
26 static void
27 h_sgo_umode_changed(void *vdata)
28 {
29 hook_data_umode_changed *data = (hook_data_umode_changed *)vdata;
30 struct Client *source_p = data->client;
31
32 if (MyConnect(source_p) || !HasSentEob(source_p->servptr))
33 return;
34
35 if (!(data->oldumodes & UMODE_OPER) && IsOper(source_p))
36 sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
37 "%s (%s@%s) is now an operator",
38 source_p->name, source_p->username, source_p->host);
39 }