1 |
/* |
2 |
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). |
3 |
* m_wallops.c: Sends a message to all operators. |
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 "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_wallops (write to *all* opers currently online) |
39 |
* parv[0] = sender prefix |
40 |
* parv[1] = message text |
41 |
*/ |
42 |
static void |
43 |
mo_wallops(struct Client *client_p, struct Client *source_p, |
44 |
int parc, char *parv[]) |
45 |
{ |
46 |
const char *message = parv[1]; |
47 |
|
48 |
if (EmptyString(message)) |
49 |
{ |
50 |
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), |
51 |
me.name, source_p->name, "WALLOPS"); |
52 |
return; |
53 |
} |
54 |
|
55 |
sendto_wallops_flags(UMODE_OPERWALL, source_p, "OPERWALL - %s", message); |
56 |
sendto_server(NULL, NULL, CAP_TS6, NOCAPS, |
57 |
":%s WALLOPS :%s", ID(source_p), message); |
58 |
sendto_server(NULL, NULL, NOCAPS, CAP_TS6, |
59 |
":%s WALLOPS :%s", source_p->name, message); |
60 |
} |
61 |
|
62 |
/* |
63 |
* ms_wallops (write to *all* opers currently online) |
64 |
* parv[0] = sender prefix |
65 |
* parv[1] = message text |
66 |
*/ |
67 |
static void |
68 |
ms_wallops(struct Client *client_p, struct Client *source_p, |
69 |
int parc, char *parv[]) |
70 |
{ |
71 |
const char *message = parv[1]; |
72 |
|
73 |
if (EmptyString(message)) |
74 |
return; |
75 |
|
76 |
if (IsClient(source_p)) |
77 |
sendto_wallops_flags(UMODE_OPERWALL, source_p, "OPERWALL - %s", message); |
78 |
else |
79 |
sendto_wallops_flags(UMODE_WALLOP, source_p, "%s", message); |
80 |
|
81 |
sendto_server(client_p, NULL, CAP_TS6, NOCAPS, |
82 |
":%s WALLOPS :%s", ID(source_p), message); |
83 |
sendto_server(client_p, NULL, NOCAPS, CAP_TS6, |
84 |
":%s WALLOPS :%s", source_p->name, message); |
85 |
} |
86 |
|
87 |
static struct Message wallops_msgtab = { |
88 |
"WALLOPS", 0, 0, 2, MAXPARA, MFLG_SLOW, 0, |
89 |
{m_unregistered, m_not_oper, ms_wallops, m_ignore, mo_wallops, m_ignore} |
90 |
}; |
91 |
|
92 |
static void |
93 |
module_init(void) |
94 |
{ |
95 |
mod_add_cmd(&wallops_msgtab); |
96 |
} |
97 |
|
98 |
static void |
99 |
module_exit(void) |
100 |
{ |
101 |
mod_del_cmd(&wallops_msgtab); |
102 |
} |
103 |
|
104 |
struct module module_entry = { |
105 |
.node = { NULL, NULL, NULL }, |
106 |
.name = NULL, |
107 |
.version = "$Revision$", |
108 |
.handle = NULL, |
109 |
.modinit = module_init, |
110 |
.modexit = module_exit, |
111 |
.flags = 0 |
112 |
}; |