1 |
adx |
30 |
/* |
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 |
knight |
31 |
* $Id$ |
23 |
adx |
30 |
*/ |
24 |
|
|
|
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 "parse.h" |
33 |
|
|
#include "modules.h" |
34 |
|
|
#include "s_serv.h" |
35 |
|
|
|
36 |
|
|
|
37 |
|
|
/* |
38 |
|
|
* mo_operwall - OPERWALL message handler |
39 |
|
|
* (write to *all* local opers currently online) |
40 |
|
|
* parv[0] = sender prefix |
41 |
|
|
* parv[1] = message text |
42 |
|
|
*/ |
43 |
|
|
static void |
44 |
|
|
mo_operwall(struct Client *client_p, struct Client *source_p, |
45 |
|
|
int parc, char *parv[]) |
46 |
|
|
{ |
47 |
|
|
const char *message = parv[1]; |
48 |
|
|
|
49 |
michael |
1219 |
if (!HasOFlag(source_p, OPER_FLAG_OPERWALL)) |
50 |
adx |
30 |
{ |
51 |
|
|
sendto_one(source_p, form_str(ERR_NOPRIVS), |
52 |
|
|
me.name, source_p->name, "operwall"); |
53 |
|
|
return; |
54 |
|
|
} |
55 |
|
|
|
56 |
|
|
if (EmptyString(message)) |
57 |
|
|
{ |
58 |
|
|
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), |
59 |
|
|
me.name, source_p->name, "OPERWALL"); |
60 |
|
|
return; |
61 |
|
|
} |
62 |
|
|
|
63 |
michael |
1474 |
sendto_server(NULL, CAP_TS6, NOCAPS, |
64 |
adx |
30 |
":%s OPERWALL :%s", ID(source_p), message); |
65 |
michael |
1474 |
sendto_server(NULL, NOCAPS, CAP_TS6, |
66 |
adx |
30 |
":%s OPERWALL :%s", source_p->name, message); |
67 |
|
|
sendto_wallops_flags(UMODE_OPERWALL, source_p, "OPERWALL - %s", message); |
68 |
|
|
} |
69 |
|
|
|
70 |
|
|
/* |
71 |
|
|
* ms_operwall - OPERWALL message handler |
72 |
|
|
* (write to *all* local opers currently online) |
73 |
|
|
* parv[0] = sender prefix |
74 |
|
|
* parv[1] = message text |
75 |
|
|
*/ |
76 |
|
|
static void |
77 |
|
|
ms_operwall(struct Client *client_p, struct Client *source_p, |
78 |
|
|
int parc, char *parv[]) |
79 |
|
|
{ |
80 |
|
|
const char *message = parv[1]; |
81 |
|
|
|
82 |
|
|
if (EmptyString(message)) |
83 |
|
|
return; |
84 |
|
|
|
85 |
michael |
1474 |
sendto_server(client_p, CAP_TS6, NOCAPS, ":%s OPERWALL :%s", |
86 |
michael |
1040 |
ID(source_p), message); |
87 |
michael |
1474 |
sendto_server(client_p, NOCAPS, CAP_TS6, ":%s OPERWALL :%s", |
88 |
michael |
885 |
source_p->name, message); |
89 |
adx |
30 |
sendto_wallops_flags(UMODE_OPERWALL, source_p, "OPERWALL - %s", message); |
90 |
|
|
} |
91 |
|
|
|
92 |
|
|
/* |
93 |
|
|
* me_operwall - OPERWALL message handler |
94 |
|
|
* (write to *all* local opers currently online) |
95 |
|
|
* parv[0] = sender prefix |
96 |
|
|
* parv[1] = message text |
97 |
|
|
* |
98 |
|
|
* Lets ms_encap handle propagation. |
99 |
|
|
*/ |
100 |
|
|
static void |
101 |
|
|
me_operwall(struct Client *client_p, struct Client *source_p, |
102 |
|
|
int parc, char *parv[]) |
103 |
|
|
{ |
104 |
|
|
const char *message = parv[1]; |
105 |
|
|
|
106 |
|
|
if (EmptyString(message)) |
107 |
|
|
return; |
108 |
|
|
|
109 |
|
|
sendto_wallops_flags(UMODE_OPERWALL, source_p, "OPERWALL - %s", message); |
110 |
|
|
} |
111 |
michael |
1230 |
|
112 |
|
|
static struct Message operwall_msgtab = { |
113 |
|
|
"OPERWALL", 0, 0, 2, MAXPARA, MFLG_SLOW, 0, |
114 |
|
|
{m_unregistered, m_not_oper, ms_operwall, me_operwall, mo_operwall, m_ignore} |
115 |
|
|
}; |
116 |
|
|
|
117 |
|
|
static void |
118 |
|
|
module_init(void) |
119 |
|
|
{ |
120 |
|
|
mod_add_cmd(&operwall_msgtab); |
121 |
|
|
} |
122 |
|
|
|
123 |
|
|
static void |
124 |
|
|
module_exit(void) |
125 |
|
|
{ |
126 |
|
|
mod_del_cmd(&operwall_msgtab); |
127 |
|
|
} |
128 |
|
|
|
129 |
|
|
struct module module_entry = { |
130 |
|
|
.node = { NULL, NULL, NULL }, |
131 |
|
|
.name = NULL, |
132 |
|
|
.version = "$Revision$", |
133 |
|
|
.handle = NULL, |
134 |
|
|
.modinit = module_init, |
135 |
|
|
.modexit = module_exit, |
136 |
|
|
.flags = 0 |
137 |
|
|
}; |