Remove cruft left behind by removed stats_p_hook.
[seven-1.x.git] / modules / m_version.c
blob45ac08d5913f60b625ef20e75200e3512d141887
1 /*
2 * ircd-ratbox: A slightly useful ircd.
3 * m_version.c: Shows ircd version information.
5 * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
6 * Copyright (C) 1996-2002 Hybrid Development Team
7 * Copyright (C) 2002-2005 ircd-ratbox development team
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 * USA
25 #include <stdinc.h>
26 #include "client.h"
27 #include "ircd.h"
28 #include "numeric.h"
29 #include "s_conf.h"
30 #include "s_serv.h"
31 #include "supported.h"
32 #include "send.h"
33 #include "msg.h"
34 #include "parse.h"
35 #include "modules.h"
37 static char *confopts(struct Client *source_p);
39 static int m_version(struct Client *, struct Client *, int, const char **);
40 static int mo_version(struct Client *, struct Client *, int, const char **);
42 struct Message version_msgtab = {
43 "VERSION", 0, 0, 0, MFLG_SLOW,
44 {mg_unreg, {m_version, 0}, {mo_version, 0}, {mo_version, 0}, mg_ignore, {mo_version, 0}}
47 mapi_clist_av1 version_clist[] = { &version_msgtab, NULL };
48 DECLARE_MODULE_AV1(version, NULL, NULL, version_clist, NULL, NULL, "$Revision: 97 $");
51 * m_version - VERSION command handler
52 * parv[0] = sender prefix
53 * parv[1] = remote server
55 static int
56 m_version(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
58 static time_t last_used = 0L;
60 if(parc > 1)
62 if((last_used + ConfigFileEntry.pace_wait) > CurrentTime)
64 /* safe enough to give this on a local connect only */
65 sendto_one(source_p, form_str(RPL_LOAD2HI),
66 me.name, source_p->name, "VERSION");
67 return 0;
69 else
70 last_used = CurrentTime;
72 if(hunt_server(client_p, source_p, ":%s VERSION :%s", 1, parc, parv) != HUNTED_ISME)
73 return 0;
76 sendto_one_numeric(source_p, RPL_VERSION, form_str(RPL_VERSION),
77 ircd_version, serno,
78 me.name, confopts(source_p), TS_CURRENT,
79 ServerInfo.sid);
81 show_isupport(source_p);
83 return 0;
87 * mo_version - VERSION command handler
88 * parv[0] = sender prefix
89 * parv[1] = remote server
91 static int
92 mo_version(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
94 if(hunt_server(client_p, source_p, ":%s VERSION :%s", 1, parc, parv) == HUNTED_ISME)
96 sendto_one_numeric(source_p, RPL_VERSION, form_str(RPL_VERSION),
97 ircd_version, serno,
98 me.name, confopts(source_p), TS_CURRENT,
99 ServerInfo.sid);
100 show_isupport(source_p);
103 return 0;
106 /* confopts()
107 * input - client pointer
108 * output - ircd.conf option string
109 * side effects - none
111 static char *
112 confopts(struct Client *source_p)
114 static char result[15];
115 char *p;
117 result[0] = '\0';
118 p = result;
120 if(ConfigChannel.use_except)
121 *p++ = 'e';
123 /* might wanna hide this :P */
124 if(ServerInfo.hub)
125 *p++ = 'H';
127 if(ConfigChannel.use_invex)
128 *p++ = 'I';
130 if(ConfigChannel.use_knock)
131 *p++ = 'K';
133 *p++ = 'M';
134 *p++ = 'p';
135 *p++ = 'S';
137 #ifdef IGNORE_BOGUS_TS
138 *p++ = 'T';
139 #endif
141 #ifdef HAVE_LIBZ
142 *p++ = 'Z';
143 #endif
145 #ifdef IPV6
146 *p++ = '6';
147 #endif
149 *p = '\0';
151 return result;