Remove cruft left behind by removed stats_p_hook.
[seven-1.x.git] / modules / m_admin.c
blob7b53fabe85a73a64a915dc9d7f1d716b0d950bb2
1 /* {{{ irc-seven: Cows like it.
3 * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center.
4 * Copyright (C) 1996-2002 Hybrid Development Team.
5 * Copyright (C) 2002-2005 ircd-ratbox development team.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to:
20 * Free Software Foundation, Inc.
21 * 51 Franklin St - Fifth Floor
22 * Boston, MA 02110-1301
23 * USA
25 * }}} */
27 /* {{{ Includes. */
28 #include "stdinc.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 "hook.h"
38 #include "modules.h"
39 /* }}} */
41 static int m_admin (struct Client *, struct Client *, int, const char **);
42 static int mr_admin (struct Client *, struct Client *, int, const char **);
43 static int ms_admin (struct Client *, struct Client *, int, const char **);
45 static int do_admin (struct Client *source_p);
47 /* {{{ static struct Message = { ... } */
48 static struct Message admin_msgtab =
50 "ADMIN", 0, 0, 0, MFLG_SLOW | MFLG_UNREG,
52 {mr_admin, 0}, {m_admin, 0}, {ms_admin, 0},
53 mg_ignore, mg_ignore, {ms_admin, 0},
56 /* }}} */
58 /* {{{ mapi_clist_av1 admin_clist[] = { ... } */
59 mapi_clist_av1 admin_clist[] =
61 &admin_msgtab,
62 NULL,
64 /* }}} */
66 /* {{{ DECLARE_MODULE_AV1(...) */
67 DECLARE_MODULE_AV1
69 admin,
70 NULL,
71 NULL,
72 admin_clist,
73 NULL,
74 NULL,
75 "1.1"
77 /* }}} */
79 /* {{{ static int mr_admin()
81 * ADMIN message handler.
83 * Usage:
84 * ADMIN
86 * parv[0] - prefix
88 static int
89 mr_admin (struct Client *client_p, struct Client *source_p, int parc, const char **parv)
91 static time_t last_used = 0;
93 if ((last_used + ConfigFileEntry.pace_wait) > CurrentTime)
95 sendto_one(source_p, form_str(RPL_LOAD2HI), me.name,
96 EmptyString(source_p->name) ? "*" : source_p->name,
97 "ADMIN");
98 return 0;
100 else
101 last_used = CurrentTime;
103 return do_admin(source_p);
105 /* }}} */
107 /* {{{ static int m_admin()
109 * ADMIN message handler.
111 * Usage:
112 * ADMIN [<server>]
114 * parv[0] - prefix
115 * parv[1] - server
117 static int
118 m_admin (struct Client *client_p, struct Client *source_p, int parc, const char **parv)
120 static time_t last_used = 0;
121 int hunted;
123 if (parc > 1)
125 if ((last_used + ConfigFileEntry.pace_wait) > CurrentTime)
127 sendto_one(source_p, form_str(RPL_LOAD2HI), me.name,
128 source_p->name, "ADMIN");
129 return 0;
131 else
132 last_used = CurrentTime;
134 hunted = hunt_server(client_p, source_p, ":%s ADMIN :%s", 1, parc, parv);
135 if (hunted != HUNTED_ISME)
136 return 0;
139 return do_admin(source_p);
141 /* }}} */
143 /* {{{ static int ms_admin()
145 * ADMIN oper/server message handler.
147 * Usage:
148 * ADMIN [<server>]
150 * parv[0] - prefix
151 * parv[1] - server
153 static int
154 ms_admin (struct Client *client_p, struct Client *source_p, int parc, const char **parv)
156 int hunted;
158 hunted = hunt_server(client_p, source_p, ":%s ADMIN :%s", 1, parc, parv);
159 if (hunted != HUNTED_ISME)
160 return 0;
162 return do_admin(source_p);
164 /* }}} */
166 /* {{{ static int do_admin()
168 * Perform actual ADMIN work.
170 static int
171 do_admin (struct Client *source_p)
173 const char *myname = NULL;
174 const char *nick = NULL;
176 myname = get_id(&me, source_p);
177 nick = EmptyString(source_p->name) ? "*" : get_id(source_p, source_p);
179 sendto_one(source_p, form_str(RPL_ADMINME), myname, nick, me.name);
180 if(AdminInfo.name != NULL)
181 sendto_one(source_p, form_str(RPL_ADMINLOC1), myname, nick,
182 AdminInfo.name);
183 if(AdminInfo.description != NULL)
184 sendto_one(source_p, form_str(RPL_ADMINLOC2), myname, nick,
185 AdminInfo.description);
186 if(AdminInfo.email != NULL)
187 sendto_one(source_p, form_str(RPL_ADMINEMAIL), myname, nick,
188 AdminInfo.email);
190 return 0;
192 /* }}} */
195 * vim: ts=8 sw=8 noet fdm=marker tw=80