]> jfr.im git - solanum.git/blame - extensions/sno_globaloper.c
m_stats: z: remove unnecessary casting and fix format strings
[solanum.git] / extensions / sno_globaloper.c
CommitLineData
212380e3
AC
1/*
2 * Remote oper up notices.
212380e3
AC
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
eeabf33a
EM
14static const char sno_desc[] =
15 "Adds server notices for remote oper up";
16
212380e3
AC
17static void h_sgo_umode_changed(void *);
18
19mapi_hfn_list_av1 sgo_hfnlist[] = {
82436efb 20 { "umode_changed", h_sgo_umode_changed },
212380e3
AC
21 { NULL, NULL }
22};
23
84b4c058 24DECLARE_MODULE_AV2(sno_globaloper, NULL, NULL, NULL, NULL, sgo_hfnlist, NULL, NULL, sno_desc);
212380e3
AC
25
26static void
27h_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}