ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_version.c
Revision: 1302
Committed: Wed Mar 21 17:48:54 2012 UTC (13 years, 5 months ago) by michael
Content type: text/x-csrc
Original Path: ircd-hybrid-8/modules/m_version.c
File size: 4496 byte(s)
Log Message:
- remove servlink in preparation for tls links/compression

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 * m_version.c: Shows ircd version information.
4 *
5 * Copyright (C) 2002 by the past and present ircd coders, and others.
6 *
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.
11 *
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.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 * USA
21 *
22 * $Id$
23 */
24
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 "s_user.h"
32 #include "send.h"
33 #include "parse.h"
34 #include "modules.h"
35
36
37 /* Option string. */
38 static const char serveropts[] = {
39 ' ',
40 'T',
41 'S',
42 #ifdef TS_CURRENT
43 '0' + TS_CURRENT,
44 #endif
45 /* ONLY do TS */
46 /* ALWAYS do TS_WARNINGS */
47 'o',
48 'w',
49 '\0'
50 };
51
52 /* confopts()
53 *
54 * input - client pointer
55 * output - ircd.conf option string
56 * side effects - none
57 */
58 static char *
59 confopts(struct Client *source_p)
60 {
61 static char result[12];
62 char *p = result;
63
64 if (ConfigChannel.use_except)
65 *p++ = 'e';
66 if (ConfigFileEntry.glines)
67 *p++ = 'G';
68 *p++ = 'g';
69
70 /* might wanna hide this :P */
71 if (ServerInfo.hub &&
72 (!ConfigFileEntry.disable_remote || HasUMode(source_p, UMODE_OPER)))
73 {
74 *p++ = 'H';
75 }
76
77 if (ConfigChannel.use_invex)
78 *p++ = 'I';
79 if (ConfigChannel.use_knock)
80 *p++ = 'K';
81 *p++ = 'M';
82
83 if (ConfigFileEntry.ignore_bogus_ts)
84 *p++ = 'T';
85 *p++ = '6';
86
87 *p = '\0';
88
89 return result;
90 }
91
92 /*
93 * m_version - VERSION command handler
94 * parv[0] = sender prefix
95 * parv[1] = remote server
96 */
97 static void
98 m_version(struct Client *client_p, struct Client *source_p,
99 int parc, char *parv[])
100 {
101 static time_t last_used = 0;
102
103 if ((last_used + ConfigFileEntry.pace_wait_simple) > CurrentTime)
104 {
105 /* safe enough to give this on a local connect only */
106 sendto_one(source_p, form_str(RPL_LOAD2HI),
107 me.name, source_p->name);
108 return;
109 }
110
111 last_used = CurrentTime;
112
113 if (!ConfigFileEntry.disable_remote)
114 if (hunt_server(client_p, source_p, ":%s VERSION :%s",
115 1, parc, parv) != HUNTED_ISME)
116 return;
117
118 sendto_one(source_p, form_str(RPL_VERSION),
119 me.name, source_p->name, ircd_version, serno,
120 me.name, confopts(source_p), serveropts);
121 show_isupport(source_p);
122 }
123
124 /*
125 * mo_version - VERSION command handler
126 * parv[0] = sender prefix
127 * parv[1] = remote server
128 */
129 static void
130 mo_version(struct Client *client_p, struct Client *source_p,
131 int parc, char *parv[])
132 {
133
134 if (hunt_server(client_p, source_p, ":%s VERSION :%s",
135 1, parc, parv) != HUNTED_ISME)
136 return;
137
138 sendto_one(source_p, form_str(RPL_VERSION), me.name,
139 source_p->name, ircd_version,
140 serno, me.name, confopts(source_p), serveropts);
141
142 show_isupport(source_p);
143 }
144
145 /*
146 * ms_version - VERSION command handler
147 * parv[0] = sender prefix
148 * parv[1] = remote server
149 */
150 static void
151 ms_version(struct Client *client_p, struct Client *source_p,
152 int parc, char *parv[])
153 {
154 if (hunt_server(client_p, source_p, ":%s VERSION :%s",
155 1, parc, parv) == HUNTED_ISME)
156 {
157 sendto_one(source_p, form_str(RPL_VERSION),
158 ID_or_name(&me, client_p),
159 ID_or_name(source_p, client_p),
160 ircd_version, serno,
161 me.name, confopts(source_p), serveropts);
162 show_isupport(source_p);
163 }
164 }
165
166 static struct Message version_msgtab = {
167 "VERSION", 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
168 { m_unregistered, m_version, ms_version, m_ignore, mo_version, m_ignore }
169 };
170
171 static void
172 module_init(void)
173 {
174 mod_add_cmd(&version_msgtab);
175 }
176
177 static void
178 module_exit(void)
179 {
180 mod_del_cmd(&version_msgtab);
181 }
182
183 struct module module_entry = {
184 .node = { NULL, NULL, NULL },
185 .name = NULL,
186 .version = "$Revision$",
187 .handle = NULL,
188 .modinit = module_init,
189 .modexit = module_exit,
190 .flags = 0
191 };

Properties

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