| 1 |
/* |
| 2 |
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). |
| 3 |
* m_operwall.c: Sends a message to all IRCOps. |
| 4 |
* |
| 5 |
* Copyright (C) 2002 by the past and present ircd coders, and others. |
| 6 |
* |
| 7 |
* This program is free software; you can redistribute it and/or modify |
| 8 |
* it under the terms of the GNU General Public License as published by |
| 9 |
* the Free Software Foundation; either version 2 of the License, or |
| 10 |
* (at your option) any later version. |
| 11 |
* |
| 12 |
* This program is distributed in the hope that it will be useful, |
| 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
* GNU General Public License for more details. |
| 16 |
* |
| 17 |
* You should have received a copy of the GNU General Public License |
| 18 |
* along with this program; if not, write to the Free Software |
| 19 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
| 20 |
* USA |
| 21 |
* |
| 22 |
* $Id$ |
| 23 |
*/ |
| 24 |
|
| 25 |
#include "stdinc.h" |
| 26 |
#include "conf/conf.h" |
| 27 |
#include "handlers.h" |
| 28 |
#include "client.h" |
| 29 |
#include "ircd.h" |
| 30 |
#include "numeric.h" |
| 31 |
#include "send.h" |
| 32 |
#include "user.h" |
| 33 |
#include "msg.h" |
| 34 |
#include "parse.h" |
| 35 |
#include "server.h" |
| 36 |
|
| 37 |
static void mo_operwall(struct Client *, struct Client *, int, char *[]); |
| 38 |
static void ms_operwall(struct Client *, struct Client *, int, char *[]); |
| 39 |
static void me_operwall(struct Client *, struct Client *, int, char *[]); |
| 40 |
|
| 41 |
struct Message operwall_msgtab = { |
| 42 |
"OPERWALL", 0, 0, 2, 0, MFLG_SLOW, 0, |
| 43 |
{ m_unregistered, m_not_oper, ms_operwall, me_operwall, mo_operwall, m_ignore } |
| 44 |
}; |
| 45 |
|
| 46 |
INIT_MODULE(m_operwall, "$Revision$") |
| 47 |
{ |
| 48 |
mod_add_cmd(&operwall_msgtab); |
| 49 |
} |
| 50 |
|
| 51 |
CLEANUP_MODULE |
| 52 |
{ |
| 53 |
mod_del_cmd(&operwall_msgtab); |
| 54 |
} |
| 55 |
|
| 56 |
/* |
| 57 |
* mo_operwall - OPERWALL message handler |
| 58 |
* (write to *all* local opers currently online) |
| 59 |
* parv[0] = sender prefix |
| 60 |
* parv[1] = message text |
| 61 |
*/ |
| 62 |
static void |
| 63 |
mo_operwall(struct Client *client_p, struct Client *source_p, |
| 64 |
int parc, char *parv[]) |
| 65 |
{ |
| 66 |
const char *message = parv[1]; |
| 67 |
|
| 68 |
if (!IsOperWall(source_p)) |
| 69 |
{ |
| 70 |
sendto_one(source_p, form_str(ERR_NOPRIVS), |
| 71 |
me.name, source_p->name, "operwall"); |
| 72 |
return; |
| 73 |
} |
| 74 |
|
| 75 |
if (EmptyString(message)) |
| 76 |
{ |
| 77 |
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), |
| 78 |
me.name, source_p->name, "OPERWALL"); |
| 79 |
return; |
| 80 |
} |
| 81 |
|
| 82 |
sendto_server(NULL, source_p, NULL, CAP_TS6, NOCAPS, |
| 83 |
":%s OPERWALL :%s", ID(source_p), message); |
| 84 |
sendto_server(NULL, source_p, NULL, NOCAPS, CAP_TS6, |
| 85 |
":%s OPERWALL :%s", source_p->name, message); |
| 86 |
sendto_wallops_flags(UMODE_OPERWALL, source_p, "OPERWALL - %s", message); |
| 87 |
} |
| 88 |
|
| 89 |
/* |
| 90 |
* ms_operwall - OPERWALL message handler |
| 91 |
* (write to *all* local opers currently online) |
| 92 |
* parv[0] = sender prefix |
| 93 |
* parv[1] = message text |
| 94 |
*/ |
| 95 |
static void |
| 96 |
ms_operwall(struct Client *client_p, struct Client *source_p, |
| 97 |
int parc, char *parv[]) |
| 98 |
{ |
| 99 |
const char *message = parv[1]; |
| 100 |
|
| 101 |
if (EmptyString(message)) |
| 102 |
return; |
| 103 |
|
| 104 |
sendto_server(client_p, source_p, NULL, NOCAPS, NOCAPS, |
| 105 |
":%s OPERWALL :%s", parv[0], message); |
| 106 |
sendto_wallops_flags(UMODE_OPERWALL, source_p, "OPERWALL - %s", message); |
| 107 |
} |
| 108 |
|
| 109 |
/* |
| 110 |
* me_operwall - OPERWALL message handler |
| 111 |
* (write to *all* local opers currently online) |
| 112 |
* parv[0] = sender prefix |
| 113 |
* parv[1] = message text |
| 114 |
* |
| 115 |
* Lets ms_encap handle propagation. |
| 116 |
*/ |
| 117 |
static void |
| 118 |
me_operwall(struct Client *client_p, struct Client *source_p, |
| 119 |
int parc, char *parv[]) |
| 120 |
{ |
| 121 |
const char *message = parv[1]; |
| 122 |
|
| 123 |
if (EmptyString(message)) |
| 124 |
return; |
| 125 |
|
| 126 |
sendto_wallops_flags(UMODE_OPERWALL, source_p, "OPERWALL - %s", message); |
| 127 |
} |