2007-01-25 07:40:21 +01:00
|
|
|
/*
|
|
|
|
* ircd-ratbox: A slightly useful ircd.
|
|
|
|
* m_wallops.c: Sends a message to all operators.
|
|
|
|
*
|
|
|
|
* Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
|
|
|
|
* Copyright (C) 1996-2002 Hybrid Development Team
|
|
|
|
* Copyright (C) 2002-2005 ircd-ratbox development team
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
|
* USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "stdinc.h"
|
|
|
|
#include "client.h"
|
|
|
|
#include "ircd.h"
|
2008-04-20 07:47:38 +02:00
|
|
|
#include "match.h"
|
2007-01-25 07:40:21 +01:00
|
|
|
#include "numeric.h"
|
|
|
|
#include "send.h"
|
|
|
|
#include "s_user.h"
|
|
|
|
#include "s_conf.h"
|
|
|
|
#include "s_newconf.h"
|
|
|
|
#include "msg.h"
|
|
|
|
#include "parse.h"
|
|
|
|
#include "modules.h"
|
|
|
|
#include "s_serv.h"
|
|
|
|
|
2016-03-09 08:29:41 +01:00
|
|
|
static const char wallops_desc[] =
|
|
|
|
"Provides the WALLOPS and OPERWALL commands to message online operators";
|
|
|
|
|
2016-02-11 03:54:17 +01:00
|
|
|
static int mo_operwall(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
|
|
|
|
static int ms_operwall(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
|
|
|
|
static int ms_wallops(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
struct Message wallops_msgtab = {
|
2016-02-19 23:42:40 +01:00
|
|
|
"WALLOPS", 0, 0, 0, 0,
|
2007-01-25 07:40:21 +01:00
|
|
|
{mg_unreg, mg_not_oper, {ms_wallops, 2}, {ms_wallops, 2}, mg_ignore, {ms_wallops, 2}}
|
|
|
|
};
|
|
|
|
struct Message operwall_msgtab = {
|
2016-02-19 23:42:40 +01:00
|
|
|
"OPERWALL", 0, 0, 0, 0,
|
2007-01-25 07:40:21 +01:00
|
|
|
{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 };
|
2016-03-09 08:29:41 +01:00
|
|
|
|
2016-03-07 09:53:27 +01:00
|
|
|
DECLARE_MODULE_AV2(wallops, NULL, NULL, wallops_clist, NULL, NULL, NULL, NULL, wallops_desc);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* mo_operwall (write to *all* opers currently online)
|
|
|
|
* parv[1] = message text
|
|
|
|
*/
|
|
|
|
static int
|
2016-02-11 03:54:17 +01:00
|
|
|
mo_operwall(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
|
|
|
if(!IsOperOperwall(source_p))
|
|
|
|
{
|
|
|
|
sendto_one(source_p, form_str(ERR_NOPRIVS),
|
|
|
|
me.name, source_p->name, "operwall");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
sendto_wallops_flags(UMODE_OPERWALL, source_p, "OPERWALL - %s", parv[1]);
|
2014-03-03 05:25:47 +01:00
|
|
|
sendto_server(client_p, NULL, CAP_TS6, NOCAPS, ":%s OPERWALL :%s",
|
2007-01-25 07:40:21 +01:00
|
|
|
use_id(source_p), parv[1]);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ms_operwall - OPERWALL message handler
|
|
|
|
* (write to *all* local opers currently online)
|
|
|
|
* parv[1] = message text
|
|
|
|
*/
|
|
|
|
static int
|
2016-02-11 03:54:17 +01:00
|
|
|
ms_operwall(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
|
|
|
sendto_server(client_p, NULL, CAP_TS6, NOCAPS, ":%s OPERWALL :%s",
|
|
|
|
use_id(source_p), 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
|
2016-02-11 03:54:17 +01:00
|
|
|
ms_wallops(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
|
|
|
const char *prefix = "";
|
|
|
|
|
2007-12-24 21:47:05 +01:00
|
|
|
if (MyClient(source_p) && !IsOperMassNotice(source_p))
|
|
|
|
{
|
|
|
|
sendto_one(source_p, form_str(ERR_NOPRIVS),
|
|
|
|
me.name, source_p->name, "mass_notice");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
if (IsPerson(source_p))
|
|
|
|
{
|
|
|
|
if (!strncmp(parv[1], "OPERWALL - ", 11) ||
|
|
|
|
!strncmp(parv[1], "LOCOPS - ", 9) ||
|
2007-12-17 18:50:22 +01:00
|
|
|
!strncmp(parv[1], "SLOCOPS - ", 10) ||
|
|
|
|
!strncmp(parv[1], "ADMINWALL - ", 12))
|
2007-01-25 07:40:21 +01:00
|
|
|
prefix = "WALLOPS - ";
|
|
|
|
}
|
|
|
|
|
|
|
|
sendto_wallops_flags(UMODE_WALLOP, source_p, "%s%s", prefix, parv[1]);
|
|
|
|
|
2014-03-03 05:25:47 +01:00
|
|
|
sendto_server(client_p, NULL, CAP_TS6, NOCAPS, ":%s WALLOPS :%s",
|
2007-01-25 07:40:21 +01:00
|
|
|
use_id(source_p), parv[1]);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|