ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_admin.c
Revision: 3246
Committed: Sun Mar 30 17:37:13 2014 UTC (11 years, 5 months ago) by michael
Content type: text/x-csrc
File size: 4286 byte(s)
Log Message:
- Fixed inconsistent style in several places

File Contents

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

Properties

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