ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid-7.2/modules/m_operwall.c
Revision: 34
Committed: Sun Oct 2 21:05:51 2005 UTC (18 years, 5 months ago) by lusky
Content type: text/x-csrc
File size: 3715 byte(s)
Log Message:
create 7.2 branch, we can move/rename it as needed.


File Contents

# Content
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, source_p, NULL, CAP_TS6, NOCAPS, LL_ICLIENT,
91 ":%s OPERWALL :%s", ID(source_p), message);
92 sendto_server(NULL, source_p, NULL, NOCAPS, CAP_TS6, LL_ICLIENT,
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, source_p, NULL, NOCAPS, NOCAPS, LL_ICLIENT,
113 ":%s OPERWALL :%s", parv[0], message);
114 sendto_wallops_flags(UMODE_OPERWALL, source_p, "OPERWALL - %s", message);
115 }
116
117 /*
118 * me_operwall - OPERWALL message handler
119 * (write to *all* local opers currently online)
120 * parv[0] = sender prefix
121 * parv[1] = message text
122 *
123 * Lets ms_encap handle propagation.
124 */
125 static void
126 me_operwall(struct Client *client_p, struct Client *source_p,
127 int parc, char *parv[])
128 {
129 const char *message = parv[1];
130
131 if (EmptyString(message))
132 return;
133
134 sendto_wallops_flags(UMODE_OPERWALL, source_p, "OPERWALL - %s", message);
135 }

Properties

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