ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_admin.c
Revision: 1144
Committed: Tue Jul 26 19:33:54 2011 UTC (14 years, 1 month ago) by michael
Content type: text/x-csrc
Original Path: ircd-hybrid-7.3/modules/m_admin.c
File size: 6087 byte(s)
Log Message:
Added back STATS/TRACE/MOTD/ADMIN request notices. Removed
   spy_*_notice modules accordingly.


File Contents

# User Rev Content
1 adx 30 /*
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    
22 michael 1007 /*! \file m_admin.c
23     * \brief Includes required functions for processing the ADMIN command.
24     * \version $Id$
25     */
26    
27 adx 30 #include "stdinc.h"
28     #include "handlers.h"
29     #include "client.h"
30     #include "ircd.h"
31     #include "numeric.h"
32     #include "s_conf.h"
33     #include "s_serv.h"
34     #include "send.h"
35     #include "msg.h"
36     #include "parse.h"
37     #include "modules.h"
38     #include "irc_string.h"
39    
40 michael 589 static void m_admin(struct Client *, struct Client *, int, char *[]);
41     static void mr_admin(struct Client *, struct Client *, int, char *[]);
42     static void ms_admin(struct Client *, struct Client *, int, char *[]);
43 adx 30 static void do_admin(struct Client *);
44    
45     struct Message admin_msgtab = {
46     "ADMIN", 0, 0, 0, 0, MFLG_SLOW | MFLG_UNREG, 0,
47     {mr_admin, m_admin, ms_admin, m_ignore, ms_admin, m_ignore}
48     };
49    
50 knight 31 const char *_version = "$Revision$";
51 adx 30
52     void
53     _modinit(void)
54     {
55     mod_add_cmd(&admin_msgtab);
56     }
57    
58     void
59     _moddeinit(void)
60     {
61     mod_del_cmd(&admin_msgtab);
62     }
63    
64 michael 1007 /*! \brief ADMIN command handler (called by unregistered,
65     * locally connected clients)
66     *
67     * \param client_p Pointer to allocated Client struct with physical connection
68     * to this server, i.e. with an open socket connected.
69     * \param source_p Pointer to allocated Client struct from which the message
70     * originally comes from. This can be a local or remote client.
71     * \param parc Integer holding the number of supplied arguments.
72     * \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL
73     * pointers.
74     * \note Valid arguments for this command are:
75     * - parv[0] = sender prefix
76 adx 30 */
77     static void
78     mr_admin(struct Client *client_p, struct Client *source_p,
79     int parc, char *parv[])
80     {
81     static time_t last_used = 0;
82 adx 269
83 michael 589 ClearCap(client_p, CAP_TS6);
84    
85 adx 269 if ((last_used + ConfigFileEntry.pace_wait_simple) > CurrentTime)
86 adx 30 {
87     sendto_one(source_p, form_str(RPL_LOAD2HI),
88     me.name, EmptyString(parv[0]) ? "*" : parv[0]);
89     return;
90     }
91    
92 michael 589 last_used = CurrentTime;
93    
94 michael 1144 do_admin(source_p);
95 adx 30 }
96    
97 michael 1007 /*! \brief NICK command handler (called by already registered,
98     * locally connected clients)
99     *
100     * \param client_p Pointer to allocated Client struct with physical connection
101     * to this server, i.e. with an open socket connected.
102     * \param source_p Pointer to allocated Client struct from which the message
103     * originally comes from. This can be a local or remote client.
104     * \param parc Integer holding the number of supplied arguments.
105     * \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL
106     * pointers.
107     * \note Valid arguments for this command are:
108     * - parv[0] = sender prefix
109     * - parv[1] = nickname/servername
110 adx 30 */
111     static void
112     m_admin(struct Client *client_p, struct Client *source_p,
113     int parc, char *parv[])
114     {
115     static time_t last_used = 0;
116    
117 adx 269 if ((last_used + ConfigFileEntry.pace_wait_simple) > CurrentTime)
118 adx 30 {
119     sendto_one(source_p,form_str(RPL_LOAD2HI),
120     me.name, source_p->name);
121     return;
122     }
123    
124 michael 589 last_used = CurrentTime;
125    
126 adx 30 if (!ConfigFileEntry.disable_remote)
127 michael 589 if (hunt_server(client_p, source_p, ":%s ADMIN :%s", 1,
128     parc, parv) != HUNTED_ISME)
129 adx 30 return;
130    
131 michael 1144 do_admin(source_p);
132 adx 30 }
133    
134 michael 1007 /*! \brief ADMIN command handler (called by operators and
135     * remotely connected clients)
136     *
137     * \param client_p Pointer to allocated Client struct with physical connection
138     * to this server, i.e. with an open socket connected.
139     * \param source_p Pointer to allocated Client struct from which the message
140     * originally comes from. This can be a local or remote client.
141     * \param parc Integer holding the number of supplied arguments.
142     * \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL
143     * pointers.
144     * \note Valid arguments for this command are:
145     * - parv[0] = sender prefix
146     * - parv[1] = nickname/servername
147 adx 30 */
148     static void
149     ms_admin(struct Client *client_p, struct Client *source_p,
150     int parc, char *parv[])
151     {
152 michael 1144 if (hunt_server(client_p, source_p, ":%s ADMIN :%s", 1,
153     parc, parv) != HUNTED_ISME)
154 adx 30 return;
155    
156     if (IsClient(source_p))
157 michael 1144 do_admin(source_p);
158 adx 30 }
159    
160 michael 1007 /*! \brief Sends administrative information about this server.
161 adx 30 *
162 michael 1007 * \param source_p Pointer to client to report to
163 adx 30 */
164     static void
165     do_admin(struct Client *source_p)
166     {
167     const char *me_name;
168     const char *nick;
169    
170 michael 1144 sendto_realops_flags(UMODE_SPY, L_ALL,
171     "ADMIN requested by %s (%s@%s) [%s]",
172     source_p->name, source_p->username,
173     source_p->host, source_p->servptr->name);
174    
175 adx 30 me_name = ID_or_name(&me, source_p->from);
176     nick = ID_or_name(source_p, source_p->from);
177    
178     sendto_one(source_p, form_str(RPL_ADMINME),
179     me_name, nick, me.name);
180     if (AdminInfo.name != NULL)
181     sendto_one(source_p, form_str(RPL_ADMINLOC1),
182     me_name, nick, AdminInfo.name);
183     if (AdminInfo.description != NULL)
184     sendto_one(source_p, form_str(RPL_ADMINLOC2),
185     me_name, nick, AdminInfo.description);
186     if (AdminInfo.email != NULL)
187     sendto_one(source_p, form_str(RPL_ADMINEMAIL),
188     me_name, nick, AdminInfo.email);
189     }

Properties

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