ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_admin.c
Revision: 7006
Committed: Fri Jan 1 00:07:54 2016 UTC (10 years, 6 months ago) by michael
Content type: text/x-csrc
File size: 4207 byte(s)
Log Message:
- Update copyright years

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 7006 * Copyright (c) 1997-2016 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 michael 1230 /*! \brief Sends administrative information about this server.
40     *
41     * \param source_p Pointer to client to report to
42     */
43 michael 2964 static void
44 michael 1230 do_admin(struct Client *source_p)
45 adx 30 {
46 michael 1618 sendto_realops_flags(UMODE_SPY, L_ALL, SEND_NOTICE,
47 michael 1230 "ADMIN requested by %s (%s@%s) [%s]",
48     source_p->name, source_p->username,
49     source_p->host, source_p->servptr->name);
50    
51 michael 3109 sendto_one_numeric(source_p, &me, RPL_ADMINME, me.name);
52 michael 1568
53 michael 4340 if (!EmptyString(ConfigAdminInfo.name))
54     sendto_one_numeric(source_p, &me, RPL_ADMINLOC1, ConfigAdminInfo.name);
55     if (!EmptyString(ConfigAdminInfo.description))
56     sendto_one_numeric(source_p, &me, RPL_ADMINLOC2, ConfigAdminInfo.description);
57     if (!EmptyString(ConfigAdminInfo.email))
58     sendto_one_numeric(source_p, &me, RPL_ADMINEMAIL, ConfigAdminInfo.email);
59 adx 30 }
60    
61 michael 3300 /*! \brief ADMIN command handler
62 michael 1007 *
63     * \param source_p Pointer to allocated Client struct from which the message
64     * originally comes from. This can be a local or remote client.
65     * \param parc Integer holding the number of supplied arguments.
66     * \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL
67     * pointers.
68     * \note Valid arguments for this command are:
69 michael 3096 * - parv[0] = command
70 michael 1007 * - parv[1] = nickname/servername
71 adx 30 */
72 michael 2820 static int
73 michael 3156 m_admin(struct Client *source_p, int parc, char *parv[])
74 adx 30 {
75     static time_t last_used = 0;
76    
77 michael 4340 if ((last_used + ConfigGeneral.pace_wait_simple) > CurrentTime)
78 adx 30 {
79 michael 4759 sendto_one_numeric(source_p, &me, RPL_LOAD2HI, "ADMIN");
80 michael 2820 return 0;
81 adx 30 }
82    
83 michael 589 last_used = CurrentTime;
84    
85 michael 2196 if (!ConfigServerHide.disable_remote_commands)
86 michael 3875 if (hunt_server(source_p, ":%s ADMIN :%s", 1, parc, parv) != HUNTED_ISME)
87 michael 2820 return 0;
88 adx 30
89 michael 2964 do_admin(source_p);
90     return 0;
91 adx 30 }
92    
93 michael 3300 /*! \brief ADMIN command handler
94 michael 1007 *
95     * \param source_p Pointer to allocated Client struct from which the message
96     * originally comes from. This can be a local or remote client.
97     * \param parc Integer holding the number of supplied arguments.
98     * \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL
99     * pointers.
100     * \note Valid arguments for this command are:
101 michael 3096 * - parv[0] = command
102 michael 1007 * - parv[1] = nickname/servername
103 adx 30 */
104 michael 2820 static int
105 michael 3156 ms_admin(struct Client *source_p, int parc, char *parv[])
106 adx 30 {
107 michael 3875 if (hunt_server(source_p, ":%s ADMIN :%s", 1, parc, parv) != HUNTED_ISME)
108 michael 2820 return 0;
109 adx 30
110 michael 2964 do_admin(source_p);
111     return 0;
112 adx 30 }
113    
114 michael 2820 static struct Message admin_msgtab =
115     {
116 michael 5881 .cmd = "ADMIN",
117     .args_max = MAXPARA,
118     .handlers[UNREGISTERED_HANDLER] = m_unregistered,
119     .handlers[CLIENT_HANDLER] = m_admin,
120     .handlers[SERVER_HANDLER] = ms_admin,
121     .handlers[ENCAP_HANDLER] = m_ignore,
122     .handlers[OPER_HANDLER] = ms_admin
123 michael 1230 };
124    
125 adx 30 static void
126 michael 1230 module_init(void)
127 adx 30 {
128 michael 1230 mod_add_cmd(&admin_msgtab);
129     }
130 adx 30
131 michael 1230 static void
132     module_exit(void)
133     {
134     mod_del_cmd(&admin_msgtab);
135     }
136 michael 1144
137 michael 3785 struct module module_entry =
138 michael 2820 {
139 michael 1230 .version = "$Revision$",
140     .modinit = module_init,
141     .modexit = module_exit,
142     };

Properties

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