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