X-Git-Url: https://jfr.im/git/solanum.git/blobdiff_plain/326217c4d00d436992a5e673755971b5e111b282..ea51635c016b132b4674468ab06b503d4fac74cd:/modules/m_wallops.c diff --git a/modules/m_wallops.c b/modules/m_wallops.c index 82a29657..f64bc96e 100644 --- a/modules/m_wallops.c +++ b/modules/m_wallops.c @@ -20,14 +20,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA - * - * $Id: m_wallops.c 1377 2006-05-20 13:48:37Z jilles $ */ #include "stdinc.h" #include "client.h" #include "ircd.h" -#include "irc_string.h" +#include "match.h" #include "numeric.h" #include "send.h" #include "s_user.h" @@ -38,72 +36,74 @@ #include "modules.h" #include "s_serv.h" -static int mo_operwall(struct Client *, struct Client *, int, const char **); -static int ms_operwall(struct Client *, struct Client *, int, const char **); -static int ms_wallops(struct Client *, struct Client *, int, const char **); +static const char wallops_desc[] = + "Provides the WALLOPS and OPERWALL commands to message online operators"; + +static void mo_operwall(struct MsgBuf *, struct Client *, struct Client *, int, const char **); +static void ms_operwall(struct MsgBuf *, struct Client *, struct Client *, int, const char **); +static void ms_wallops(struct MsgBuf *, struct Client *, struct Client *, int, const char **); struct Message wallops_msgtab = { - "WALLOPS", 0, 0, 0, MFLG_SLOW, + "WALLOPS", 0, 0, 0, 0, {mg_unreg, mg_not_oper, {ms_wallops, 2}, {ms_wallops, 2}, mg_ignore, {ms_wallops, 2}} }; struct Message operwall_msgtab = { - "OPERWALL", 0, 0, 0, MFLG_SLOW, + "OPERWALL", 0, 0, 0, 0, {mg_unreg, mg_not_oper, {ms_operwall, 2}, mg_ignore, mg_ignore, {mo_operwall, 2}} }; mapi_clist_av1 wallops_clist[] = { &wallops_msgtab, &operwall_msgtab, NULL }; -DECLARE_MODULE_AV1(wallops, NULL, NULL, wallops_clist, NULL, NULL, "$Revision: 1377 $"); + +DECLARE_MODULE_AV2(wallops, NULL, NULL, wallops_clist, NULL, NULL, NULL, NULL, wallops_desc); /* * mo_operwall (write to *all* opers currently online) * parv[1] = message text */ -static int -mo_operwall(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) +static void +mo_operwall(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { if(!IsOperOperwall(source_p)) { sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "operwall"); - return 0; + return; } sendto_wallops_flags(UMODE_OPERWALL, source_p, "OPERWALL - %s", parv[1]); - sendto_server(client_p, NULL, CAP_TS6, NOCAPS, ":%s OPERWALL :%s", + sendto_server(client_p, NULL, CAP_TS6, NOCAPS, ":%s OPERWALL :%s", use_id(source_p), parv[1]); - sendto_server(client_p, NULL, NOCAPS, CAP_TS6, ":%s OPERWALL :%s", - source_p->name, parv[1]); - - return 0; } /* * ms_operwall - OPERWALL message handler * (write to *all* local opers currently online) - * parv[0] = sender prefix * parv[1] = message text */ -static int -ms_operwall(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) +static void +ms_operwall(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { sendto_server(client_p, NULL, CAP_TS6, NOCAPS, ":%s OPERWALL :%s", use_id(source_p), parv[1]); - sendto_server(client_p, NULL, NOCAPS, CAP_TS6, ":%s OPERWALL :%s", - source_p->name, parv[1]); sendto_wallops_flags(UMODE_OPERWALL, source_p, "OPERWALL - %s", parv[1]); - - return 0; } /* * ms_wallops (write to *all* opers currently online) * parv[1] = message text */ -static int -ms_wallops(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) +static void +ms_wallops(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { const char *prefix = ""; + if (MyClient(source_p) && !HasPrivilege(source_p, "oper:wallops")) + { + sendto_one(source_p, form_str(ERR_NOPRIVS), + me.name, source_p->name, "wallops"); + return; + } + if (IsPerson(source_p)) { if (!strncmp(parv[1], "OPERWALL - ", 11) || @@ -115,11 +115,7 @@ ms_wallops(struct Client *client_p, struct Client *source_p, int parc, const cha sendto_wallops_flags(UMODE_WALLOP, source_p, "%s%s", prefix, parv[1]); - sendto_server(client_p, NULL, CAP_TS6, NOCAPS, ":%s WALLOPS :%s", + sendto_server(client_p, NULL, CAP_TS6, NOCAPS, ":%s WALLOPS :%s", use_id(source_p), parv[1]); - sendto_server(client_p, NULL, NOCAPS, CAP_TS6, ":%s WALLOPS :%s", - source_p->name, parv[1]); - - return 0; }