]> jfr.im git - irc/rqf/shadowircd.git/blob - modules/m_info.c
Added static_quit support. Pretty much what the name implies.
[irc/rqf/shadowircd.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 * $Id: m_info.c 3396 2007-04-05 00:38:52Z jilles $
25 */
26
27 #include "stdinc.h"
28 #include "m_info.h"
29 #include "channel.h"
30 #include "client.h"
31 #include "common.h"
32 #include "match.h"
33 #include "ircd.h"
34 #include "hook.h"
35 #include "numeric.h"
36 #include "s_serv.h"
37 #include "s_user.h"
38 #include "send.h"
39 #include "s_conf.h"
40 #include "msg.h"
41 #include "parse.h"
42 #include "modules.h"
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 int m_info(struct Client *, struct Client *, int, const char **);
50 static int mo_info(struct Client *, struct Client *, int, const char **);
51
52 struct Message info_msgtab = {
53 "INFO", 0, 0, 0, MFLG_SLOW,
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_AV1(info, NULL, NULL, info_clist, info_hlist, NULL, "$Revision: 3396 $");
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 'Client Exit:' to user QUIT messages"
123 },
124 {
125 "client_flood",
126 OUTPUT_DECIMAL,
127 &ConfigFileEntry.client_flood,
128 "Number of lines before a client Excess Flood's",
129 },
130 {
131 "connect_timeout",
132 OUTPUT_DECIMAL,
133 &ConfigFileEntry.connect_timeout,
134 "Connect timeout for connections to servers"
135 },
136 {
137 "default_floodcount",
138 OUTPUT_DECIMAL,
139 &ConfigFileEntry.default_floodcount,
140 "Startup value of FLOODCOUNT",
141 },
142 {
143 "default_adminstring",
144 OUTPUT_STRING,
145 &ConfigFileEntry.default_adminstring,
146 "Default adminstring at startup.",
147 },
148 {
149 "default_operstring",
150 OUTPUT_STRING,
151 &ConfigFileEntry.default_operstring,
152 "Default operstring at startup.",
153 },
154 {
155 "default_operhost",
156 OUTPUT_STRING,
157 &ConfigFileEntry.default_operhost,
158 "Default vhost for operators to receive upon opering up.",
159 },
160 {
161 "static_quit",
162 OUTPUT_STRING,
163 &ConfigFileEntry.static_quit,
164 "Quit message to show for all users.",
165 },
166 {
167 "servicestring",
168 OUTPUT_STRING,
169 &ConfigFileEntry.servicestring,
170 "String shown in whois for opered services.",
171 },
172 {
173 "disable_auth",
174 OUTPUT_BOOLEAN_YN,
175 &ConfigFileEntry.disable_auth,
176 "Controls whether auth checking is disabled or not"
177 },
178 {
179 "disable_fake_channels",
180 OUTPUT_BOOLEAN_YN,
181 &ConfigFileEntry.disable_fake_channels,
182 "Controls whether bold etc are disabled for JOIN"
183 },
184 {
185 "dots_in_ident",
186 OUTPUT_DECIMAL,
187 &ConfigFileEntry.dots_in_ident,
188 "Number of permissable dots in an ident"
189 },
190 {
191 "expire_override_time",
192 OUTPUT_DECIMAL,
193 &ConfigFileEntry.expire_override_time,
194 "Period of time after which to unset user mode +p"
195 },
196 {
197 "failed_oper_notice",
198 OUTPUT_BOOLEAN,
199 &ConfigFileEntry.failed_oper_notice,
200 "Inform opers if someone /oper's with the wrong password"
201 },
202 {
203 "fname_userlog",
204 OUTPUT_STRING,
205 &ConfigFileEntry.fname_userlog,
206 "User log file"
207 },
208 {
209 "fname_fuserlog",
210 OUTPUT_STRING,
211 &ConfigFileEntry.fname_fuserlog,
212 "Failed user log file"
213 },
214
215 {
216 "fname_operlog",
217 OUTPUT_STRING,
218 &ConfigFileEntry.fname_operlog,
219 "Operator log file"
220 },
221 {
222 "fname_foperlog",
223 OUTPUT_STRING,
224 &ConfigFileEntry.fname_foperlog,
225 "Failed operator log file"
226 },
227 {
228 "fname_serverlog",
229 OUTPUT_STRING,
230 &ConfigFileEntry.fname_serverlog,
231 "Server connect/disconnect log file"
232 },
233 {
234 "fname_klinelog",
235 OUTPUT_STRING,
236 &ConfigFileEntry.fname_klinelog,
237 "KLINE etc log file"
238 },
239 {
240 "fname_operspylog",
241 OUTPUT_STRING,
242 &ConfigFileEntry.fname_operspylog,
243 "Oper spy log file"
244 },
245 {
246 "fname_ioerrorlog",
247 OUTPUT_STRING,
248 &ConfigFileEntry.fname_ioerrorlog,
249 "IO error log file"
250 },
251 {
252 "global_snotices",
253 OUTPUT_BOOLEAN_YN,
254 &ConfigFileEntry.global_snotices,
255 "Send out certain server notices globally"
256 },
257 {
258 "hide_error_messages",
259 OUTPUT_BOOLEAN2,
260 &ConfigFileEntry.hide_error_messages,
261 "Hide ERROR messages coming from servers"
262 },
263 {
264 "hide_spoof_ips",
265 OUTPUT_BOOLEAN_YN,
266 &ConfigFileEntry.hide_spoof_ips,
267 "Hide IPs of spoofed users"
268 },
269 {
270 "hub",
271 OUTPUT_BOOLEAN_YN,
272 &ServerInfo.hub,
273 "Server is a hub"
274 },
275 {
276 "kline_delay",
277 OUTPUT_DECIMAL,
278 &ConfigFileEntry.kline_delay,
279 "Duration of time to delay kline checking"
280 },
281 {
282 "kline_reason",
283 OUTPUT_STRING,
284 &ConfigFileEntry.kline_reason,
285 "K-lined clients sign off with this reason"
286 },
287 {
288 "dline_with_reason",
289 OUTPUT_BOOLEAN_YN,
290 &ConfigFileEntry.dline_with_reason,
291 "Display D-line reason to client on disconnect"
292 },
293 {
294 "kline_with_reason",
295 OUTPUT_BOOLEAN_YN,
296 &ConfigFileEntry.kline_with_reason,
297 "Display K-line reason to client on disconnect"
298 },
299 {
300 "max_accept",
301 OUTPUT_DECIMAL,
302 &ConfigFileEntry.max_accept,
303 "Maximum nicknames on accept list",
304 },
305 {
306 "max_nick_changes",
307 OUTPUT_DECIMAL,
308 &ConfigFileEntry.max_nick_changes,
309 "NICK change threshhold setting"
310 },
311 {
312 "max_nick_time",
313 OUTPUT_DECIMAL,
314 &ConfigFileEntry.max_nick_time,
315 "NICK flood protection time interval"
316 },
317 {
318 "max_targets",
319 OUTPUT_DECIMAL,
320 &ConfigFileEntry.max_targets,
321 "The maximum number of PRIVMSG/NOTICE targets"
322 },
323 {
324 "min_nonwildcard",
325 OUTPUT_DECIMAL,
326 &ConfigFileEntry.min_nonwildcard,
327 "Minimum non-wildcard chars in K lines",
328 },
329 {
330 "min_nonwildcard_simple",
331 OUTPUT_DECIMAL,
332 &ConfigFileEntry.min_nonwildcard_simple,
333 "Minimum non-wildcard chars in xlines/resvs",
334 },
335 {
336 "network_name",
337 OUTPUT_STRING,
338 &ServerInfo.network_name,
339 "Network name"
340 },
341 {
342 "network_desc",
343 OUTPUT_STRING,
344 &ServerInfo.network_desc,
345 "Network description"
346 },
347 {
348 "autochanmodes",
349 OUTPUT_STRING,
350 &ConfigChannel.autochanmodes,
351 "Channelmodes set on channel creation"
352 },
353 {
354 "exemptchanops",
355 OUTPUT_STRING,
356 &ConfigChannel.exemptchanops,
357 "Channelmodes that chanops are exempt from"
358 },
359 {
360 "nick_delay",
361 OUTPUT_DECIMAL,
362 &ConfigFileEntry.nick_delay,
363 "Delay nicks are locked for on split",
364 },
365 {
366 "no_oper_flood",
367 OUTPUT_BOOLEAN,
368 &ConfigFileEntry.no_oper_flood,
369 "Disable flood control for operators",
370 },
371 {
372 "non_redundant_klines",
373 OUTPUT_BOOLEAN,
374 &ConfigFileEntry.non_redundant_klines,
375 "Check for and disallow redundant K-lines"
376 },
377 {
378 "operspy_admin_only",
379 OUTPUT_BOOLEAN,
380 &ConfigFileEntry.operspy_admin_only,
381 "Send +Z operspy notices to admins only"
382 },
383 {
384 "operspy_dont_care_user_info",
385 OUTPUT_BOOLEAN,
386 &ConfigFileEntry.operspy_dont_care_user_info,
387 "Remove accountability and some '!' requirement from non-channel operspy"
388 },
389 {
390 "secret_channels_in_whois",
391 OUTPUT_BOOLEAN,
392 &ConfigFileEntry.secret_channels_in_whois,
393 "Defines whether secret channels are always shown in whois to opers with oper:spy priv."
394 },
395 {
396 "pace_wait",
397 OUTPUT_DECIMAL,
398 &ConfigFileEntry.pace_wait,
399 "Minimum delay between uses of certain commands"
400 },
401 {
402 "pace_wait_simple",
403 OUTPUT_DECIMAL,
404 &ConfigFileEntry.pace_wait_simple,
405 "Minimum delay between less intensive commands"
406 },
407 {
408 "ping_cookie",
409 OUTPUT_BOOLEAN,
410 &ConfigFileEntry.ping_cookie,
411 "Require ping cookies to connect",
412 },
413 {
414 "reject_after_count",
415 OUTPUT_DECIMAL,
416 &ConfigFileEntry.reject_after_count,
417 "Client rejection threshold setting",
418 },
419 {
420 "reject_ban_time",
421 OUTPUT_DECIMAL,
422 &ConfigFileEntry.reject_ban_time,
423 "Client rejection time interval",
424 },
425 {
426 "reject_duration",
427 OUTPUT_DECIMAL,
428 &ConfigFileEntry.reject_duration,
429 "Client rejection cache duration",
430 },
431 {
432 "short_motd",
433 OUTPUT_BOOLEAN_YN,
434 &ConfigFileEntry.short_motd,
435 "Do not show MOTD; only tell clients they should read it"
436 },
437 {
438 "stats_e_disabled",
439 OUTPUT_BOOLEAN_YN,
440 &ConfigFileEntry.stats_e_disabled,
441 "STATS e output is disabled",
442 },
443 {
444 "stats_c_oper_only",
445 OUTPUT_BOOLEAN_YN,
446 &ConfigFileEntry.stats_c_oper_only,
447 "STATS C output is only shown to operators",
448 },
449 {
450 "stats_h_oper_only",
451 OUTPUT_BOOLEAN_YN,
452 &ConfigFileEntry.stats_h_oper_only,
453 "STATS H output is only shown to operators",
454 },
455 {
456 "stats_i_oper_only",
457 OUTPUT_BOOLEAN2,
458 &ConfigFileEntry.stats_i_oper_only,
459 "STATS I output is only shown to operators",
460 },
461 {
462 "stats_k_oper_only",
463 OUTPUT_BOOLEAN2,
464 &ConfigFileEntry.stats_k_oper_only,
465 "STATS K output is only shown to operators",
466 },
467 {
468 "stats_o_oper_only",
469 OUTPUT_BOOLEAN_YN,
470 &ConfigFileEntry.stats_o_oper_only,
471 "STATS O output is only shown to operators",
472 },
473 {
474 "stats_P_oper_only",
475 OUTPUT_BOOLEAN_YN,
476 &ConfigFileEntry.stats_P_oper_only,
477 "STATS P is only shown to operators",
478 },
479 {
480 "stats_y_oper_only",
481 OUTPUT_BOOLEAN_YN,
482 &ConfigFileEntry.stats_y_oper_only,
483 "STATS Y is only shown to operators",
484 },
485 {
486 "throttle_count",
487 OUTPUT_DECIMAL,
488 &ConfigFileEntry.throttle_count,
489 "Connection throttle threshold",
490 },
491 {
492 "throttle_duration",
493 OUTPUT_DECIMAL,
494 &ConfigFileEntry.throttle_duration,
495 "Connection throttle duration",
496 },
497 {
498 "tkline_expire_notices",
499 OUTPUT_BOOLEAN,
500 &ConfigFileEntry.tkline_expire_notices,
501 "Notices given to opers when tklines expire"
502 },
503 {
504 "ts_max_delta",
505 OUTPUT_DECIMAL,
506 &ConfigFileEntry.ts_max_delta,
507 "Maximum permitted TS delta from another server"
508 },
509 {
510 "ts_warn_delta",
511 OUTPUT_DECIMAL,
512 &ConfigFileEntry.ts_warn_delta,
513 "Maximum permitted TS delta before displaying a warning"
514 },
515 {
516 "warn_no_nline",
517 OUTPUT_BOOLEAN,
518 &ConfigFileEntry.warn_no_nline,
519 "Display warning if connecting server lacks N-line"
520 },
521 {
522 "default_split_server_count",
523 OUTPUT_DECIMAL,
524 &ConfigChannel.default_split_server_count,
525 "Startup value of SPLITNUM",
526 },
527 {
528 "default_split_user_count",
529 OUTPUT_DECIMAL,
530 &ConfigChannel.default_split_user_count,
531 "Startup value of SPLITUSERS",
532 },
533 {
534 "knock_delay",
535 OUTPUT_DECIMAL,
536 &ConfigChannel.knock_delay,
537 "Delay between a users KNOCK attempts"
538 },
539 {
540 "knock_delay_channel",
541 OUTPUT_DECIMAL,
542 &ConfigChannel.knock_delay_channel,
543 "Delay between KNOCK attempts to a channel",
544 },
545 {
546 "kick_on_split_riding",
547 OUTPUT_BOOLEAN_YN,
548 &ConfigChannel.kick_on_split_riding,
549 "Kick users riding splits to join +i or +k channels"
550 },
551 {
552 "max_bans",
553 OUTPUT_DECIMAL,
554 &ConfigChannel.max_bans,
555 "Total +b/e/I/q modes allowed in a channel",
556 },
557 {
558 "max_bans_large",
559 OUTPUT_DECIMAL,
560 &ConfigChannel.max_bans_large,
561 "Total +b/e/I/q modes allowed in a +L channel",
562 },
563 {
564 "max_chans_per_user",
565 OUTPUT_DECIMAL,
566 &ConfigChannel.max_chans_per_user,
567 "Maximum number of channels a user can join",
568 },
569 {
570 "no_create_on_split",
571 OUTPUT_BOOLEAN_YN,
572 &ConfigChannel.no_create_on_split,
573 "Disallow creation of channels when split",
574 },
575 {
576 "no_join_on_split",
577 OUTPUT_BOOLEAN_YN,
578 &ConfigChannel.no_join_on_split,
579 "Disallow joining channels when split",
580 },
581 {
582 "only_ascii_channels",
583 OUTPUT_BOOLEAN_YN,
584 &ConfigChannel.only_ascii_channels,
585 "Controls whether non-ASCII is disabled for JOIN"
586 },
587 {
588 "cycle_host_change",
589 OUTPUT_BOOLEAN_YN,
590 &ConfigChannel.cycle_host_change,
591 "Controls if when a users' host changes, they cycle channels",
592 },
593 {
594 "host_in_topic",
595 OUTPUT_BOOLEAN_YN,
596 &ConfigChannel.host_in_topic,
597 "Defines whether a topicsetters host or just nick is shown on TOPIC",
598 },
599 {
600 "use_halfop",
601 OUTPUT_BOOLEAN_YN,
602 &ConfigChannel.use_halfop,
603 "Enable chanmode +h (halfop)",
604 },
605 {
606 "use_admin",
607 OUTPUT_BOOLEAN_YN,
608 &ConfigChannel.use_admin,
609 "Enable chanmode +a (admin)",
610 },
611 {
612 "use_except",
613 OUTPUT_BOOLEAN_YN,
614 &ConfigChannel.use_except,
615 "Enable chanmode +e (ban exceptions)",
616 },
617 {
618 "use_invex",
619 OUTPUT_BOOLEAN_YN,
620 &ConfigChannel.use_invex,
621 "Enable chanmode +I (invite exceptions)",
622 },
623 {
624 "use_forward",
625 OUTPUT_BOOLEAN_YN,
626 &ConfigChannel.use_forward,
627 "Enable chanmode +f (channel forwarding)",
628 },
629 {
630 "use_knock",
631 OUTPUT_BOOLEAN_YN,
632 &ConfigChannel.use_knock,
633 "Enable /KNOCK",
634 },
635 {
636 "use_local_channels",
637 OUTPUT_BOOLEAN_YN,
638 &ConfigChannel.use_local_channels,
639 "Enable local channels (&channels)"
640 },
641 {
642 "resv_forcepart",
643 OUTPUT_BOOLEAN_YN,
644 &ConfigChannel.resv_forcepart,
645 "Force-part local users on channel RESV"
646 },
647 {
648 "kick_no_rejoin_time",
649 OUTPUT_DECIMAL,
650 &ConfigChannel.kick_no_rejoin_time,
651 "The amount of time that a user cannot rejoin a +J channel for after being kicked."
652 },
653 {
654 "disable_hidden",
655 OUTPUT_BOOLEAN_YN,
656 &ConfigServerHide.disable_hidden,
657 "Prevent servers from hiding themselves from a flattened /links",
658 },
659 {
660 "flatten_links",
661 OUTPUT_BOOLEAN_YN,
662 &ConfigServerHide.flatten_links,
663 "Flatten /links list",
664 },
665 {
666 "hidden",
667 OUTPUT_BOOLEAN_YN,
668 &ConfigServerHide.hidden,
669 "Hide this server from a flattened /links on remote servers",
670 },
671 {
672 "links_delay",
673 OUTPUT_DECIMAL,
674 &ConfigServerHide.links_delay,
675 "Links rehash delay"
676 },
677 /* --[ END OF TABLE ]---------------------------------------------- */
678 { (char *) 0, (unsigned int) 0, (void *) 0, (char *) 0}
679 };
680 /* *INDENT-ON* */
681
682 /*
683 ** m_info
684 ** parv[1] = servername
685 */
686 static int
687 m_info(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
688 {
689 static time_t last_used = 0L;
690
691 if((last_used + ConfigFileEntry.pace_wait) > rb_current_time())
692 {
693 /* safe enough to give this on a local connect only */
694 sendto_one(source_p, form_str(RPL_LOAD2HI),
695 me.name, source_p->name, "INFO");
696 sendto_one_numeric(source_p, RPL_ENDOFINFO, form_str(RPL_ENDOFINFO));
697 return 0;
698 }
699 else
700 last_used = rb_current_time();
701
702 if(hunt_server(client_p, source_p, ":%s INFO :%s", 1, parc, parv) != HUNTED_ISME)
703 return 0;
704
705 info_spy(source_p);
706
707 send_info_text(source_p);
708 send_birthdate_online_time(source_p);
709
710 sendto_one_numeric(source_p, RPL_ENDOFINFO, form_str(RPL_ENDOFINFO));
711 return 0;
712 }
713
714 /*
715 ** mo_info
716 ** parv[1] = servername
717 */
718 static int
719 mo_info(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
720 {
721 if(hunt_server(client_p, source_p, ":%s INFO :%s", 1, parc, parv) == HUNTED_ISME)
722 {
723 info_spy(source_p);
724 send_info_text(source_p);
725
726 if(IsOper(source_p))
727 {
728 send_conf_options(source_p);
729 sendto_one_numeric(source_p, RPL_INFO, ":%s",
730 rb_lib_version());
731 }
732
733 send_birthdate_online_time(source_p);
734
735 sendto_one_numeric(source_p, RPL_ENDOFINFO, form_str(RPL_ENDOFINFO));
736 }
737
738 return 0;
739 }
740
741 /*
742 * send_info_text
743 *
744 * inputs - client pointer to send info text to
745 * output - none
746 * side effects - info text is sent to client
747 */
748 static void
749 send_info_text(struct Client *source_p)
750 {
751 const char **text = infotext;
752
753 while (*text)
754 {
755 sendto_one_numeric(source_p, RPL_INFO, form_str(RPL_INFO), *text++);
756 }
757
758 sendto_one_numeric(source_p, RPL_INFO, form_str(RPL_INFO), "");
759 }
760
761 /*
762 * send_birthdate_online_time
763 *
764 * inputs - client pointer to send to
765 * output - none
766 * side effects - birthdate and online time are sent
767 */
768 static void
769 send_birthdate_online_time(struct Client *source_p)
770 {
771 char tbuf[26]; /* this needs to be 26 - see ctime_r manpage */
772 sendto_one(source_p, ":%s %d %s :Birth Date: %s, compile # %s",
773 get_id(&me, source_p), RPL_INFO,
774 get_id(source_p, source_p), creation, generation);
775
776 sendto_one(source_p, ":%s %d %s :On-line since %s",
777 get_id(&me, source_p), RPL_INFO,
778 get_id(source_p, source_p), rb_ctime(startup_time, tbuf, sizeof(tbuf)));
779 }
780
781 /*
782 * send_conf_options
783 *
784 * inputs - client pointer to send to
785 * output - none
786 * side effects - send config options to client
787 */
788 static void
789 send_conf_options(struct Client *source_p)
790 {
791 Info *infoptr;
792 int i = 0;
793
794 /*
795 * Now send them a list of all our configuration options
796 * (mostly from config.h)
797 */
798 for (infoptr = MyInformation; infoptr->name; infoptr++)
799 {
800 if(infoptr->intvalue)
801 {
802 sendto_one(source_p, ":%s %d %s :%-30s %-5d [%-30s]",
803 get_id(&me, source_p), RPL_INFO,
804 get_id(source_p, source_p),
805 infoptr->name, infoptr->intvalue,
806 infoptr->desc);
807 }
808 else
809 {
810 sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]",
811 get_id(&me, source_p), RPL_INFO,
812 get_id(source_p, source_p),
813 infoptr->name, infoptr->strvalue,
814 infoptr->desc);
815 }
816 }
817
818 /*
819 * Parse the info_table[] and do the magic.
820 */
821 for (i = 0; info_table[i].name; i++)
822 {
823 switch (info_table[i].output_type)
824 {
825 /*
826 * For "char *" references
827 */
828 case OUTPUT_STRING:
829 {
830 char *option = *((char **) info_table[i].option);
831
832 sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]",
833 get_id(&me, source_p), RPL_INFO,
834 get_id(source_p, source_p),
835 info_table[i].name,
836 option ? option : "NONE",
837 info_table[i].desc ? info_table[i].desc : "<none>");
838
839 break;
840 }
841 /*
842 * For "char foo[]" references
843 */
844 case OUTPUT_STRING_PTR:
845 {
846 char *option = (char *) info_table[i].option;
847
848 sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]",
849 get_id(&me, source_p), RPL_INFO,
850 get_id(source_p, source_p),
851 info_table[i].name,
852 EmptyString(option) ? "NONE" : option,
853 info_table[i].desc ? info_table[i].desc : "<none>");
854
855 break;
856 }
857 /*
858 * Output info_table[i].option as a decimal value.
859 */
860 case OUTPUT_DECIMAL:
861 {
862 int option = *((int *) info_table[i].option);
863
864 sendto_one(source_p, ":%s %d %s :%-30s %-5d [%-30s]",
865 get_id(&me, source_p), RPL_INFO,
866 get_id(source_p, source_p),
867 info_table[i].name,
868 option,
869 info_table[i].desc ? info_table[i].desc : "<none>");
870
871 break;
872 }
873
874 /*
875 * Output info_table[i].option as "ON" or "OFF"
876 */
877 case OUTPUT_BOOLEAN:
878 {
879 int option = *((int *) info_table[i].option);
880
881 sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]",
882 get_id(&me, source_p), RPL_INFO,
883 get_id(source_p, source_p),
884 info_table[i].name,
885 option ? "ON" : "OFF",
886 info_table[i].desc ? info_table[i].desc : "<none>");
887
888 break;
889 }
890 /*
891 * Output info_table[i].option as "YES" or "NO"
892 */
893 case OUTPUT_BOOLEAN_YN:
894 {
895 int option = *((int *) info_table[i].option);
896
897 sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]",
898 get_id(&me, source_p), RPL_INFO,
899 get_id(source_p, source_p),
900 info_table[i].name,
901 option ? "YES" : "NO",
902 info_table[i].desc ? info_table[i].desc : "<none>");
903
904 break;
905 }
906
907 case OUTPUT_BOOLEAN2:
908 {
909 int option = *((int *) info_table[i].option);
910
911 sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]",
912 me.name, RPL_INFO, source_p->name,
913 info_table[i].name,
914 option ? ((option == 1) ? "MASK" : "YES") : "NO",
915 info_table[i].desc ? info_table[i].desc : "<none>");
916 } /* switch (info_table[i].output_type) */
917 }
918 } /* forloop */
919
920
921 /* Don't send oper_only_umodes...it's a bit mask, we will have to decode it
922 ** in order for it to show up properly to opers who issue INFO
923 */
924
925 sendto_one_numeric(source_p, RPL_INFO, form_str(RPL_INFO), "");
926 }
927
928 /* info_spy()
929 *
930 * input - pointer to client
931 * output - none
932 * side effects - hook doing_info is called
933 */
934 static void
935 info_spy(struct Client *source_p)
936 {
937 hook_data hd;
938
939 hd.client = source_p;
940 hd.arg1 = hd.arg2 = NULL;
941
942 call_hook(doing_info_hook, &hd);
943 }