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_user.h" |
31 |
#include "s_serv.h" |
32 |
#include "parse.h" |
33 |
#include "modules.h" |
34 |
|
35 |
|
36 |
/* |
37 |
* mo_globops - GLOBOPS message handler |
38 |
* (write to *all* local opers currently online) |
39 |
* parv[0] = sender prefix |
40 |
* parv[1] = message text |
41 |
*/ |
42 |
static void |
43 |
mo_globops(struct Client *client_p, struct Client *source_p, |
44 |
int parc, char *parv[]) |
45 |
{ |
46 |
const char *message = parv[1]; |
47 |
|
48 |
if (!HasOFlag(source_p, OPER_FLAG_GLOBOPS)) |
49 |
{ |
50 |
sendto_one(source_p, form_str(ERR_NOPRIVS), |
51 |
me.name, source_p->name, "globops"); |
52 |
return; |
53 |
} |
54 |
|
55 |
if (EmptyString(message)) |
56 |
{ |
57 |
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), |
58 |
me.name, source_p->name, "GLOBOPS"); |
59 |
return; |
60 |
} |
61 |
|
62 |
sendto_server(NULL, CAP_TS6, NOCAPS, |
63 |
":%s GLOBOPS :%s", ID(source_p), message); |
64 |
sendto_server(NULL, NOCAPS, CAP_TS6, |
65 |
":%s GLOBOPS :%s", source_p->name, message); |
66 |
|
67 |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_GLOBAL, "from: %s: %s", |
68 |
source_p->name, message); |
69 |
} |
70 |
|
71 |
static void |
72 |
ms_globops(struct Client *client_p, struct Client *source_p, |
73 |
int parc, char *parv[]) |
74 |
{ |
75 |
if (EmptyString(parv[1])) |
76 |
return; |
77 |
|
78 |
sendto_server(client_p, CAP_TS6, NOCAPS, ":%s GLOBOPS :%s", |
79 |
ID(source_p), parv[1]); |
80 |
sendto_server(client_p, NOCAPS, CAP_TS6, ":%s GLOBOPS :%s", |
81 |
source_p->name, parv[1]); |
82 |
|
83 |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_GLOBAL, "from: %s: %s", |
84 |
source_p->name, parv[1]); |
85 |
} |
86 |
|
87 |
static struct Message globops_msgtab = { |
88 |
"GLOBOPS", 0, 0, 2, MAXPARA, MFLG_SLOW, 0, |
89 |
{ m_unregistered, m_not_oper, ms_globops, m_ignore, mo_globops, m_ignore } |
90 |
}; |
91 |
|
92 |
static void |
93 |
module_init(void) |
94 |
{ |
95 |
mod_add_cmd(&globops_msgtab); |
96 |
} |
97 |
|
98 |
static void |
99 |
module_exit(void) |
100 |
{ |
101 |
mod_del_cmd(&globops_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 |
}; |