ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_wallops.c
Revision: 1230
Committed: Thu Sep 22 19:41:19 2011 UTC (13 years, 11 months ago) by michael
Content type: text/x-csrc
Original Path: ircd-hybrid-8/modules/m_wallops.c
File size: 3117 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_wallops.c: Sends a message to all operators.
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 "s_conf.h"
34     #include "msg.h"
35     #include "parse.h"
36     #include "modules.h"
37     #include "s_serv.h"
38    
39    
40     /*
41     * mo_wallops (write to *all* opers currently online)
42     * parv[0] = sender prefix
43     * parv[1] = message text
44     */
45     static void
46     mo_wallops(struct Client *client_p, struct Client *source_p,
47     int parc, char *parv[])
48     {
49     const char *message = parv[1];
50    
51     if (EmptyString(message))
52     {
53     sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
54     me.name, source_p->name, "WALLOPS");
55     return;
56     }
57    
58     sendto_wallops_flags(UMODE_OPERWALL, source_p, "OPERWALL - %s", message);
59 michael 885 sendto_server(NULL, NULL, CAP_TS6, NOCAPS,
60 adx 30 ":%s WALLOPS :%s", ID(source_p), message);
61 michael 885 sendto_server(NULL, NULL, NOCAPS, CAP_TS6,
62 adx 30 ":%s WALLOPS :%s", source_p->name, message);
63     }
64    
65     /*
66     * ms_wallops (write to *all* opers currently online)
67     * parv[0] = sender prefix
68     * parv[1] = message text
69     */
70     static void
71     ms_wallops(struct Client *client_p, struct Client *source_p,
72 michael 885 int parc, char *parv[])
73 adx 30 {
74     const char *message = parv[1];
75    
76     if (EmptyString(message))
77     return;
78    
79     if (IsClient(source_p))
80     sendto_wallops_flags(UMODE_OPERWALL, source_p, "OPERWALL - %s", message);
81     else
82     sendto_wallops_flags(UMODE_WALLOP, source_p, "%s", message);
83    
84 michael 885 sendto_server(client_p, NULL, CAP_TS6, NOCAPS,
85 adx 30 ":%s WALLOPS :%s", ID(source_p), message);
86 michael 885 sendto_server(client_p, NULL, NOCAPS, CAP_TS6,
87 adx 30 ":%s WALLOPS :%s", source_p->name, message);
88     }
89    
90 michael 1230 static struct Message wallops_msgtab = {
91     "WALLOPS", 0, 0, 2, MAXPARA, MFLG_SLOW, 0,
92     {m_unregistered, m_not_oper, ms_wallops, m_ignore, mo_wallops, m_ignore}
93     };
94    
95     static void
96     module_init(void)
97     {
98     mod_add_cmd(&wallops_msgtab);
99     }
100    
101     static void
102     module_exit(void)
103     {
104     mod_del_cmd(&wallops_msgtab);
105     }
106    
107     struct module module_entry = {
108     .node = { NULL, NULL, NULL },
109     .name = NULL,
110     .version = "$Revision$",
111     .handle = NULL,
112     .modinit = module_init,
113     .modexit = module_exit,
114     .flags = 0
115     };

Properties

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