]> jfr.im git - solanum.git/blob - modules/m_info.c
Merge branch 'authd-framework-2' into authd-framework
[solanum.git] / modules / m_info.c
1 /*
2 * ircd-ratbox: A slightly useful ircd.
3 * m_info.c: Sends information about the server.
4 *
5 * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
6 * Copyright (C) 1996-2002 Hybrid Development Team
7 * Copyright (C) 2002-2005 ircd-ratbox development team
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 * USA
23 */
24
25 #include "stdinc.h"
26 #include "m_info.h"
27 #include "channel.h"
28 #include "client.h"
29 #include "match.h"
30 #include "ircd.h"
31 #include "hook.h"
32 #include "numeric.h"
33 #include "s_serv.h"
34 #include "s_user.h"
35 #include "send.h"
36 #include "s_conf.h"
37 #include "msg.h"
38 #include "parse.h"
39 #include "modules.h"
40
41 static const char info_desc[] =
42 "Provides the INFO command for retrieving server copyright, credits, and other info";
43
44 static void send_conf_options(struct Client *source_p);
45 static void send_birthdate_online_time(struct Client *source_p);
46 static void send_info_text(struct Client *source_p);
47 static void info_spy(struct Client *);
48
49 static void m_info(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
50 static void mo_info(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
51
52 struct Message info_msgtab = {
53 "INFO", 0, 0, 0, 0,
54 {mg_unreg, {m_info, 0}, {mo_info, 0}, mg_ignore, mg_ignore, {mo_info, 0}}
55 };
56
57 int doing_info_hook;
58
59 mapi_clist_av1 info_clist[] = { &info_msgtab, NULL };
60 mapi_hlist_av1 info_hlist[] = {
61 { "doing_info", &doing_info_hook },
62 { NULL, NULL }
63 };
64
65 DECLARE_MODULE_AV2(info, NULL, NULL, info_clist, info_hlist, NULL, NULL, NULL, info_desc);
66
67 /*
68 * jdc -- Structure for our configuration value table
69 */
70 struct InfoStruct
71 {
72 const char *name; /* Displayed variable name */
73 unsigned int output_type; /* See below #defines */
74 void *option; /* Pointer reference to the value */
75 const char *desc; /* ASCII description of the variable */
76 };
77 /* Types for output_type in InfoStruct */
78 #define OUTPUT_STRING 0x0001 /* Output option as %s w/ dereference */
79 #define OUTPUT_STRING_PTR 0x0002 /* Output option as %s w/out deference */
80 #define OUTPUT_DECIMAL 0x0004 /* Output option as decimal (%d) */
81 #define OUTPUT_BOOLEAN 0x0008 /* Output option as "ON" or "OFF" */
82 #define OUTPUT_BOOLEAN_YN 0x0010 /* Output option as "YES" or "NO" */
83 #define OUTPUT_BOOLEAN2 0x0020 /* Output option as "YES/NO/MASKED" */
84
85 /* *INDENT-OFF* */
86 static struct InfoStruct info_table[] = {
87 /* --[ START OF TABLE ]-------------------------------------------- */
88 {
89 "opers_see_all_users",
90 OUTPUT_BOOLEAN_YN,
91 &opers_see_all_users,
92 "Farconnect notices available or operspy accountability limited"
93 },
94 {
95 "max_connections",
96 OUTPUT_DECIMAL,
97 &maxconnections,
98 "Max number connections"
99 },
100 {
101 "anti_nick_flood",
102 OUTPUT_BOOLEAN,
103 &ConfigFileEntry.anti_nick_flood,
104 "NICK flood protection"
105 },
106 {
107 "anti_spam_exit_message_time",
108 OUTPUT_DECIMAL,
109 &ConfigFileEntry.anti_spam_exit_message_time,
110 "Duration a client must be connected for to have an exit message"
111 },
112 {
113 "caller_id_wait",
114 OUTPUT_DECIMAL,
115 &ConfigFileEntry.caller_id_wait,
116 "Minimum delay between notifying UMODE +g users of messages"
117 },
118 {
119 "client_exit",
120 OUTPUT_BOOLEAN,
121 &ConfigFileEntry.client_exit,
122 "Prepend 'Quit:' to user QUIT messages"
123 },
124 {
125 "client_flood_max_lines",
126 OUTPUT_DECIMAL,
127 &ConfigFileEntry.client_flood_max_lines,
128 "Number of lines before a client Excess Flood's",
129 },
130 {
131 "client_flood_burst_rate",
132 OUTPUT_DECIMAL,
133 &ConfigFileEntry.client_flood_burst_rate,
134 "Maximum lines per second during flood grace period",
135 },
136 {
137 "client_flood_burst_max",
138 OUTPUT_DECIMAL,
139 &ConfigFileEntry.client_flood_burst_max,
140 "Number of lines to process at once before delaying",
141 },
142 {
143 "client_flood_message_num",
144 OUTPUT_DECIMAL,
145 &ConfigFileEntry.client_flood_message_num,
146 "Number of messages to allow per client_flood_message_time outside of burst",
147 },
148 {
149 "client_flood_message_time",
150 OUTPUT_DECIMAL,
151 &ConfigFileEntry.client_flood_message_time,
152 "Time to allow per client_flood_message_num outside of burst",
153 },
154 {
155 "connect_timeout",
156 OUTPUT_DECIMAL,
157 &ConfigFileEntry.connect_timeout,
158 "Connect timeout for connections to servers"
159 },
160 {
161 "default_ident_timeout",
162 OUTPUT_DECIMAL,
163 &ConfigFileEntry.default_ident_timeout,
164 "Amount of time the server waits for ident responses from clients",
165 },
166 {
167 "default_floodcount",
168 OUTPUT_DECIMAL,
169 &ConfigFileEntry.default_floodcount,
170 "Startup value of FLOODCOUNT",
171 },
172 {
173 "default_adminstring",
174 OUTPUT_STRING,
175 &ConfigFileEntry.default_adminstring,
176 "Default adminstring at startup.",
177 },
178 {
179 "default_operstring",
180 OUTPUT_STRING,
181 &ConfigFileEntry.default_operstring,
182 "Default operstring at startup.",
183 },
184 {
185 "servicestring",
186 OUTPUT_STRING,
187 &ConfigFileEntry.servicestring,
188 "String shown in whois for opered services.",
189 },
190 {
191 "disable_auth",
192 OUTPUT_BOOLEAN_YN,
193 &ConfigFileEntry.disable_auth,
194 "Controls whether auth checking is disabled or not"
195 },
196 {
197 "disable_fake_channels",
198 OUTPUT_BOOLEAN_YN,
199 &ConfigFileEntry.disable_fake_channels,
200 "Controls whether bold etc are disabled for JOIN"
201 },
202 {
203 "dots_in_ident",
204 OUTPUT_DECIMAL,
205 &ConfigFileEntry.dots_in_ident,
206 "Number of permissable dots in an ident"
207 },
208 {
209 "failed_oper_notice",
210 OUTPUT_BOOLEAN,
211 &ConfigFileEntry.failed_oper_notice,
212 "Inform opers if someone /oper's with the wrong password"
213 },
214 {
215 "fname_userlog",
216 OUTPUT_STRING,
217 &ConfigFileEntry.fname_userlog,
218 "User log file"
219 },
220 {
221 "fname_fuserlog",
222 OUTPUT_STRING,
223 &ConfigFileEntry.fname_fuserlog,
224 "Failed user log file"
225 },
226
227 {
228 "fname_operlog",
229 OUTPUT_STRING,
230 &ConfigFileEntry.fname_operlog,
231 "Operator log file"
232 },
233 {
234 "fname_foperlog",
235 OUTPUT_STRING,
236 &ConfigFileEntry.fname_foperlog,
237 "Failed operator log file"
238 },
239 {
240 "fname_serverlog",
241 OUTPUT_STRING,
242 &ConfigFileEntry.fname_serverlog,
243 "Server connect/disconnect log file"
244 },
245 {
246 "fname_killlog",
247 OUTPUT_STRING,
248 &ConfigFileEntry.fname_killlog,
249 "KILL log file"
250 },
251 {
252 "fname_klinelog",
253 OUTPUT_STRING,
254 &ConfigFileEntry.fname_klinelog,
255 "KLINE etc log file"
256 },
257 {
258 "fname_operspylog",
259 OUTPUT_STRING,
260 &ConfigFileEntry.fname_operspylog,
261 "Oper spy log file"
262 },
263 {
264 "fname_ioerrorlog",
265 OUTPUT_STRING,
266 &ConfigFileEntry.fname_ioerrorlog,
267 "IO error log file"
268 },
269 {
270 "global_snotices",
271 OUTPUT_BOOLEAN_YN,
272 &ConfigFileEntry.global_snotices,
273 "Send out certain server notices globally"
274 },
275 {
276 "hide_error_messages",
277 OUTPUT_BOOLEAN2,
278 &ConfigFileEntry.hide_error_messages,
279 "Hide ERROR messages coming from servers"
280 },
281 {
282 "hide_spoof_ips",
283 OUTPUT_BOOLEAN_YN,
284 &ConfigFileEntry.hide_spoof_ips,
285 "Hide IPs of spoofed users"
286 },
287 {
288 "kline_delay",
289 OUTPUT_DECIMAL,
290 &ConfigFileEntry.kline_delay,
291 "Duration of time to delay kline checking"
292 },
293 {
294 "kline_reason",
295 OUTPUT_STRING,
296 &ConfigFileEntry.kline_reason,
297 "K-lined clients sign off with this reason"
298 },
299 {
300 "dline_with_reason",
301 OUTPUT_BOOLEAN_YN,
302 &ConfigFileEntry.dline_with_reason,
303 "Display D-line reason to client on disconnect"
304 },
305 {
306 "kline_with_reason",
307 OUTPUT_BOOLEAN_YN,
308 &ConfigFileEntry.kline_with_reason,
309 "Display K-line reason to client on disconnect"
310 },
311 {
312 "max_accept",
313 OUTPUT_DECIMAL,
314 &ConfigFileEntry.max_accept,
315 "Maximum nicknames on accept list",
316 },
317 {
318 "max_nick_changes",
319 OUTPUT_DECIMAL,
320 &ConfigFileEntry.max_nick_changes,
321 "NICK change threshhold setting"
322 },
323 {
324 "max_nick_time",
325 OUTPUT_DECIMAL,
326 &ConfigFileEntry.max_nick_time,
327 "NICK flood protection time interval"
328 },
329 {
330 "max_targets",
331 OUTPUT_DECIMAL,
332 &ConfigFileEntry.max_targets,
333 "The maximum number of PRIVMSG/NOTICE targets"
334 },
335 {
336 "min_nonwildcard",
337 OUTPUT_DECIMAL,
338 &ConfigFileEntry.min_nonwildcard,
339 "Minimum non-wildcard chars in K lines",
340 },
341 {
342 "min_nonwildcard_simple",
343 OUTPUT_DECIMAL,
344 &ConfigFileEntry.min_nonwildcard_simple,
345 "Minimum non-wildcard chars in xlines/resvs",
346 },
347 {
348 "network_name",
349 OUTPUT_STRING,
350 &ServerInfo.network_name,
351 "Network name"
352 },
353 {
354 "nick_delay",
355 OUTPUT_DECIMAL,
356 &ConfigFileEntry.nick_delay,
357 "Delay nicks are locked for on split",
358 },
359 {
360 "no_oper_flood",
361 OUTPUT_BOOLEAN,
362 &ConfigFileEntry.no_oper_flood,
363 "Disable flood control for operators",
364 },
365 {
366 "non_redundant_klines",
367 OUTPUT_BOOLEAN,
368 &ConfigFileEntry.non_redundant_klines,
369 "Check for and disallow redundant K-lines"
370 },
371 {
372 "operspy_admin_only",
373 OUTPUT_BOOLEAN,
374 &ConfigFileEntry.operspy_admin_only,
375 "Send +Z operspy notices to admins only"
376 },
377 {
378 "operspy_dont_care_user_info",
379 OUTPUT_BOOLEAN,
380 &ConfigFileEntry.operspy_dont_care_user_info,
381 "Remove accountability and some '!' requirement from non-channel operspy"
382 },
383 {
384 "pace_wait",
385 OUTPUT_DECIMAL,
386 &ConfigFileEntry.pace_wait,
387 "Minimum delay between uses of certain commands"
388 },
389 {
390 "pace_wait_simple",
391 OUTPUT_DECIMAL,
392 &ConfigFileEntry.pace_wait_simple,
393 "Minimum delay between less intensive commands"
394 },
395 {
396 "ping_cookie",
397 OUTPUT_BOOLEAN,
398 &ConfigFileEntry.ping_cookie,
399 "Require ping cookies to connect",
400 },
401 {
402 "reject_after_count",
403 OUTPUT_DECIMAL,
404 &ConfigFileEntry.reject_after_count,
405 "Client rejection threshold setting",
406 },
407 {
408 "reject_ban_time",
409 OUTPUT_DECIMAL,
410 &ConfigFileEntry.reject_ban_time,
411 "Client rejection time interval",
412 },
413 {
414 "reject_duration",
415 OUTPUT_DECIMAL,
416 &ConfigFileEntry.reject_duration,
417 "Client rejection cache duration",
418 },
419 {
420 "short_motd",
421 OUTPUT_BOOLEAN_YN,
422 &ConfigFileEntry.short_motd,
423 "Do not show MOTD; only tell clients they should read it"
424 },
425 {
426 "stats_e_disabled",
427 OUTPUT_BOOLEAN_YN,
428 &ConfigFileEntry.stats_e_disabled,
429 "STATS e output is disabled",
430 },
431 {
432 "stats_c_oper_only",
433 OUTPUT_BOOLEAN_YN,
434 &ConfigFileEntry.stats_c_oper_only,
435 "STATS C output is only shown to operators",
436 },
437 {
438 "stats_h_oper_only",
439 OUTPUT_BOOLEAN_YN,
440 &ConfigFileEntry.stats_h_oper_only,
441 "STATS H output is only shown to operators",
442 },
443 {
444 "stats_i_oper_only",
445 OUTPUT_BOOLEAN2,
446 &ConfigFileEntry.stats_i_oper_only,
447 "STATS I output is only shown to operators",
448 },
449 {
450 "stats_k_oper_only",
451 OUTPUT_BOOLEAN2,
452 &ConfigFileEntry.stats_k_oper_only,
453 "STATS K output is only shown to operators",
454 },
455 {
456 "stats_o_oper_only",
457 OUTPUT_BOOLEAN_YN,
458 &ConfigFileEntry.stats_o_oper_only,
459 "STATS O output is only shown to operators",
460 },
461 {
462 "stats_P_oper_only",
463 OUTPUT_BOOLEAN_YN,
464 &ConfigFileEntry.stats_P_oper_only,
465 "STATS P is only shown to operators",
466 },
467 {
468 "stats_y_oper_only",
469 OUTPUT_BOOLEAN_YN,
470 &ConfigFileEntry.stats_y_oper_only,
471 "STATS Y is only shown to operators",
472 },
473 {
474 "throttle_count",
475 OUTPUT_DECIMAL,
476 &ConfigFileEntry.throttle_count,
477 "Connection throttle threshold",
478 },
479 {
480 "throttle_duration",
481 OUTPUT_DECIMAL,
482 &ConfigFileEntry.throttle_duration,
483 "Connection throttle duration",
484 },
485 {
486 "tkline_expire_notices",
487 OUTPUT_BOOLEAN,
488 &ConfigFileEntry.tkline_expire_notices,
489 "Notices given to opers when tklines expire"
490 },
491 {
492 "ts_max_delta",
493 OUTPUT_DECIMAL,
494 &ConfigFileEntry.ts_max_delta,
495 "Maximum permitted TS delta from another server"
496 },
497 {
498 "ts_warn_delta",
499 OUTPUT_DECIMAL,
500 &ConfigFileEntry.ts_warn_delta,
501 "Maximum permitted TS delta before displaying a warning"
502 },
503 {
504 "warn_no_nline",
505 OUTPUT_BOOLEAN,
506 &ConfigFileEntry.warn_no_nline,
507 "Display warning if connecting server lacks connect block"
508 },
509 {
510 "use_propagated_bans",
511 OUTPUT_BOOLEAN,
512 &ConfigFileEntry.use_propagated_bans,
513 "KLINE sets fully propagated bans"
514 },
515 {
516 "max_ratelimit_tokens",
517 OUTPUT_DECIMAL,
518 &ConfigFileEntry.max_ratelimit_tokens,
519 "The maximum number of tokens that can be accumulated for executing rate-limited commands",
520 },
521 {
522 "away_interval",
523 OUTPUT_DECIMAL,
524 &ConfigFileEntry.away_interval,
525 "The minimum time between aways",
526 },
527 {
528 "default_split_server_count",
529 OUTPUT_DECIMAL,
530 &ConfigChannel.default_split_server_count,
531 "Startup value of SPLITNUM",
532 },
533 {
534 "default_split_user_count",
535 OUTPUT_DECIMAL,
536 &ConfigChannel.default_split_user_count,
537 "Startup value of SPLITUSERS",
538 },
539 {
540 "knock_delay",
541 OUTPUT_DECIMAL,
542 &ConfigChannel.knock_delay,
543 "Delay between a users KNOCK attempts"
544 },
545 {
546 "knock_delay_channel",
547 OUTPUT_DECIMAL,
548 &ConfigChannel.knock_delay_channel,
549 "Delay between KNOCK attempts to a channel",
550 },
551 {
552 "kick_on_split_riding",
553 OUTPUT_BOOLEAN_YN,
554 &ConfigChannel.kick_on_split_riding,
555 "Kick users riding splits to join +i or +k channels"
556 },
557 {
558 "disable_local_channels",
559 OUTPUT_BOOLEAN_YN,
560 &ConfigChannel.disable_local_channels,
561 "Disable local channels (&channels)"
562 },
563 {
564 "max_bans",
565 OUTPUT_DECIMAL,
566 &ConfigChannel.max_bans,
567 "Total +b/e/I/q modes allowed in a channel",
568 },
569 {
570 "max_bans_large",
571 OUTPUT_DECIMAL,
572 &ConfigChannel.max_bans_large,
573 "Total +b/e/I/q modes allowed in a +L channel",
574 },
575 {
576 "max_chans_per_user",
577 OUTPUT_DECIMAL,
578 &ConfigChannel.max_chans_per_user,
579 "Maximum number of channels a user can join",
580 },
581 {
582 "max_chans_per_user_large",
583 OUTPUT_DECIMAL,
584 &ConfigChannel.max_chans_per_user_large,
585 "Maximum extended number of channels a user can join",
586 },
587 {
588 "no_create_on_split",
589 OUTPUT_BOOLEAN_YN,
590 &ConfigChannel.no_create_on_split,
591 "Disallow creation of channels when split",
592 },
593 {
594 "no_join_on_split",
595 OUTPUT_BOOLEAN_YN,
596 &ConfigChannel.no_join_on_split,
597 "Disallow joining channels when split",
598 },
599 {
600 "only_ascii_channels",
601 OUTPUT_BOOLEAN_YN,
602 &ConfigChannel.only_ascii_channels,
603 "Controls whether non-ASCII is disabled for JOIN"
604 },
605 {
606 "use_except",
607 OUTPUT_BOOLEAN_YN,
608 &ConfigChannel.use_except,
609 "Enable chanmode +e (ban exceptions)",
610 },
611 {
612 "use_invex",
613 OUTPUT_BOOLEAN_YN,
614 &ConfigChannel.use_invex,
615 "Enable chanmode +I (invite exceptions)",
616 },
617 {
618 "use_forward",
619 OUTPUT_BOOLEAN_YN,
620 &ConfigChannel.use_forward,
621 "Enable chanmode +f (channel forwarding)",
622 },
623 {
624 "use_knock",
625 OUTPUT_BOOLEAN_YN,
626 &ConfigChannel.use_knock,
627 "Enable /KNOCK",
628 },
629 {
630 "resv_forcepart",
631 OUTPUT_BOOLEAN_YN,
632 &ConfigChannel.resv_forcepart,
633 "Force-part local users on channel RESV"
634 },
635 {
636 "disable_hidden",
637 OUTPUT_BOOLEAN_YN,
638 &ConfigServerHide.disable_hidden,
639 "Prevent servers from hiding themselves from a flattened /links",
640 },
641 {
642 "flatten_links",
643 OUTPUT_BOOLEAN_YN,
644 &ConfigServerHide.flatten_links,
645 "Flatten /links list",
646 },
647 {
648 "hidden",
649 OUTPUT_BOOLEAN_YN,
650 &ConfigServerHide.hidden,
651 "Hide this server from a flattened /links on remote servers",
652 },
653 {
654 "links_delay",
655 OUTPUT_DECIMAL,
656 &ConfigServerHide.links_delay,
657 "Links rehash delay"
658 },
659 /* --[ END OF TABLE ]---------------------------------------------- */
660 { (char *) 0, (unsigned int) 0, (void *) 0, (char *) 0}
661 };
662 /* *INDENT-ON* */
663
664 /*
665 ** m_info
666 ** parv[1] = servername
667 */
668 static void
669 m_info(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
670 {
671 static time_t last_used = 0L;
672
673 if((last_used + ConfigFileEntry.pace_wait) > rb_current_time())
674 {
675 /* safe enough to give this on a local connect only */
676 sendto_one(source_p, form_str(RPL_LOAD2HI),
677 me.name, source_p->name, "INFO");
678 sendto_one_numeric(source_p, RPL_ENDOFINFO, form_str(RPL_ENDOFINFO));
679 return;
680 }
681 else
682 last_used = rb_current_time();
683
684 if(hunt_server(client_p, source_p, ":%s INFO :%s", 1, parc, parv) != HUNTED_ISME)
685 return;
686
687 info_spy(source_p);
688
689 send_info_text(source_p);
690 send_birthdate_online_time(source_p);
691
692 sendto_one_numeric(source_p, RPL_ENDOFINFO, form_str(RPL_ENDOFINFO));
693 }
694
695 /*
696 ** mo_info
697 ** parv[1] = servername
698 */
699 static void
700 mo_info(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
701 {
702 if(hunt_server(client_p, source_p, ":%s INFO :%s", 1, parc, parv) == HUNTED_ISME)
703 {
704 info_spy(source_p);
705 send_info_text(source_p);
706
707 if(IsOper(source_p))
708 {
709 send_conf_options(source_p);
710 sendto_one_numeric(source_p, RPL_INFO, ":%s",
711 rb_lib_version());
712 }
713
714 send_birthdate_online_time(source_p);
715
716 sendto_one_numeric(source_p, RPL_ENDOFINFO, form_str(RPL_ENDOFINFO));
717 }
718 }
719
720 /*
721 * send_info_text
722 *
723 * inputs - client pointer to send info text to
724 * output - none
725 * side effects - info text is sent to client
726 */
727 static void
728 send_info_text(struct Client *source_p)
729 {
730 const char **text = infotext;
731
732 while (*text)
733 {
734 sendto_one_numeric(source_p, RPL_INFO, form_str(RPL_INFO), *text++);
735 }
736
737 sendto_one_numeric(source_p, RPL_INFO, form_str(RPL_INFO), "");
738 }
739
740 /*
741 * send_birthdate_online_time
742 *
743 * inputs - client pointer to send to
744 * output - none
745 * side effects - birthdate and online time are sent
746 */
747 static void
748 send_birthdate_online_time(struct Client *source_p)
749 {
750 char tbuf[26]; /* this needs to be 26 - see ctime_r manpage */
751 sendto_one(source_p, ":%s %d %s :Birth Date: %s, compile # %s",
752 get_id(&me, source_p), RPL_INFO,
753 get_id(source_p, source_p), creation, generation);
754
755 sendto_one(source_p, ":%s %d %s :On-line since %s",
756 get_id(&me, source_p), RPL_INFO,
757 get_id(source_p, source_p), rb_ctime(startup_time, tbuf, sizeof(tbuf)));
758 }
759
760 /*
761 * send_conf_options
762 *
763 * inputs - client pointer to send to
764 * output - none
765 * side effects - send config options to client
766 */
767 static void
768 send_conf_options(struct Client *source_p)
769 {
770 Info *infoptr;
771 int i = 0;
772
773 /*
774 * Now send them a list of all our configuration options
775 * (mostly from defaults.h)
776 */
777 for (infoptr = MyInformation; infoptr->name; infoptr++)
778 {
779 if(infoptr->intvalue)
780 {
781 sendto_one(source_p, ":%s %d %s :%-30s %-16d [%s]",
782 get_id(&me, source_p), RPL_INFO,
783 get_id(source_p, source_p),
784 infoptr->name, infoptr->intvalue,
785 infoptr->desc);
786 }
787 else
788 {
789 sendto_one(source_p, ":%s %d %s :%-30s %-16s [%s]",
790 get_id(&me, source_p), RPL_INFO,
791 get_id(source_p, source_p),
792 infoptr->name, infoptr->strvalue,
793 infoptr->desc);
794 }
795 }
796
797 /*
798 * Parse the info_table[] and do the magic.
799 */
800 for (i = 0; info_table[i].name; i++)
801 {
802 switch (info_table[i].output_type)
803 {
804 /*
805 * For "char *" references
806 */
807 case OUTPUT_STRING:
808 {
809 char *option = *((char **) info_table[i].option);
810
811 sendto_one(source_p, ":%s %d %s :%-30s %-16s [%s]",
812 get_id(&me, source_p), RPL_INFO,
813 get_id(source_p, source_p),
814 info_table[i].name,
815 option ? option : "NONE",
816 info_table[i].desc ? info_table[i].desc : "<none>");
817
818 break;
819 }
820 /*
821 * For "char foo[]" references
822 */
823 case OUTPUT_STRING_PTR:
824 {
825 char *option = (char *) info_table[i].option;
826
827 sendto_one(source_p, ":%s %d %s :%-30s %-16s [%s]",
828 get_id(&me, source_p), RPL_INFO,
829 get_id(source_p, source_p),
830 info_table[i].name,
831 EmptyString(option) ? "NONE" : option,
832 info_table[i].desc ? info_table[i].desc : "<none>");
833
834 break;
835 }
836 /*
837 * Output info_table[i].option as a decimal value.
838 */
839 case OUTPUT_DECIMAL:
840 {
841 int option = *((int *) info_table[i].option);
842
843 sendto_one(source_p, ":%s %d %s :%-30s %-16d [%s]",
844 get_id(&me, source_p), RPL_INFO,
845 get_id(source_p, source_p),
846 info_table[i].name,
847 option,
848 info_table[i].desc ? info_table[i].desc : "<none>");
849
850 break;
851 }
852
853 /*
854 * Output info_table[i].option as "ON" or "OFF"
855 */
856 case OUTPUT_BOOLEAN:
857 {
858 int option = *((int *) info_table[i].option);
859
860 sendto_one(source_p, ":%s %d %s :%-30s %-16s [%s]",
861 get_id(&me, source_p), RPL_INFO,
862 get_id(source_p, source_p),
863 info_table[i].name,
864 option ? "ON" : "OFF",
865 info_table[i].desc ? info_table[i].desc : "<none>");
866
867 break;
868 }
869 /*
870 * Output info_table[i].option as "YES" or "NO"
871 */
872 case OUTPUT_BOOLEAN_YN:
873 {
874 int option = *((int *) info_table[i].option);
875
876 sendto_one(source_p, ":%s %d %s :%-30s %-16s [%s]",
877 get_id(&me, source_p), RPL_INFO,
878 get_id(source_p, source_p),
879 info_table[i].name,
880 option ? "YES" : "NO",
881 info_table[i].desc ? info_table[i].desc : "<none>");
882
883 break;
884 }
885
886 case OUTPUT_BOOLEAN2:
887 {
888 int option = *((int *) info_table[i].option);
889
890 sendto_one(source_p, ":%s %d %s :%-30s %-16s [%s]",
891 me.name, RPL_INFO, source_p->name,
892 info_table[i].name,
893 option ? ((option == 1) ? "MASK" : "YES") : "NO",
894 info_table[i].desc ? info_table[i].desc : "<none>");
895 } /* switch (info_table[i].output_type) */
896 }
897 } /* forloop */
898
899
900 /* Don't send oper_only_umodes...it's a bit mask, we will have to decode it
901 ** in order for it to show up properly to opers who issue INFO
902 */
903
904 sendto_one_numeric(source_p, RPL_INFO, form_str(RPL_INFO), "");
905 }
906
907 /* info_spy()
908 *
909 * input - pointer to client
910 * output - none
911 * side effects - hook doing_info is called
912 */
913 static void
914 info_spy(struct Client *source_p)
915 {
916 hook_data hd;
917
918 hd.client = source_p;
919 hd.arg1 = hd.arg2 = NULL;
920
921 call_hook(doing_info_hook, &hd);
922 }