ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_admin.c
Revision: 4565
Committed: Sun Aug 24 10:27:40 2014 UTC (11 years, 11 months ago) by michael
Content type: text/x-csrc
File size: 4158 byte(s)
Log Message:
- Update GPL 2 license headers

File Contents

# User Rev Content
1 adx 30 /*
2 michael 2820 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 adx 30 *
4 michael 2820 * Copyright (c) 1997-2014 ircd-hybrid development team
5 adx 30 *
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 michael 4565 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 adx 30 * 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 "client.h"
29 michael 3246 #include "irc_string.h"
30 adx 30 #include "ircd.h"
31     #include "numeric.h"
32 michael 1309 #include "conf.h"
33 michael 3347 #include "server.h"
34 adx 30 #include "send.h"
35     #include "parse.h"
36     #include "modules.h"
37    
38    
39    
40 michael 1230 /*! \brief Sends administrative information about this server.
41     *
42     * \param source_p Pointer to client to report to
43     */
44 michael 2964 static void
45 michael 1230 do_admin(struct Client *source_p)
46 adx 30 {
47 michael 1618 sendto_realops_flags(UMODE_SPY, L_ALL, SEND_NOTICE,
48 michael 1230 "ADMIN requested by %s (%s@%s) [%s]",
49     source_p->name, source_p->username,
50     source_p->host, source_p->servptr->name);
51    
52 michael 3109 sendto_one_numeric(source_p, &me, RPL_ADMINME, me.name);
53 michael 1568
54 michael 4340 if (!EmptyString(ConfigAdminInfo.name))
55     sendto_one_numeric(source_p, &me, RPL_ADMINLOC1, ConfigAdminInfo.name);
56     if (!EmptyString(ConfigAdminInfo.description))
57     sendto_one_numeric(source_p, &me, RPL_ADMINLOC2, ConfigAdminInfo.description);
58     if (!EmptyString(ConfigAdminInfo.email))
59     sendto_one_numeric(source_p, &me, RPL_ADMINEMAIL, ConfigAdminInfo.email);
60 adx 30 }
61    
62 michael 3300 /*! \brief ADMIN command handler
63 michael 1007 *
64     * \param source_p Pointer to allocated Client struct from which the message
65     * originally comes from. This can be a local or remote client.
66     * \param parc Integer holding the number of supplied arguments.
67     * \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL
68     * pointers.
69     * \note Valid arguments for this command are:
70 michael 3096 * - parv[0] = command
71 michael 1007 * - parv[1] = nickname/servername
72 adx 30 */
73 michael 2820 static int
74 michael 3156 m_admin(struct Client *source_p, int parc, char *parv[])
75 adx 30 {
76     static time_t last_used = 0;
77    
78 michael 4340 if ((last_used + ConfigGeneral.pace_wait_simple) > CurrentTime)
79 adx 30 {
80 michael 3109 sendto_one_numeric(source_p, &me, RPL_LOAD2HI);
81 michael 2820 return 0;
82 adx 30 }
83    
84 michael 589 last_used = CurrentTime;
85    
86 michael 2196 if (!ConfigServerHide.disable_remote_commands)
87 michael 3875 if (hunt_server(source_p, ":%s ADMIN :%s", 1, parc, parv) != HUNTED_ISME)
88 michael 2820 return 0;
89 adx 30
90 michael 2964 do_admin(source_p);
91     return 0;
92 adx 30 }
93    
94 michael 3300 /*! \brief ADMIN command handler
95 michael 1007 *
96     * \param source_p Pointer to allocated Client struct from which the message
97     * originally comes from. This can be a local or remote client.
98     * \param parc Integer holding the number of supplied arguments.
99     * \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL
100     * pointers.
101     * \note Valid arguments for this command are:
102 michael 3096 * - parv[0] = command
103 michael 1007 * - parv[1] = nickname/servername
104 adx 30 */
105 michael 2820 static int
106 michael 3156 ms_admin(struct Client *source_p, int parc, char *parv[])
107 adx 30 {
108 michael 3875 if (hunt_server(source_p, ":%s ADMIN :%s", 1, parc, parv) != HUNTED_ISME)
109 michael 2820 return 0;
110 adx 30
111 michael 2964 do_admin(source_p);
112     return 0;
113 adx 30 }
114    
115 michael 2820 static struct Message admin_msgtab =
116     {
117 michael 4545 "ADMIN", NULL, 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
118 michael 1569 { m_unregistered, m_admin, ms_admin, m_ignore, ms_admin, m_ignore }
119 michael 1230 };
120    
121 adx 30 static void
122 michael 1230 module_init(void)
123 adx 30 {
124 michael 1230 mod_add_cmd(&admin_msgtab);
125     }
126 adx 30
127 michael 1230 static void
128     module_exit(void)
129     {
130     mod_del_cmd(&admin_msgtab);
131     }
132 michael 1144
133 michael 3785 struct module module_entry =
134 michael 2820 {
135 michael 1230 .node = { NULL, NULL, NULL },
136     .name = NULL,
137     .version = "$Revision$",
138     .handle = NULL,
139     .modinit = module_init,
140     .modexit = module_exit,
141     .flags = 0
142     };

Properties

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