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