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