ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/branches/8.1.x/modules/m_operwall.c
Revision: 1230
Committed: Thu Sep 22 19:41:19 2011 UTC (12 years, 6 months ago) by michael
Content type: text/x-csrc
Original Path: ircd-hybrid-8/modules/m_operwall.c
File size: 3729 byte(s)
Log Message:
- cleanup module loader. Make module api more flexible

File Contents

# User Rev Content
1 adx 30 /*
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 knight 31 * $Id$
23 adx 30 */
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    
39     /*
40     * mo_operwall - OPERWALL message handler
41     * (write to *all* local opers currently online)
42     * parv[0] = sender prefix
43     * parv[1] = message text
44     */
45     static void
46     mo_operwall(struct Client *client_p, struct Client *source_p,
47     int parc, char *parv[])
48     {
49     const char *message = parv[1];
50    
51 michael 1219 if (!HasOFlag(source_p, OPER_FLAG_OPERWALL))
52 adx 30 {
53     sendto_one(source_p, form_str(ERR_NOPRIVS),
54     me.name, source_p->name, "operwall");
55     return;
56     }
57    
58     if (EmptyString(message))
59     {
60     sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
61     me.name, source_p->name, "OPERWALL");
62     return;
63     }
64    
65 michael 885 sendto_server(NULL, NULL, CAP_TS6, NOCAPS,
66 adx 30 ":%s OPERWALL :%s", ID(source_p), message);
67 michael 885 sendto_server(NULL, NULL, NOCAPS, CAP_TS6,
68 adx 30 ":%s OPERWALL :%s", source_p->name, message);
69     sendto_wallops_flags(UMODE_OPERWALL, source_p, "OPERWALL - %s", message);
70     }
71    
72     /*
73     * ms_operwall - OPERWALL message handler
74     * (write to *all* local opers currently online)
75     * parv[0] = sender prefix
76     * parv[1] = message text
77     */
78     static void
79     ms_operwall(struct Client *client_p, struct Client *source_p,
80     int parc, char *parv[])
81     {
82     const char *message = parv[1];
83    
84     if (EmptyString(message))
85     return;
86    
87 michael 1040 sendto_server(client_p, NULL, CAP_TS6, NOCAPS, ":%s OPERWALL :%s",
88     ID(source_p), message);
89     sendto_server(client_p, NULL, NOCAPS, CAP_TS6, ":%s OPERWALL :%s",
90 michael 885 source_p->name, message);
91 adx 30 sendto_wallops_flags(UMODE_OPERWALL, source_p, "OPERWALL - %s", message);
92     }
93    
94     /*
95     * me_operwall - OPERWALL message handler
96     * (write to *all* local opers currently online)
97     * parv[0] = sender prefix
98     * parv[1] = message text
99     *
100     * Lets ms_encap handle propagation.
101     */
102     static void
103     me_operwall(struct Client *client_p, struct Client *source_p,
104     int parc, char *parv[])
105     {
106     const char *message = parv[1];
107    
108     if (EmptyString(message))
109     return;
110    
111     sendto_wallops_flags(UMODE_OPERWALL, source_p, "OPERWALL - %s", message);
112     }
113 michael 1230
114     static struct Message operwall_msgtab = {
115     "OPERWALL", 0, 0, 2, MAXPARA, MFLG_SLOW, 0,
116     {m_unregistered, m_not_oper, ms_operwall, me_operwall, mo_operwall, m_ignore}
117     };
118    
119     static void
120     module_init(void)
121     {
122     mod_add_cmd(&operwall_msgtab);
123     }
124    
125     static void
126     module_exit(void)
127     {
128     mod_del_cmd(&operwall_msgtab);
129     }
130    
131     struct module module_entry = {
132     .node = { NULL, NULL, NULL },
133     .name = NULL,
134     .version = "$Revision$",
135     .handle = NULL,
136     .modinit = module_init,
137     .modexit = module_exit,
138     .flags = 0
139     };

Properties

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