]> jfr.im git - irc/rqf/shadowircd.git/blame - modules/m_version.c
Removal of ancient SVN ID's part one
[irc/rqf/shadowircd.git] / modules / m_version.c
CommitLineData
212380e3 1/*
2 * ircd-ratbox: A slightly useful ircd.
3 * m_version.c: Shows ircd version information.
4 *
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
8 *
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.
13 *
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.
18 *
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
23 *
212380e3 24 */
25
26#include <stdinc.h>
27#include "client.h"
28#include "ircd.h"
29#include "numeric.h"
30#include "s_conf.h"
31#include "s_serv.h"
32#include "supported.h"
33#include "send.h"
34#include "msg.h"
35#include "parse.h"
36#include "modules.h"
37
38static char *confopts(struct Client *source_p);
39
40static int m_version(struct Client *, struct Client *, int, const char **);
41static int mo_version(struct Client *, struct Client *, int, const char **);
42
43struct Message version_msgtab = {
44 "VERSION", 0, 0, 0, MFLG_SLOW,
45 {mg_unreg, {m_version, 0}, {mo_version, 0}, {mo_version, 0}, mg_ignore, {mo_version, 0}}
46};
47
48mapi_clist_av1 version_clist[] = { &version_msgtab, NULL };
49DECLARE_MODULE_AV1(version, NULL, NULL, version_clist, NULL, NULL, "$Revision: 1887 $");
50
51/*
52 * m_version - VERSION command handler
212380e3 53 * parv[1] = remote server
54 */
55static int
56m_version(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
57{
58 static time_t last_used = 0L;
59
60 if(parc > 1)
61 {
9f6bbe3c 62 if((last_used + ConfigFileEntry.pace_wait) > rb_current_time())
212380e3 63 {
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;
68 }
69 else
9f6bbe3c 70 last_used = rb_current_time();
212380e3 71
72 if(hunt_server(client_p, source_p, ":%s VERSION :%s", 1, parc, parv) != HUNTED_ISME)
73 return 0;
74 }
75
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);
80
81 show_isupport(source_p);
82
83 return 0;
84}
85
86/*
87 * mo_version - VERSION command handler
212380e3 88 * parv[1] = remote server
89 */
90static int
91mo_version(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
92{
93 if(hunt_server(client_p, source_p, ":%s VERSION :%s", 1, parc, parv) == HUNTED_ISME)
94 {
95 sendto_one_numeric(source_p, RPL_VERSION, form_str(RPL_VERSION),
96 ircd_version, serno,
97 me.name, confopts(source_p), TS_CURRENT,
98 ServerInfo.sid);
99 show_isupport(source_p);
100 }
101
102 return 0;
103}
104
105/* confopts()
106 * input - client pointer
107 * output - ircd.conf option string
108 * side effects - none
109 */
110static char *
111confopts(struct Client *source_p)
112{
113 static char result[15];
114 char *p;
115
116 result[0] = '\0';
117 p = result;
118
119 if(ConfigChannel.use_except)
120 *p++ = 'e';
121
212380e3 122 /* might wanna hide this :P */
123 if(ServerInfo.hub)
124 *p++ = 'H';
125
126 if(ConfigChannel.use_invex)
127 *p++ = 'I';
128
129 if(ConfigChannel.use_knock)
130 *p++ = 'K';
131
132 *p++ = 'M';
133 *p++ = 'p';
134
135 if(opers_see_all_users || ConfigFileEntry.operspy_dont_care_user_info)
136 *p++ = 'S';
137#ifdef IGNORE_BOGUS_TS
138 *p++ = 'T';
139#endif
140
141#ifdef HAVE_LIBZ
142 *p++ = 'Z';
143#endif
144
2c2e0aa9 145#ifdef RB_IPV6
212380e3 146 *p++ = '6';
147#endif
148
149 *p = '\0';
150
151 return result;
152}