Remove cruft left behind by removed stats_p_hook.
[seven-1.x.git] / modules / m_wallops.c
blob4290d781b683d0022fe539685e0923aee065a7bb
1 /*
2 * ircd-ratbox: A slightly useful ircd.
3 * m_wallops.c: Sends a message to all operators.
5 * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
6 * Copyright (C) 1996-2002 Hybrid Development Team
7 * Copyright (C) 2002-2005 ircd-ratbox development team
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 * USA
25 #include "stdinc.h"
26 #include "client.h"
27 #include "ircd.h"
28 #include "irc_string.h"
29 #include "numeric.h"
30 #include "send.h"
31 #include "s_user.h"
32 #include "s_conf.h"
33 #include "s_newconf.h"
34 #include "msg.h"
35 #include "parse.h"
36 #include "modules.h"
37 #include "s_serv.h"
39 static int mo_operwall(struct Client *, struct Client *, int, const char **);
40 static int ms_operwall(struct Client *, struct Client *, int, const char **);
41 static int ms_wallops(struct Client *, struct Client *, int, const char **);
43 struct Message wallops_msgtab = {
44 "WALLOPS", 0, 0, 0, MFLG_SLOW,
45 {mg_unreg, mg_not_oper, {ms_wallops, 2}, {ms_wallops, 2}, mg_ignore, {ms_wallops, 2}}
47 struct Message operwall_msgtab = {
48 "OPERWALL", 0, 0, 0, MFLG_SLOW,
49 {mg_unreg, mg_not_oper, {ms_operwall, 2}, mg_ignore, mg_ignore, {mo_operwall, 2}}
52 mapi_clist_av1 wallops_clist[] = { &wallops_msgtab, &operwall_msgtab, NULL };
53 DECLARE_MODULE_AV1(wallops, NULL, NULL, wallops_clist, NULL, NULL, "$Revision: 86 $");
56 * mo_operwall (write to *all* opers currently online)
57 * parv[1] = message text
59 static int
60 mo_operwall(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
62 if(!IsOperOperwall(source_p))
64 sendto_one(source_p, form_str(ERR_NOPRIVS),
65 me.name, source_p->name, "operwall");
66 return 0;
69 sendto_wallops_flags(UMODE_OPERWALL, source_p, "OPERWALL - %s", parv[1]);
70 sendto_server(client_p, NULL, CAP_TS6, NOCAPS, ":%s OPERWALL :%s",
71 use_id(source_p), parv[1]);
72 sendto_server(client_p, NULL, NOCAPS, CAP_TS6, ":%s OPERWALL :%s",
73 source_p->name, parv[1]);
75 return 0;
79 * ms_operwall - OPERWALL message handler
80 * (write to *all* local opers currently online)
81 * parv[0] = sender prefix
82 * parv[1] = message text
84 static int
85 ms_operwall(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
87 sendto_server(client_p, NULL, CAP_TS6, NOCAPS, ":%s OPERWALL :%s",
88 use_id(source_p), parv[1]);
89 sendto_server(client_p, NULL, NOCAPS, CAP_TS6, ":%s OPERWALL :%s",
90 source_p->name, parv[1]);
91 sendto_wallops_flags(UMODE_OPERWALL, source_p, "OPERWALL - %s", parv[1]);
93 return 0;
97 * ms_wallops (write to *all* opers currently online)
98 * parv[1] = message text
100 static int
101 ms_wallops(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
103 const char *prefix = "";
105 if(MyClient(source_p) && !IsOperWallops(source_p))
107 sendto_one(source_p, form_str(ERR_NOPRIVS),
108 me.name, source_p->name, "wallops");
110 return 0;
113 if (IsPerson(source_p))
115 if (!strncmp(parv[1], "OPERWALL - ", 11))
116 prefix = "WALLOPS - ";
119 sendto_wallops_flags(UMODE_WALLOP, source_p, "%s%s", prefix, parv[1]);
121 sendto_server(client_p, NULL, CAP_TS6, NOCAPS, ":%s WALLOPS :%s",
122 use_id(source_p), parv[1]);
123 sendto_server(client_p, NULL, NOCAPS, CAP_TS6, ":%s WALLOPS :%s",
124 source_p->name, parv[1]);
126 return 0;