]> jfr.im git - solanum.git/blame - modules/m_info.c
ircd: implement EXTENDCHANS, based on ircd-seven (with some improvements from chatircd)
[solanum.git] / modules / m_info.c
CommitLineData
212380e3
AC
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
AC
25 */
26
27#include "stdinc.h"
212380e3
AC
28#include "m_info.h"
29#include "channel.h"
30#include "client.h"
31#include "common.h"
4562c604 32#include "match.h"
212380e3
AC
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
AC
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 },
8bd5767b
JT
94 {
95 "max_connections",
96 OUTPUT_DECIMAL,
97 &maxconnections,
98 "Max number connections"
d8228627 99 },
212380e3
AC
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,
b2c208be 122 "Prepend 'Quit:' to user QUIT messages"
212380e3
AC
123 },
124 {
e6e54763 125 "client_flood_max_lines",
212380e3 126 OUTPUT_DECIMAL,
e6e54763 127 &ConfigFileEntry.client_flood_max_lines,
212380e3
AC
128 "Number of lines before a client Excess Flood's",
129 },
e6e54763
SB
130 {
131 "client_flood_burst_rate",
132 OUTPUT_DECIMAL,
133 &ConfigFileEntry.client_flood_burst_rate,
a75bf40d 134 "Maximum lines per second during flood grace period",
e6e54763
SB
135 },
136 {
137 "client_flood_burst_max",
138 OUTPUT_DECIMAL,
139 &ConfigFileEntry.client_flood_burst_max,
a75bf40d 140 "Number of lines to process at once before delaying",
e6e54763
SB
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 },
212380e3
AC
154 {
155 "connect_timeout",
156 OUTPUT_DECIMAL,
157 &ConfigFileEntry.connect_timeout,
158 "Connect timeout for connections to servers"
159 },
0ffb8106 160 {
944b0584 161 "default_ident_timeout",
0ffb8106 162 OUTPUT_DECIMAL,
944b0584 163 &ConfigFileEntry.default_ident_timeout,
0ffb8106
JH
164 "Amount of time the server waits for ident responses from clients",
165 },
212380e3
AC
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 },
212380e3
AC
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 },
00533129
KB
245 {
246 "fname_killlog",
247 OUTPUT_STRING,
248 &ConfigFileEntry.fname_killlog,
249 "KILL log file"
250 },
212380e3
AC
251 {
252 "fname_klinelog",
253 OUTPUT_STRING,
254 &ConfigFileEntry.fname_klinelog,
255 "KLINE etc log file"
256 },
212380e3
AC
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 },
212380e3
AC
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 "hub",
289 OUTPUT_BOOLEAN_YN,
290 &ServerInfo.hub,
291 "Server is a hub"
292 },
212380e3
AC
293 {
294 "kline_delay",
295 OUTPUT_DECIMAL,
296 &ConfigFileEntry.kline_delay,
297 "Duration of time to delay kline checking"
298 },
299 {
300 "kline_reason",
301 OUTPUT_STRING,
302 &ConfigFileEntry.kline_reason,
303 "K-lined clients sign off with this reason"
304 },
305 {
306 "dline_with_reason",
307 OUTPUT_BOOLEAN_YN,
308 &ConfigFileEntry.dline_with_reason,
309 "Display D-line reason to client on disconnect"
310 },
311 {
312 "kline_with_reason",
313 OUTPUT_BOOLEAN_YN,
314 &ConfigFileEntry.kline_with_reason,
315 "Display K-line reason to client on disconnect"
316 },
317 {
318 "max_accept",
319 OUTPUT_DECIMAL,
320 &ConfigFileEntry.max_accept,
321 "Maximum nicknames on accept list",
322 },
323 {
324 "max_nick_changes",
325 OUTPUT_DECIMAL,
326 &ConfigFileEntry.max_nick_changes,
327 "NICK change threshhold setting"
328 },
329 {
330 "max_nick_time",
331 OUTPUT_DECIMAL,
332 &ConfigFileEntry.max_nick_time,
333 "NICK flood protection time interval"
334 },
335 {
336 "max_targets",
337 OUTPUT_DECIMAL,
338 &ConfigFileEntry.max_targets,
339 "The maximum number of PRIVMSG/NOTICE targets"
340 },
341 {
342 "min_nonwildcard",
343 OUTPUT_DECIMAL,
344 &ConfigFileEntry.min_nonwildcard,
aae358c0 345 "Minimum non-wildcard chars in K lines",
212380e3
AC
346 },
347 {
348 "min_nonwildcard_simple",
349 OUTPUT_DECIMAL,
350 &ConfigFileEntry.min_nonwildcard_simple,
351 "Minimum non-wildcard chars in xlines/resvs",
352 },
353 {
354 "network_name",
355 OUTPUT_STRING,
356 &ServerInfo.network_name,
357 "Network name"
358 },
212380e3
AC
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 "pace_wait",
391 OUTPUT_DECIMAL,
392 &ConfigFileEntry.pace_wait,
393 "Minimum delay between uses of certain commands"
394 },
395 {
396 "pace_wait_simple",
397 OUTPUT_DECIMAL,
398 &ConfigFileEntry.pace_wait_simple,
399 "Minimum delay between less intensive commands"
400 },
401 {
402 "ping_cookie",
403 OUTPUT_BOOLEAN,
404 &ConfigFileEntry.ping_cookie,
405 "Require ping cookies to connect",
406 },
407 {
408 "reject_after_count",
409 OUTPUT_DECIMAL,
55abcbb2 410 &ConfigFileEntry.reject_after_count,
212380e3
AC
411 "Client rejection threshold setting",
412 },
413 {
414 "reject_ban_time",
415 OUTPUT_DECIMAL,
416 &ConfigFileEntry.reject_ban_time,
417 "Client rejection time interval",
418 },
419 {
420 "reject_duration",
421 OUTPUT_DECIMAL,
422 &ConfigFileEntry.reject_duration,
423 "Client rejection cache duration",
424 },
425 {
426 "short_motd",
427 OUTPUT_BOOLEAN_YN,
428 &ConfigFileEntry.short_motd,
429 "Do not show MOTD; only tell clients they should read it"
430 },
431 {
432 "stats_e_disabled",
433 OUTPUT_BOOLEAN_YN,
434 &ConfigFileEntry.stats_e_disabled,
435 "STATS e output is disabled",
436 },
437 {
438 "stats_c_oper_only",
439 OUTPUT_BOOLEAN_YN,
440 &ConfigFileEntry.stats_c_oper_only,
441 "STATS C output is only shown to operators",
442 },
443 {
444 "stats_h_oper_only",
445 OUTPUT_BOOLEAN_YN,
446 &ConfigFileEntry.stats_h_oper_only,
447 "STATS H output is only shown to operators",
448 },
449 {
450 "stats_i_oper_only",
451 OUTPUT_BOOLEAN2,
452 &ConfigFileEntry.stats_i_oper_only,
453 "STATS I output is only shown to operators",
454 },
455 {
456 "stats_k_oper_only",
457 OUTPUT_BOOLEAN2,
458 &ConfigFileEntry.stats_k_oper_only,
459 "STATS K output is only shown to operators",
460 },
461 {
462 "stats_o_oper_only",
463 OUTPUT_BOOLEAN_YN,
464 &ConfigFileEntry.stats_o_oper_only,
465 "STATS O output is only shown to operators",
466 },
467 {
468 "stats_P_oper_only",
469 OUTPUT_BOOLEAN_YN,
470 &ConfigFileEntry.stats_P_oper_only,
471 "STATS P is only shown to operators",
472 },
473 {
474 "stats_y_oper_only",
475 OUTPUT_BOOLEAN_YN,
476 &ConfigFileEntry.stats_y_oper_only,
477 "STATS Y is only shown to operators",
478 },
43946961
JT
479 {
480 "throttle_count",
481 OUTPUT_DECIMAL,
55abcbb2 482 &ConfigFileEntry.throttle_count,
43946961
JT
483 "Connection throttle threshold",
484 },
485 {
486 "throttle_duration",
487 OUTPUT_DECIMAL,
55abcbb2 488 &ConfigFileEntry.throttle_duration,
43946961
JT
489 "Connection throttle duration",
490 },
212380e3
AC
491 {
492 "tkline_expire_notices",
493 OUTPUT_BOOLEAN,
494 &ConfigFileEntry.tkline_expire_notices,
495 "Notices given to opers when tklines expire"
496 },
497 {
498 "ts_max_delta",
499 OUTPUT_DECIMAL,
500 &ConfigFileEntry.ts_max_delta,
501 "Maximum permitted TS delta from another server"
502 },
503 {
504 "ts_warn_delta",
505 OUTPUT_DECIMAL,
506 &ConfigFileEntry.ts_warn_delta,
507 "Maximum permitted TS delta before displaying a warning"
508 },
509 {
510 "warn_no_nline",
511 OUTPUT_BOOLEAN,
512 &ConfigFileEntry.warn_no_nline,
bf77c3a1 513 "Display warning if connecting server lacks connect block"
212380e3 514 },
1702b694
JT
515 {
516 "use_propagated_bans",
517 OUTPUT_BOOLEAN,
518 &ConfigFileEntry.use_propagated_bans,
519 "KLINE sets fully propagated bans"
520 },
e88a1f1b
KB
521 {
522 "max_ratelimit_tokens",
523 OUTPUT_DECIMAL,
524 &ConfigFileEntry.max_ratelimit_tokens,
525 "The maximum number of tokens that can be accumulated for executing rate-limited commands",
526 },
d42e6915
JT
527 {
528 "away_interval",
529 OUTPUT_DECIMAL,
530 &ConfigFileEntry.away_interval,
531 "The minimum time between aways",
532 },
212380e3
AC
533 {
534 "default_split_server_count",
535 OUTPUT_DECIMAL,
536 &ConfigChannel.default_split_server_count,
537 "Startup value of SPLITNUM",
538 },
539 {
540 "default_split_user_count",
541 OUTPUT_DECIMAL,
542 &ConfigChannel.default_split_user_count,
543 "Startup value of SPLITUSERS",
544 },
545 {
546 "knock_delay",
547 OUTPUT_DECIMAL,
548 &ConfigChannel.knock_delay,
549 "Delay between a users KNOCK attempts"
550 },
551 {
552 "knock_delay_channel",
553 OUTPUT_DECIMAL,
554 &ConfigChannel.knock_delay_channel,
555 "Delay between KNOCK attempts to a channel",
556 },
212380e3
AC
557 {
558 "kick_on_split_riding",
559 OUTPUT_BOOLEAN_YN,
560 &ConfigChannel.kick_on_split_riding,
561 "Kick users riding splits to join +i or +k channels"
562 },
341f971e
SB
563 {
564 "disable_local_channels",
565 OUTPUT_BOOLEAN_YN,
566 &ConfigChannel.disable_local_channels,
567 "Disable local channels (&channels)"
568 },
212380e3
AC
569 {
570 "max_bans",
571 OUTPUT_DECIMAL,
572 &ConfigChannel.max_bans,
573 "Total +b/e/I/q modes allowed in a channel",
574 },
575 {
576 "max_bans_large",
577 OUTPUT_DECIMAL,
578 &ConfigChannel.max_bans_large,
579 "Total +b/e/I/q modes allowed in a +L channel",
580 },
581 {
582 "max_chans_per_user",
583 OUTPUT_DECIMAL,
584 &ConfigChannel.max_chans_per_user,
585 "Maximum number of channels a user can join",
586 },
a4721f5e
AC
587 {
588 "max_chans_per_user_large",
589 OUTPUT_DECIMAL,
590 &ConfigChannel.max_chans_per_user_large,
591 "Maximum extended number of channels a user can join",
592 },
212380e3
AC
593 {
594 "no_create_on_split",
595 OUTPUT_BOOLEAN_YN,
596 &ConfigChannel.no_create_on_split,
597 "Disallow creation of channels when split",
598 },
599 {
600 "no_join_on_split",
601 OUTPUT_BOOLEAN_YN,
602 &ConfigChannel.no_join_on_split,
603 "Disallow joining channels when split",
604 },
6865c0b0
JT
605 {
606 "only_ascii_channels",
607 OUTPUT_BOOLEAN_YN,
608 &ConfigChannel.only_ascii_channels,
609 "Controls whether non-ASCII is disabled for JOIN"
610 },
212380e3
AC
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 },
2da6f6eb
JT
623 {
624 "use_forward",
625 OUTPUT_BOOLEAN_YN,
626 &ConfigChannel.use_forward,
627 "Enable chanmode +f (channel forwarding)",
628 },
212380e3
AC
629 {
630 "use_knock",
631 OUTPUT_BOOLEAN_YN,
632 &ConfigChannel.use_knock,
633 "Enable /KNOCK",
634 },
c2c25552
JT
635 {
636 "resv_forcepart",
637 OUTPUT_BOOLEAN_YN,
ca656bf8 638 &ConfigChannel.resv_forcepart,
c2c25552
JT
639 "Force-part local users on channel RESV"
640 },
212380e3
AC
641 {
642 "disable_hidden",
643 OUTPUT_BOOLEAN_YN,
644 &ConfigServerHide.disable_hidden,
645 "Prevent servers from hiding themselves from a flattened /links",
646 },
647 {
648 "flatten_links",
649 OUTPUT_BOOLEAN_YN,
650 &ConfigServerHide.flatten_links,
651 "Flatten /links list",
652 },
653 {
654 "hidden",
655 OUTPUT_BOOLEAN_YN,
656 &ConfigServerHide.hidden,
657 "Hide this server from a flattened /links on remote servers",
658 },
659 {
660 "links_delay",
661 OUTPUT_DECIMAL,
662 &ConfigServerHide.links_delay,
663 "Links rehash delay"
664 },
665 /* --[ END OF TABLE ]---------------------------------------------- */
666 { (char *) 0, (unsigned int) 0, (void *) 0, (char *) 0}
667};
668/* *INDENT-ON* */
669
670/*
e6e54763
SB
671 ** m_info
672 ** parv[1] = servername
673 */
212380e3
AC
674static int
675m_info(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
676{
677 static time_t last_used = 0L;
678
e3354945 679 if((last_used + ConfigFileEntry.pace_wait) > rb_current_time())
212380e3
AC
680 {
681 /* safe enough to give this on a local connect only */
682 sendto_one(source_p, form_str(RPL_LOAD2HI),
e6e54763 683 me.name, source_p->name, "INFO");
212380e3
AC
684 sendto_one_numeric(source_p, RPL_ENDOFINFO, form_str(RPL_ENDOFINFO));
685 return 0;
686 }
687 else
e3354945 688 last_used = rb_current_time();
212380e3
AC
689
690 if(hunt_server(client_p, source_p, ":%s INFO :%s", 1, parc, parv) != HUNTED_ISME)
691 return 0;
692
693 info_spy(source_p);
694
695 send_info_text(source_p);
696 send_birthdate_online_time(source_p);
697
698 sendto_one_numeric(source_p, RPL_ENDOFINFO, form_str(RPL_ENDOFINFO));
699 return 0;
700}
701
702/*
e6e54763
SB
703 ** mo_info
704 ** parv[1] = servername
705 */
212380e3
AC
706static int
707mo_info(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
708{
709 if(hunt_server(client_p, source_p, ":%s INFO :%s", 1, parc, parv) == HUNTED_ISME)
710 {
711 info_spy(source_p);
212380e3
AC
712 send_info_text(source_p);
713
714 if(IsOper(source_p))
8ee12f0c 715 {
212380e3 716 send_conf_options(source_p);
8ee12f0c
JT
717 sendto_one_numeric(source_p, RPL_INFO, ":%s",
718 rb_lib_version());
719 }
212380e3
AC
720
721 send_birthdate_online_time(source_p);
722
723 sendto_one_numeric(source_p, RPL_ENDOFINFO, form_str(RPL_ENDOFINFO));
724 }
725
726 return 0;
727}
728
729/*
730 * send_info_text
731 *
732 * inputs - client pointer to send info text to
733 * output - none
734 * side effects - info text is sent to client
735 */
736static void
737send_info_text(struct Client *source_p)
738{
739 const char **text = infotext;
740
741 while (*text)
742 {
743 sendto_one_numeric(source_p, RPL_INFO, form_str(RPL_INFO), *text++);
744 }
745
746 sendto_one_numeric(source_p, RPL_INFO, form_str(RPL_INFO), "");
747}
748
749/*
750 * send_birthdate_online_time
751 *
752 * inputs - client pointer to send to
753 * output - none
754 * side effects - birthdate and online time are sent
755 */
756static void
757send_birthdate_online_time(struct Client *source_p)
758{
08d75d97 759 char tbuf[26]; /* this needs to be 26 - see ctime_r manpage */
212380e3 760 sendto_one(source_p, ":%s %d %s :Birth Date: %s, compile # %s",
55abcbb2 761 get_id(&me, source_p), RPL_INFO,
e6e54763 762 get_id(source_p, source_p), creation, generation);
212380e3
AC
763
764 sendto_one(source_p, ":%s %d %s :On-line since %s",
55abcbb2 765 get_id(&me, source_p), RPL_INFO,
e6e54763 766 get_id(source_p, source_p), rb_ctime(startup_time, tbuf, sizeof(tbuf)));
212380e3
AC
767}
768
769/*
770 * send_conf_options
771 *
772 * inputs - client pointer to send to
773 * output - none
774 * side effects - send config options to client
775 */
776static void
777send_conf_options(struct Client *source_p)
778{
779 Info *infoptr;
780 int i = 0;
781
782 /*
783 * Now send them a list of all our configuration options
784 * (mostly from config.h)
785 */
786 for (infoptr = MyInformation; infoptr->name; infoptr++)
787 {
788 if(infoptr->intvalue)
789 {
cf3b1525 790 sendto_one(source_p, ":%s %d %s :%-30s %-16d [%s]",
e6e54763
SB
791 get_id(&me, source_p), RPL_INFO,
792 get_id(source_p, source_p),
55abcbb2 793 infoptr->name, infoptr->intvalue,
e6e54763 794 infoptr->desc);
212380e3
AC
795 }
796 else
797 {
cf3b1525 798 sendto_one(source_p, ":%s %d %s :%-30s %-16s [%s]",
e6e54763
SB
799 get_id(&me, source_p), RPL_INFO,
800 get_id(source_p, source_p),
55abcbb2 801 infoptr->name, infoptr->strvalue,
e6e54763 802 infoptr->desc);
212380e3
AC
803 }
804 }
805
806 /*
807 * Parse the info_table[] and do the magic.
808 */
809 for (i = 0; info_table[i].name; i++)
810 {
811 switch (info_table[i].output_type)
812 {
cf3b1525
AJ
813 /*
814 * For "char *" references
815 */
e6e54763
SB
816 case OUTPUT_STRING:
817 {
818 char *option = *((char **) info_table[i].option);
819
cf3b1525 820 sendto_one(source_p, ":%s %d %s :%-30s %-16s [%s]",
e6e54763
SB
821 get_id(&me, source_p), RPL_INFO,
822 get_id(source_p, source_p),
823 info_table[i].name,
824 option ? option : "NONE",
825 info_table[i].desc ? info_table[i].desc : "<none>");
826
827 break;
828 }
829 /*
830 * For "char foo[]" references
831 */
832 case OUTPUT_STRING_PTR:
833 {
834 char *option = (char *) info_table[i].option;
835
cf3b1525 836 sendto_one(source_p, ":%s %d %s :%-30s %-16s [%s]",
e6e54763
SB
837 get_id(&me, source_p), RPL_INFO,
838 get_id(source_p, source_p),
839 info_table[i].name,
840 EmptyString(option) ? "NONE" : option,
841 info_table[i].desc ? info_table[i].desc : "<none>");
842
843 break;
844 }
845 /*
846 * Output info_table[i].option as a decimal value.
847 */
848 case OUTPUT_DECIMAL:
849 {
850 int option = *((int *) info_table[i].option);
851
cf3b1525 852 sendto_one(source_p, ":%s %d %s :%-30s %-16d [%s]",
e6e54763
SB
853 get_id(&me, source_p), RPL_INFO,
854 get_id(source_p, source_p),
855 info_table[i].name,
856 option,
857 info_table[i].desc ? info_table[i].desc : "<none>");
858
859 break;
860 }
861
862 /*
863 * Output info_table[i].option as "ON" or "OFF"
864 */
865 case OUTPUT_BOOLEAN:
866 {
867 int option = *((int *) info_table[i].option);
868
cf3b1525 869 sendto_one(source_p, ":%s %d %s :%-30s %-16s [%s]",
e6e54763
SB
870 get_id(&me, source_p), RPL_INFO,
871 get_id(source_p, source_p),
872 info_table[i].name,
873 option ? "ON" : "OFF",
874 info_table[i].desc ? info_table[i].desc : "<none>");
875
876 break;
877 }
878 /*
879 * Output info_table[i].option as "YES" or "NO"
880 */
881 case OUTPUT_BOOLEAN_YN:
882 {
883 int option = *((int *) info_table[i].option);
884
cf3b1525 885 sendto_one(source_p, ":%s %d %s :%-30s %-16s [%s]",
e6e54763
SB
886 get_id(&me, source_p), RPL_INFO,
887 get_id(source_p, source_p),
888 info_table[i].name,
889 option ? "YES" : "NO",
890 info_table[i].desc ? info_table[i].desc : "<none>");
891
892 break;
893 }
894
895 case OUTPUT_BOOLEAN2:
896 {
897 int option = *((int *) info_table[i].option);
898
cf3b1525 899 sendto_one(source_p, ":%s %d %s :%-30s %-16s [%s]",
e6e54763
SB
900 me.name, RPL_INFO, source_p->name,
901 info_table[i].name,
902 option ? ((option == 1) ? "MASK" : "YES") : "NO",
903 info_table[i].desc ? info_table[i].desc : "<none>");
904 } /* switch (info_table[i].output_type) */
212380e3
AC
905 }
906 } /* forloop */
907
908
909 /* Don't send oper_only_umodes...it's a bit mask, we will have to decode it
910 ** in order for it to show up properly to opers who issue INFO
911 */
912
913 sendto_one_numeric(source_p, RPL_INFO, form_str(RPL_INFO), "");
914}
915
916/* info_spy()
55abcbb2 917 *
212380e3
AC
918 * input - pointer to client
919 * output - none
920 * side effects - hook doing_info is called
921 */
922static void
923info_spy(struct Client *source_p)
924{
925 hook_data hd;
926
927 hd.client = source_p;
928 hd.arg1 = hd.arg2 = NULL;
929
930 call_hook(doing_info_hook, &hd);
931}