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

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 *
4 * Copyright (C) 2002 by the past and present ircd coders, and others.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19 * USA
20 *
21 * $Id$
22 */
23
24 #include "stdinc.h"
25 #include "handlers.h"
26 #include "client.h"
27 #include "ircd.h"
28 #include "irc_string.h"
29 #include "numeric.h"
30 #include "send.h"
31 #include "s_conf.h"
32 #include "s_user.h"
33 #include "s_serv.h"
34 #include "hash.h"
35 #include "msg.h"
36 #include "parse.h"
37 #include "modules.h"
38
39
40 /*
41 * mo_globops - GLOBOPS message handler
42 * (write to *all* local opers currently online)
43 * parv[0] = sender prefix
44 * parv[1] = message text
45 */
46 static void
47 mo_globops(struct Client *client_p, struct Client *source_p,
48 int parc, char *parv[])
49 {
50 const char *message = parv[1];
51
52 if (!HasOFlag(source_p, OPER_FLAG_GLOBOPS))
53 {
54 sendto_one(source_p, form_str(ERR_NOPRIVS),
55 me.name, source_p->name, "globops");
56 return;
57 }
58
59 if (EmptyString(message))
60 {
61 sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
62 me.name, source_p->name, "GLOBOPS");
63 return;
64 }
65
66 sendto_server(NULL, NULL, CAP_TS6, NOCAPS,
67 ":%s GLOBOPS :%s", ID(source_p), message);
68 sendto_server(NULL, NULL, NOCAPS, CAP_TS6,
69 ":%s GLOBOPS :%s", source_p->name, message);
70
71 sendto_globops_flags(UMODE_ALL, L_ALL, "from: %s: %s",
72 source_p->name, message);
73 }
74
75 static void
76 ms_globops(struct Client *client_p, struct Client *source_p,
77 int parc, char *parv[])
78 {
79 if (EmptyString(parv[1]))
80 return;
81
82 sendto_server(client_p, NULL, CAP_TS6, NOCAPS, ":%s GLOBOPS :%s",
83 ID(source_p), parv[1]);
84 sendto_server(client_p, NULL, NOCAPS, CAP_TS6, ":%s GLOBOPS :%s",
85 source_p->name, parv[1]);
86
87 sendto_globops_flags(UMODE_ALL, L_ALL, "from: %s: %s",
88 source_p->name, parv[1]);
89 }
90
91 static struct Message globops_msgtab = {
92 "GLOBOPS", 0, 0, 2, MAXPARA, MFLG_SLOW, 0,
93 { m_unregistered, m_not_oper, ms_globops, m_ignore, mo_globops, m_ignore }
94 };
95
96 static void
97 module_init(void)
98 {
99 mod_add_cmd(&globops_msgtab);
100 }
101
102 static void
103 module_exit(void)
104 {
105 mod_del_cmd(&globops_msgtab);
106 }
107
108 struct module module_entry = {
109 .node = { NULL, NULL, NULL },
110 .name = NULL,
111 .version = "$Revision$",
112 .handle = NULL,
113 .modinit = module_init,
114 .modexit = module_exit,
115 .flags = 0
116 };

Properties

Name Value
svn:keywords Id Revision