1 |
adx |
30 |
/* |
2 |
|
|
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). |
3 |
|
|
* m_info.c: Sends information about the server. |
4 |
|
|
* |
5 |
|
|
* Copyright (C) 2005 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 |
knight |
31 |
* $Id$ |
23 |
adx |
30 |
*/ |
24 |
|
|
|
25 |
|
|
#include "stdinc.h" |
26 |
michael |
1011 |
#include "list.h" |
27 |
adx |
30 |
#include "channel.h" |
28 |
|
|
#include "client.h" |
29 |
|
|
#include "irc_string.h" |
30 |
|
|
#include "ircd.h" |
31 |
|
|
#include "numeric.h" |
32 |
|
|
#include "s_serv.h" |
33 |
|
|
#include "s_user.h" |
34 |
|
|
#include "send.h" |
35 |
michael |
1309 |
#include "conf.h" |
36 |
adx |
30 |
#include "parse.h" |
37 |
|
|
#include "modules.h" |
38 |
|
|
|
39 |
michael |
1230 |
|
40 |
adx |
30 |
/* |
41 |
|
|
* jdc -- Structure for our configuration value table |
42 |
|
|
*/ |
43 |
|
|
struct InfoStruct |
44 |
|
|
{ |
45 |
|
|
const char *name; /* Displayed variable name */ |
46 |
|
|
unsigned int output_type; /* See below #defines */ |
47 |
|
|
void *option; /* Pointer reference to the value */ |
48 |
|
|
const char *desc; /* ASCII description of the variable */ |
49 |
|
|
}; |
50 |
|
|
|
51 |
|
|
/* Types for output_type in InfoStruct */ |
52 |
michael |
1827 |
#define OUTPUT_STRING 0x0001 /* Output option as %s w/ dereference */ |
53 |
|
|
#define OUTPUT_STRING_PTR 0x0002 /* Output option as %s w/out deference */ |
54 |
|
|
#define OUTPUT_DECIMAL 0x0004 /* Output option as decimal (%d) */ |
55 |
|
|
#define OUTPUT_BOOLEAN 0x0008 /* Output option as "ON" or "OFF" */ |
56 |
|
|
#define OUTPUT_BOOLEAN_YN 0x0010 /* Output option as "YES" or "NO" */ |
57 |
|
|
#define OUTPUT_BOOLEAN2 0x0020 /* Output option as "YES/NO/MASKED" */ |
58 |
adx |
30 |
|
59 |
|
|
static const struct InfoStruct info_table[] = |
60 |
|
|
{ |
61 |
|
|
/* --[ START OF TABLE ]-------------------------------------------- */ |
62 |
michael |
1318 |
|
63 |
adx |
30 |
{ |
64 |
michael |
1318 |
"CPATH", |
65 |
|
|
OUTPUT_STRING, |
66 |
|
|
&ConfigFileEntry.configfile, |
67 |
michael |
1702 |
"Path to main configuration file" |
68 |
michael |
1318 |
}, |
69 |
|
|
{ |
70 |
|
|
"DPATH", |
71 |
|
|
OUTPUT_STRING, |
72 |
|
|
&ConfigFileEntry.dpath, |
73 |
michael |
1841 |
"Root directory of installation" |
74 |
michael |
1318 |
}, |
75 |
|
|
{ |
76 |
|
|
"DLPATH", |
77 |
|
|
OUTPUT_STRING, |
78 |
|
|
&ConfigFileEntry.dlinefile, |
79 |
michael |
1702 |
"Path to D-line database file" |
80 |
michael |
1318 |
}, |
81 |
|
|
{ |
82 |
|
|
"KPATH", |
83 |
|
|
OUTPUT_STRING, |
84 |
|
|
&ConfigFileEntry.klinefile, |
85 |
michael |
1702 |
"Path to K-line database file" |
86 |
michael |
1318 |
}, |
87 |
|
|
{ |
88 |
michael |
1702 |
"GPATH", |
89 |
|
|
OUTPUT_STRING, |
90 |
|
|
&ConfigFileEntry.glinefile, |
91 |
|
|
"Path to G-line database file" |
92 |
|
|
}, |
93 |
|
|
{ |
94 |
|
|
"XPATH", |
95 |
|
|
OUTPUT_STRING, |
96 |
|
|
&ConfigFileEntry.xlinefile, |
97 |
|
|
"Path to X-line database file" |
98 |
|
|
}, |
99 |
|
|
{ |
100 |
|
|
"RESVPATH", |
101 |
|
|
OUTPUT_STRING, |
102 |
michael |
1841 |
&ConfigFileEntry.resvfile, |
103 |
michael |
1702 |
"Path to resv database file" |
104 |
|
|
}, |
105 |
|
|
{ |
106 |
adx |
30 |
"network_name", |
107 |
|
|
OUTPUT_STRING, |
108 |
|
|
&ServerInfo.network_name, |
109 |
|
|
"Network name" |
110 |
|
|
}, |
111 |
|
|
{ |
112 |
|
|
"network_desc", |
113 |
|
|
OUTPUT_STRING, |
114 |
|
|
&ServerInfo.network_desc, |
115 |
|
|
"Network description" |
116 |
|
|
}, |
117 |
|
|
{ |
118 |
|
|
"hub", |
119 |
|
|
OUTPUT_BOOLEAN_YN, |
120 |
|
|
&ServerInfo.hub, |
121 |
|
|
"Server is a hub" |
122 |
|
|
}, |
123 |
|
|
{ |
124 |
michael |
1754 |
"max_clients", |
125 |
|
|
OUTPUT_DECIMAL, |
126 |
|
|
&ServerInfo.max_clients, |
127 |
|
|
"Maximum number of clients permitted simultaneously on this server" |
128 |
|
|
}, |
129 |
|
|
{ |
130 |
|
|
"max_nick_length", |
131 |
|
|
OUTPUT_DECIMAL, |
132 |
|
|
&ServerInfo.max_nick_length, |
133 |
|
|
"Maximum nickname length" |
134 |
|
|
}, |
135 |
|
|
{ |
136 |
|
|
"max_topic_length", |
137 |
|
|
OUTPUT_DECIMAL, |
138 |
|
|
&ServerInfo.max_topic_length, |
139 |
|
|
"Maximum topic length" |
140 |
|
|
}, |
141 |
|
|
{ |
142 |
adx |
30 |
"use_logging", |
143 |
|
|
OUTPUT_BOOLEAN_YN, |
144 |
|
|
&ConfigLoggingEntry.use_logging, |
145 |
|
|
"Enable logging" |
146 |
|
|
}, |
147 |
|
|
{ |
148 |
michael |
1767 |
"disable_fake_channels", |
149 |
|
|
OUTPUT_BOOLEAN_YN, |
150 |
|
|
&ConfigChannel.disable_fake_channels, |
151 |
|
|
"Forbids channels with special ASCII characters in their name" |
152 |
|
|
}, |
153 |
|
|
{ |
154 |
adx |
30 |
"restrict_channels", |
155 |
|
|
OUTPUT_BOOLEAN_YN, |
156 |
|
|
&ConfigChannel.restrict_channels, |
157 |
|
|
"Only reserved channels are allowed" |
158 |
|
|
}, |
159 |
|
|
{ |
160 |
|
|
"knock_delay", |
161 |
|
|
OUTPUT_DECIMAL, |
162 |
|
|
&ConfigChannel.knock_delay, |
163 |
|
|
"Delay between a users KNOCK attempts" |
164 |
|
|
}, |
165 |
|
|
{ |
166 |
|
|
"knock_delay_channel", |
167 |
|
|
OUTPUT_DECIMAL, |
168 |
|
|
&ConfigChannel.knock_delay_channel, |
169 |
|
|
"Delay between KNOCK attempts to a channel" |
170 |
|
|
}, |
171 |
|
|
{ |
172 |
|
|
"max_chans_per_user", |
173 |
|
|
OUTPUT_DECIMAL, |
174 |
|
|
&ConfigChannel.max_chans_per_user, |
175 |
|
|
"Maximum number of channels a user can join" |
176 |
|
|
}, |
177 |
|
|
{ |
178 |
michael |
1432 |
"max_chans_per_oper", |
179 |
|
|
OUTPUT_DECIMAL, |
180 |
|
|
&ConfigChannel.max_chans_per_oper, |
181 |
|
|
"Maximum number of channels an oper can join" |
182 |
|
|
}, |
183 |
|
|
{ |
184 |
adx |
30 |
"quiet_on_ban", |
185 |
|
|
OUTPUT_BOOLEAN_YN, |
186 |
|
|
&ConfigChannel.quiet_on_ban, |
187 |
|
|
"Banned users may not send text to a channel" |
188 |
|
|
}, |
189 |
|
|
{ |
190 |
|
|
"max_bans", |
191 |
|
|
OUTPUT_DECIMAL, |
192 |
|
|
&ConfigChannel.max_bans, |
193 |
|
|
"Total +b/e/I modes allowed in a channel" |
194 |
|
|
}, |
195 |
|
|
{ |
196 |
|
|
"default_split_user_count", |
197 |
|
|
OUTPUT_DECIMAL, |
198 |
|
|
&ConfigChannel.default_split_user_count, |
199 |
|
|
"Startup value of SPLITUSERS" |
200 |
|
|
}, |
201 |
|
|
{ |
202 |
|
|
"default_split_server_count", |
203 |
|
|
OUTPUT_DECIMAL, |
204 |
|
|
&ConfigChannel.default_split_server_count, |
205 |
|
|
"Startup value of SPLITNUM" |
206 |
|
|
}, |
207 |
|
|
{ |
208 |
|
|
"no_create_on_split", |
209 |
|
|
OUTPUT_BOOLEAN_YN, |
210 |
|
|
&ConfigChannel.no_create_on_split, |
211 |
|
|
"Disallow creation of channels when split" |
212 |
|
|
}, |
213 |
|
|
{ |
214 |
|
|
"no_join_on_split", |
215 |
|
|
OUTPUT_BOOLEAN_YN, |
216 |
|
|
&ConfigChannel.no_join_on_split, |
217 |
|
|
"Disallow joining channels when split" |
218 |
|
|
}, |
219 |
|
|
{ |
220 |
|
|
"flatten_links", |
221 |
|
|
OUTPUT_BOOLEAN_YN, |
222 |
|
|
&ConfigServerHide.flatten_links, |
223 |
|
|
"Flatten /links list" |
224 |
|
|
}, |
225 |
|
|
{ |
226 |
|
|
"links_delay", |
227 |
|
|
OUTPUT_DECIMAL, |
228 |
|
|
&ConfigServerHide.links_delay, |
229 |
|
|
"Links rehash delay" |
230 |
|
|
}, |
231 |
|
|
{ |
232 |
|
|
"hidden", |
233 |
|
|
OUTPUT_BOOLEAN_YN, |
234 |
|
|
&ConfigServerHide.hidden, |
235 |
|
|
"Hide this server from a flattened /links on remote servers" |
236 |
|
|
}, |
237 |
|
|
{ |
238 |
|
|
"hide_servers", |
239 |
|
|
OUTPUT_BOOLEAN_YN, |
240 |
|
|
&ConfigServerHide.hide_servers, |
241 |
|
|
"Hide servernames from users" |
242 |
|
|
}, |
243 |
|
|
{ |
244 |
|
|
"hidden_name", |
245 |
|
|
OUTPUT_STRING, |
246 |
|
|
&ConfigServerHide.hidden_name, |
247 |
|
|
"Server name users see if hide_servers = yes" |
248 |
|
|
}, |
249 |
|
|
{ |
250 |
|
|
"hide_server_ips", |
251 |
|
|
OUTPUT_BOOLEAN_YN, |
252 |
|
|
&ConfigServerHide.hide_server_ips, |
253 |
|
|
"Prevent people from seeing server IPs" |
254 |
|
|
}, |
255 |
|
|
{ |
256 |
|
|
"gline_min_cidr", |
257 |
|
|
OUTPUT_DECIMAL, |
258 |
|
|
&ConfigFileEntry.gline_min_cidr, |
259 |
|
|
"Minimum required length of a CIDR bitmask for IPv4 G-Lines" |
260 |
|
|
}, |
261 |
|
|
{ |
262 |
|
|
"gline_min_cidr6", |
263 |
|
|
OUTPUT_DECIMAL, |
264 |
|
|
&ConfigFileEntry.gline_min_cidr6, |
265 |
|
|
"Minimum required length of a CIDR bitmask for IPv6 G-Lines" |
266 |
|
|
}, |
267 |
|
|
{ |
268 |
|
|
"invisible_on_connect", |
269 |
|
|
OUTPUT_BOOLEAN_YN, |
270 |
|
|
&ConfigFileEntry.invisible_on_connect, |
271 |
|
|
"Automatically set mode +i on connecting users" |
272 |
|
|
}, |
273 |
|
|
{ |
274 |
|
|
"kill_chase_time_limit", |
275 |
|
|
OUTPUT_DECIMAL, |
276 |
|
|
&ConfigFileEntry.kill_chase_time_limit, |
277 |
|
|
"Nick Change Tracker for KILL" |
278 |
|
|
}, |
279 |
|
|
{ |
280 |
|
|
"hide_spoof_ips", |
281 |
|
|
OUTPUT_BOOLEAN_YN, |
282 |
|
|
&ConfigFileEntry.hide_spoof_ips, |
283 |
|
|
"Hide spoofed IP's" |
284 |
|
|
}, |
285 |
|
|
{ |
286 |
|
|
"ignore_bogus_ts", |
287 |
|
|
OUTPUT_BOOLEAN_YN, |
288 |
|
|
&ConfigFileEntry.ignore_bogus_ts, |
289 |
|
|
"Ignore bogus timestamps from other servers" |
290 |
|
|
}, |
291 |
|
|
{ |
292 |
|
|
"disable_auth", |
293 |
|
|
OUTPUT_BOOLEAN_YN, |
294 |
|
|
&ConfigFileEntry.disable_auth, |
295 |
|
|
"Completely disable ident lookups" |
296 |
|
|
}, |
297 |
|
|
{ |
298 |
|
|
"disable_remote_commands", |
299 |
|
|
OUTPUT_BOOLEAN_YN, |
300 |
|
|
&ConfigFileEntry.disable_remote, |
301 |
|
|
"Prevent users issuing commands on remote servers" |
302 |
|
|
}, |
303 |
|
|
{ |
304 |
|
|
"tkline_expire_notices", |
305 |
|
|
OUTPUT_BOOLEAN_YN, |
306 |
|
|
&ConfigFileEntry.tkline_expire_notices, |
307 |
|
|
"Show temporary kline/xline expire notices" |
308 |
|
|
}, |
309 |
|
|
{ |
310 |
|
|
"default_floodcount", |
311 |
|
|
OUTPUT_DECIMAL, |
312 |
|
|
&ConfigFileEntry.default_floodcount, |
313 |
|
|
"Startup value of FLOODCOUNT" |
314 |
|
|
}, |
315 |
|
|
{ |
316 |
|
|
"failed_oper_notice", |
317 |
|
|
OUTPUT_BOOLEAN, |
318 |
|
|
&ConfigFileEntry.failed_oper_notice, |
319 |
michael |
1702 |
"Inform opers if someone tries to /oper with the wrong password" |
320 |
adx |
30 |
}, |
321 |
|
|
{ |
322 |
|
|
"dots_in_ident", |
323 |
|
|
OUTPUT_DECIMAL, |
324 |
|
|
&ConfigFileEntry.dots_in_ident, |
325 |
|
|
"Number of permissable dots in an ident" |
326 |
|
|
}, |
327 |
|
|
{ |
328 |
|
|
"min_nonwildcard", |
329 |
|
|
OUTPUT_DECIMAL, |
330 |
|
|
&ConfigFileEntry.min_nonwildcard, |
331 |
|
|
"Minimum non-wildcard chars in K/G lines" |
332 |
|
|
}, |
333 |
|
|
{ |
334 |
|
|
"min_nonwildcard_simple", |
335 |
|
|
OUTPUT_DECIMAL, |
336 |
|
|
&ConfigFileEntry.min_nonwildcard_simple, |
337 |
|
|
"Minimum non-wildcards in gecos bans" |
338 |
|
|
}, |
339 |
|
|
{ |
340 |
|
|
"max_accept", |
341 |
|
|
OUTPUT_DECIMAL, |
342 |
|
|
&ConfigFileEntry.max_accept, |
343 |
|
|
"Maximum nicknames on accept list" |
344 |
|
|
}, |
345 |
|
|
{ |
346 |
|
|
"anti_nick_flood", |
347 |
|
|
OUTPUT_BOOLEAN, |
348 |
|
|
&ConfigFileEntry.anti_nick_flood, |
349 |
|
|
"NICK flood protection" |
350 |
|
|
}, |
351 |
|
|
{ |
352 |
|
|
"max_nick_time", |
353 |
|
|
OUTPUT_DECIMAL, |
354 |
|
|
&ConfigFileEntry.max_nick_time, |
355 |
|
|
"NICK flood protection time interval" |
356 |
|
|
}, |
357 |
|
|
{ |
358 |
|
|
"max_nick_changes", |
359 |
|
|
OUTPUT_DECIMAL, |
360 |
|
|
&ConfigFileEntry.max_nick_changes, |
361 |
|
|
"NICK change threshhold setting" |
362 |
|
|
}, |
363 |
|
|
{ |
364 |
|
|
"anti_spam_exit_message_time", |
365 |
|
|
OUTPUT_DECIMAL, |
366 |
|
|
&ConfigFileEntry.anti_spam_exit_message_time, |
367 |
|
|
"Duration a client must be connected for to have an exit message" |
368 |
|
|
}, |
369 |
|
|
{ |
370 |
|
|
"ts_warn_delta", |
371 |
|
|
OUTPUT_DECIMAL, |
372 |
|
|
&ConfigFileEntry.ts_warn_delta, |
373 |
|
|
"Maximum permitted TS delta before displaying a warning" |
374 |
|
|
}, |
375 |
|
|
{ |
376 |
|
|
"ts_max_delta", |
377 |
|
|
OUTPUT_DECIMAL, |
378 |
|
|
&ConfigFileEntry.ts_max_delta, |
379 |
|
|
"Maximum permitted TS delta from another server" |
380 |
|
|
}, |
381 |
|
|
{ |
382 |
|
|
"warn_no_nline", |
383 |
|
|
OUTPUT_BOOLEAN, |
384 |
|
|
&ConfigFileEntry.warn_no_nline, |
385 |
|
|
"Display warning if connecting server lacks N-line" |
386 |
|
|
}, |
387 |
|
|
{ |
388 |
michael |
1767 |
"stats_e_disabled", |
389 |
|
|
OUTPUT_BOOLEAN_YN, |
390 |
|
|
&ConfigFileEntry.stats_e_disabled, |
391 |
|
|
"Whether or not STATS e is disabled" |
392 |
|
|
}, |
393 |
|
|
{ |
394 |
adx |
30 |
"stats_o_oper_only", |
395 |
|
|
OUTPUT_BOOLEAN_YN, |
396 |
|
|
&ConfigFileEntry.stats_o_oper_only, |
397 |
|
|
"STATS O output is only shown to operators" |
398 |
|
|
}, |
399 |
|
|
{ |
400 |
|
|
"stats_P_oper_only", |
401 |
|
|
OUTPUT_BOOLEAN_YN, |
402 |
|
|
&ConfigFileEntry.stats_P_oper_only, |
403 |
|
|
"STATS P is only shown to operators" |
404 |
|
|
}, |
405 |
|
|
{ |
406 |
|
|
"stats_i_oper_only", |
407 |
|
|
OUTPUT_BOOLEAN2, |
408 |
|
|
&ConfigFileEntry.stats_i_oper_only, |
409 |
|
|
"STATS I output is only shown to operators" |
410 |
|
|
}, |
411 |
|
|
{ |
412 |
|
|
"stats_k_oper_only", |
413 |
|
|
OUTPUT_BOOLEAN2, |
414 |
|
|
&ConfigFileEntry.stats_k_oper_only, |
415 |
|
|
"STATS K output is only shown to operators" |
416 |
|
|
}, |
417 |
|
|
{ |
418 |
|
|
"caller_id_wait", |
419 |
|
|
OUTPUT_DECIMAL, |
420 |
|
|
&ConfigFileEntry.caller_id_wait, |
421 |
|
|
"Minimum delay between notifying UMODE +g users of messages" |
422 |
|
|
}, |
423 |
|
|
{ |
424 |
|
|
"opers_bypass_callerid", |
425 |
|
|
OUTPUT_BOOLEAN_YN, |
426 |
|
|
&ConfigFileEntry.opers_bypass_callerid, |
427 |
|
|
"Allows IRC operators to message users who are +g (callerid)" |
428 |
|
|
}, |
429 |
|
|
{ |
430 |
|
|
"pace_wait_simple", |
431 |
|
|
OUTPUT_DECIMAL, |
432 |
|
|
&ConfigFileEntry.pace_wait_simple, |
433 |
|
|
"Minimum delay between less intensive commands" |
434 |
|
|
}, |
435 |
|
|
{ |
436 |
|
|
"pace_wait", |
437 |
|
|
OUTPUT_DECIMAL, |
438 |
|
|
&ConfigFileEntry.pace_wait, |
439 |
|
|
"Minimum delay between uses of certain commands" |
440 |
|
|
}, |
441 |
|
|
{ |
442 |
|
|
"short_motd", |
443 |
|
|
OUTPUT_BOOLEAN_YN, |
444 |
|
|
&ConfigFileEntry.short_motd, |
445 |
|
|
"Do not show MOTD; only tell clients they should read it" |
446 |
|
|
}, |
447 |
|
|
{ |
448 |
|
|
"ping_cookie", |
449 |
|
|
OUTPUT_BOOLEAN, |
450 |
|
|
&ConfigFileEntry.ping_cookie, |
451 |
|
|
"Require ping cookies to connect" |
452 |
|
|
}, |
453 |
|
|
{ |
454 |
|
|
"no_oper_flood", |
455 |
|
|
OUTPUT_BOOLEAN, |
456 |
|
|
&ConfigFileEntry.no_oper_flood, |
457 |
|
|
"Reduce flood control for operators" |
458 |
|
|
}, |
459 |
|
|
{ |
460 |
|
|
"true_no_oper_flood", |
461 |
|
|
OUTPUT_BOOLEAN, |
462 |
|
|
&ConfigFileEntry.true_no_oper_flood, |
463 |
|
|
"Completely disable flood control for operators" |
464 |
|
|
}, |
465 |
|
|
{ |
466 |
|
|
"oper_pass_resv", |
467 |
|
|
OUTPUT_BOOLEAN_YN, |
468 |
|
|
&ConfigFileEntry.oper_pass_resv, |
469 |
|
|
"Opers can over-ride RESVs" |
470 |
|
|
}, |
471 |
|
|
{ |
472 |
|
|
"max_targets", |
473 |
|
|
OUTPUT_DECIMAL, |
474 |
|
|
&ConfigFileEntry.max_targets, |
475 |
|
|
"The maximum number of PRIVMSG/NOTICE targets" |
476 |
|
|
}, |
477 |
|
|
{ |
478 |
|
|
"throttle_time", |
479 |
|
|
OUTPUT_DECIMAL, |
480 |
|
|
&ConfigFileEntry.throttle_time, |
481 |
|
|
"Minimum time between client reconnects" |
482 |
|
|
}, |
483 |
|
|
{ |
484 |
|
|
"glines", |
485 |
|
|
OUTPUT_BOOLEAN, |
486 |
|
|
&ConfigFileEntry.glines, |
487 |
|
|
"G-line (network-wide K-line) support" |
488 |
|
|
}, |
489 |
|
|
{ |
490 |
michael |
1459 |
"gline_duration", |
491 |
adx |
30 |
OUTPUT_DECIMAL, |
492 |
|
|
&ConfigFileEntry.gline_time, |
493 |
|
|
"Expiry time for G-lines" |
494 |
|
|
}, |
495 |
michael |
1459 |
{ |
496 |
|
|
"gline_request_duration", |
497 |
|
|
OUTPUT_DECIMAL, |
498 |
|
|
&ConfigFileEntry.gline_request_time, |
499 |
|
|
"Expiry time for pending G-lines" |
500 |
|
|
}, |
501 |
|
|
|
502 |
adx |
30 |
/* --[ END OF TABLE ]---------------------------------------------- */ |
503 |
|
|
{ |
504 |
|
|
NULL, |
505 |
|
|
0, |
506 |
|
|
NULL, |
507 |
|
|
0 |
508 |
|
|
} |
509 |
|
|
}; |
510 |
|
|
|
511 |
|
|
/* send_birthdate_online_time() |
512 |
|
|
* |
513 |
|
|
* inputs - client pointer to send to |
514 |
|
|
* output - NONE |
515 |
|
|
* side effects - birthdate and online time are sent |
516 |
|
|
*/ |
517 |
|
|
static void |
518 |
|
|
send_birthdate_online_time(struct Client *source_p) |
519 |
|
|
{ |
520 |
|
|
if (!MyClient(source_p) && IsCapable(source_p->from, CAP_TS6) && HasID(source_p)) |
521 |
|
|
sendto_one(source_p, ":%s %d %s :On-line since %s", |
522 |
|
|
me.id, RPL_INFO, source_p->id, |
523 |
michael |
1241 |
myctime(me.localClient->firsttime)); |
524 |
adx |
30 |
else |
525 |
|
|
sendto_one(source_p, ":%s %d %s :On-line since %s", |
526 |
|
|
me.name, RPL_INFO, source_p->name, |
527 |
michael |
1241 |
myctime(me.localClient->firsttime)); |
528 |
adx |
30 |
} |
529 |
|
|
|
530 |
|
|
/* send_conf_options() |
531 |
|
|
* |
532 |
|
|
* inputs - client pointer to send to |
533 |
|
|
* output - NONE |
534 |
|
|
* side effects - send config options to client |
535 |
|
|
*/ |
536 |
|
|
static void |
537 |
|
|
send_conf_options(struct Client *source_p) |
538 |
|
|
{ |
539 |
|
|
const char *from, *to; |
540 |
|
|
const struct InfoStruct *iptr = NULL; |
541 |
|
|
|
542 |
|
|
/* Now send them a list of all our configuration options |
543 |
michael |
912 |
* (mostly from defaults.h and config.h) |
544 |
adx |
30 |
*/ |
545 |
|
|
if (!MyClient(source_p) && IsCapable(source_p->from, CAP_TS6) && HasID(source_p)) |
546 |
|
|
{ |
547 |
|
|
from = me.id; |
548 |
|
|
to = source_p->id; |
549 |
|
|
} |
550 |
|
|
else |
551 |
|
|
{ |
552 |
|
|
from = me.name; |
553 |
|
|
to = source_p->name; |
554 |
|
|
} |
555 |
|
|
|
556 |
|
|
/* |
557 |
|
|
* Parse the info_table[] and do the magic. |
558 |
|
|
*/ |
559 |
|
|
for (iptr = info_table; iptr->name; ++iptr) |
560 |
|
|
{ |
561 |
|
|
switch (iptr->output_type) |
562 |
|
|
{ |
563 |
|
|
/* For "char *" references */ |
564 |
|
|
case OUTPUT_STRING: |
565 |
|
|
{ |
566 |
|
|
const char *option = *((char **)iptr->option); |
567 |
|
|
|
568 |
|
|
sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]", |
569 |
|
|
from, RPL_INFO, to, |
570 |
|
|
iptr->name, option ? option : "NONE", |
571 |
|
|
iptr->desc ? iptr->desc : "<none>"); |
572 |
|
|
break; |
573 |
|
|
} |
574 |
|
|
|
575 |
|
|
/* For "char foo[]" references */ |
576 |
|
|
case OUTPUT_STRING_PTR: |
577 |
|
|
{ |
578 |
|
|
const char *option = iptr->option; |
579 |
|
|
|
580 |
|
|
sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]", |
581 |
|
|
from, RPL_INFO, to, |
582 |
|
|
iptr->name, option ? option : "NONE", |
583 |
|
|
iptr->desc ? iptr->desc : "<none>"); |
584 |
|
|
break; |
585 |
|
|
} |
586 |
|
|
|
587 |
|
|
/* Output info_table[i].option as a decimal value. */ |
588 |
|
|
case OUTPUT_DECIMAL: |
589 |
|
|
{ |
590 |
|
|
const int option = *((int *)iptr->option); |
591 |
|
|
|
592 |
|
|
sendto_one(source_p, ":%s %d %s :%-30s %-5d [%-30s]", |
593 |
|
|
from, RPL_INFO, to, iptr->name, |
594 |
|
|
option, iptr->desc ? iptr->desc : "<none>"); |
595 |
|
|
break; |
596 |
|
|
} |
597 |
|
|
|
598 |
|
|
/* Output info_table[i].option as "ON" or "OFF" */ |
599 |
|
|
case OUTPUT_BOOLEAN: |
600 |
|
|
{ |
601 |
|
|
const int option = *((int *)iptr->option); |
602 |
|
|
|
603 |
|
|
sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]", |
604 |
|
|
from, RPL_INFO, to, |
605 |
|
|
iptr->name, option ? "ON" : "OFF", |
606 |
|
|
iptr->desc ? iptr->desc : "<none>"); |
607 |
|
|
|
608 |
|
|
break; |
609 |
|
|
} |
610 |
|
|
|
611 |
|
|
/* Output info_table[i].option as "YES" or "NO" */ |
612 |
|
|
case OUTPUT_BOOLEAN_YN: |
613 |
|
|
{ |
614 |
michael |
1827 |
const int option = *((int *)iptr->option); |
615 |
adx |
30 |
|
616 |
|
|
sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]", |
617 |
|
|
from, RPL_INFO, to, |
618 |
|
|
iptr->name, option ? "YES" : "NO", |
619 |
|
|
iptr->desc ? iptr->desc : "<none>"); |
620 |
|
|
break; |
621 |
|
|
} |
622 |
|
|
|
623 |
|
|
case OUTPUT_BOOLEAN2: |
624 |
|
|
{ |
625 |
michael |
1827 |
const int option = *((int *)iptr->option); |
626 |
adx |
30 |
|
627 |
|
|
sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]", |
628 |
|
|
from, RPL_INFO, to, |
629 |
|
|
iptr->name, option ? ((option == 1) ? "MASK" : "YES") : "NO", |
630 |
|
|
iptr->desc ? iptr->desc : "<none>"); |
631 |
|
|
break; |
632 |
|
|
} |
633 |
|
|
} |
634 |
|
|
} |
635 |
|
|
|
636 |
michael |
1834 |
sendto_one(source_p, form_str(RPL_INFO), |
637 |
adx |
30 |
from, to, ""); |
638 |
|
|
} |
639 |
michael |
1230 |
|
640 |
michael |
1827 |
/* send_info_text() |
641 |
|
|
* |
642 |
|
|
* inputs - client pointer to send info text to |
643 |
|
|
* output - NONE |
644 |
|
|
* side effects - info text is sent to client |
645 |
|
|
*/ |
646 |
|
|
static void |
647 |
|
|
send_info_text(struct Client *source_p) |
648 |
|
|
{ |
649 |
|
|
const char **text = infotext; |
650 |
|
|
char *source, *target; |
651 |
|
|
|
652 |
|
|
sendto_realops_flags(UMODE_SPY, L_ALL, SEND_NOTICE, |
653 |
|
|
"INFO requested by %s (%s@%s) [%s]", |
654 |
|
|
source_p->name, source_p->username, |
655 |
|
|
source_p->host, source_p->servptr->name); |
656 |
|
|
|
657 |
|
|
if (!MyClient(source_p) && IsCapable(source_p->from, CAP_TS6) && |
658 |
|
|
HasID(source_p)) |
659 |
|
|
source = me.id, target = source_p->id; |
660 |
|
|
else |
661 |
|
|
source = me.name, target = source_p->name; |
662 |
|
|
|
663 |
|
|
while (*text) |
664 |
|
|
{ |
665 |
|
|
const char *line = *text++; |
666 |
|
|
|
667 |
|
|
if (*line == '\0') |
668 |
|
|
line = " "; |
669 |
|
|
|
670 |
michael |
1834 |
sendto_one(source_p, form_str(RPL_INFO), |
671 |
michael |
1827 |
source, target, line); |
672 |
|
|
} |
673 |
|
|
|
674 |
|
|
if (HasUMode(source_p, UMODE_OPER)) |
675 |
|
|
send_conf_options(source_p); |
676 |
|
|
|
677 |
|
|
send_birthdate_online_time(source_p); |
678 |
|
|
|
679 |
michael |
1834 |
sendto_one(source_p, form_str(RPL_ENDOFINFO), |
680 |
michael |
1827 |
me.name, source_p->name); |
681 |
|
|
} |
682 |
|
|
|
683 |
|
|
/* |
684 |
|
|
** m_info() |
685 |
|
|
** parv[0] = sender prefix |
686 |
|
|
** parv[1] = servername |
687 |
|
|
*/ |
688 |
|
|
static void |
689 |
|
|
m_info(struct Client *client_p, struct Client *source_p, |
690 |
|
|
int parc, char *parv[]) |
691 |
|
|
{ |
692 |
|
|
static time_t last_used = 0; |
693 |
|
|
|
694 |
|
|
if ((last_used + ConfigFileEntry.pace_wait) > CurrentTime) |
695 |
|
|
{ |
696 |
|
|
/* safe enough to give this on a local connect only */ |
697 |
michael |
1834 |
sendto_one(source_p, form_str(RPL_LOAD2HI), |
698 |
michael |
1827 |
me.name, source_p->name); |
699 |
|
|
return; |
700 |
|
|
} |
701 |
|
|
|
702 |
|
|
last_used = CurrentTime; |
703 |
|
|
|
704 |
|
|
if (!ConfigFileEntry.disable_remote) |
705 |
|
|
if (hunt_server(client_p,source_p, ":%s INFO :%s", 1, |
706 |
|
|
parc, parv) != HUNTED_ISME) |
707 |
|
|
return; |
708 |
|
|
|
709 |
|
|
send_info_text(source_p); |
710 |
|
|
} |
711 |
|
|
|
712 |
|
|
/* |
713 |
|
|
** ms_info() |
714 |
|
|
** parv[0] = sender prefix |
715 |
|
|
** parv[1] = servername |
716 |
|
|
*/ |
717 |
|
|
static void |
718 |
|
|
ms_info(struct Client *client_p, struct Client *source_p, |
719 |
|
|
int parc, char *parv[]) |
720 |
|
|
{ |
721 |
|
|
if (!IsClient(source_p)) |
722 |
|
|
return; |
723 |
|
|
|
724 |
|
|
if (hunt_server(client_p, source_p, ":%s INFO :%s", 1, |
725 |
|
|
parc, parv) != HUNTED_ISME) |
726 |
|
|
return; |
727 |
|
|
|
728 |
|
|
send_info_text(source_p); |
729 |
|
|
} |
730 |
|
|
|
731 |
michael |
1230 |
static struct Message info_msgtab = { |
732 |
|
|
"INFO", 0, 0, 0, MAXPARA, MFLG_SLOW, 0, |
733 |
michael |
1827 |
{ m_unregistered, m_info, ms_info, m_ignore, ms_info, m_ignore } |
734 |
michael |
1230 |
}; |
735 |
|
|
|
736 |
|
|
static void |
737 |
|
|
module_init(void) |
738 |
|
|
{ |
739 |
|
|
mod_add_cmd(&info_msgtab); |
740 |
|
|
} |
741 |
|
|
|
742 |
|
|
static void |
743 |
|
|
module_exit(void) |
744 |
|
|
{ |
745 |
|
|
mod_del_cmd(&info_msgtab); |
746 |
|
|
} |
747 |
|
|
|
748 |
|
|
struct module module_entry = { |
749 |
|
|
.node = { NULL, NULL, NULL }, |
750 |
|
|
.name = NULL, |
751 |
|
|
.version = "$Revision$", |
752 |
|
|
.handle = NULL, |
753 |
|
|
.modinit = module_init, |
754 |
|
|
.modexit = module_exit, |
755 |
|
|
.flags = 0 |
756 |
|
|
}; |