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