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