/[svn]/ircd-hybrid-8/modules/m_globops.c
ViewVC logotype

Contents of /ircd-hybrid-8/modules/m_globops.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1216 - (show annotations)
Tue Sep 13 18:22:31 2011 UTC (8 years, 4 months ago) by michael
File MIME type: text/x-chdr
File size: 3051 byte(s)
- add 'globops' to operflags

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

Properties

Name Value
svn:keywords Id Revision

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.26