ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid-8/modules/m_globops.c
Revision: 1206
Committed: Wed Aug 24 21:41:23 2011 UTC (15 years, 1 month ago) by michael
Content type: text/x-csrc
File size: 2898 byte(s)
Log Message:
- Implement GLOBOPS
- remove debugging code from parse.c

File Contents

# User Rev Content
1 michael 1206 /*
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     static void mo_globops(struct Client *, struct Client *, int, char *[]);
40     static void ms_globops(struct Client *, struct Client *, int, char *[]);
41    
42     struct Message globops_msgtab = {
43     "GLOBOPS", 0, 0, 2, MAXPARA, MFLG_SLOW, 0,
44     { m_unregistered, m_not_oper, ms_globops, m_ignore, mo_globops, m_ignore }
45     };
46    
47     void
48     _modinit(void)
49     {
50     mod_add_cmd(&globops_msgtab);
51     }
52    
53     void
54     _moddeinit(void)
55     {
56     mod_del_cmd(&globops_msgtab);
57     }
58    
59     const char *_version = "$Revision$";
60    
61     /*
62     * mo_globops - GLOBOPS message handler
63     * (write to *all* local opers currently online)
64     * parv[0] = sender prefix
65     * parv[1] = message text
66     */
67     static void
68     mo_globops(struct Client *client_p, struct Client *source_p,
69     int parc, char *parv[])
70     {
71     const char *message = parv[1];
72    
73     if (EmptyString(message))
74     {
75     sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
76     me.name, source_p->name, "GLOBOPS");
77     return;
78     }
79    
80     sendto_server(NULL, NULL, CAP_TS6, NOCAPS,
81     ":%s GLOBOPS :%s", ID(source_p), message);
82     sendto_server(NULL, NULL, NOCAPS, CAP_TS6,
83     ":%s GLOBOPS :%s", source_p->name, message);
84    
85     sendto_globops_flags(UMODE_ALL, L_ALL, "from: %s: %s",
86     source_p->name, message);
87     }
88    
89     static void
90     ms_globops(struct Client *client_p, struct Client *source_p,
91     int parc, char *parv[])
92     {
93     if (parc != 2 || EmptyString(parv[1]))
94     return;
95    
96     sendto_server(client_p, NULL, CAP_TS6, NOCAPS, ":%s GLOBOPS :%s",
97     ID(source_p), parv[1]);
98     sendto_server(client_p, NULL, NOCAPS, CAP_TS6, ":%s GLOBOPS :%s",
99     source_p->name, parv[1]);
100    
101     sendto_globops_flags(UMODE_ALL, L_ALL, "from: %s: %s",
102     source_p->name, parv[1]);
103     }

Properties

Name Value
svn:keywords Id Revision