ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/modules/m_operwall.c
Revision: 442
Committed: Sat Feb 11 23:14:21 2006 UTC (20 years, 6 months ago) by adx
Content type: text/x-csrc
File size: 3602 byte(s)
Log Message:
+ massive rewrite of module init/deinit/version headers,
  we are introducing a new module manager which deals with static
  and dynamic modules exactly the same way. (New possibilities
  include loading/unloading statically compiled modules and
  mixing static/dynamic ones in one build.)

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

Properties

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