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