/[svn]/ircd-hybrid-7.3/modules/m_operwall.c
ViewVC logotype

Contents of /ircd-hybrid-7.3/modules/m_operwall.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1040 - (show annotations)
Tue Dec 8 21:03:57 2009 UTC (9 years, 11 months ago) by michael
File MIME type: text/x-chdr
File size: 3766 byte(s)
- ms_operwall(): add proper TS6 support

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

Properties

Name Value
svn:eol-style native
svn:keywords Id Revision

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