ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_info.c
Revision: 8057
Committed: Wed Mar 22 18:36:41 2017 UTC (8 years, 5 months ago) by michael
Content type: text/x-csrc
File size: 19974 byte(s)
Log Message:
- m_info.c: clarification on 'failed_oper_notice'

File Contents

# User Rev Content
1 adx 30 /*
2 michael 2820 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 adx 30 *
4 michael 7924 * Copyright (c) 1997-2017 ircd-hybrid development team
5 adx 30 *
6     * This program is free software; you can redistribute it and/or modify
7     * it under the terms of the GNU General Public License as published by
8     * the Free Software Foundation; either version 2 of the License, or
9     * (at your option) any later version.
10     *
11     * This program is distributed in the hope that it will be useful,
12     * but WITHOUT ANY WARRANTY; without even the implied warranty of
13     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14     * GNU General Public License for more details.
15     *
16     * You should have received a copy of the GNU General Public License
17     * along with this program; if not, write to the Free Software
18 michael 4565 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 adx 30 * USA
20     */
21    
22 michael 2820 /*! \file m_info.c
23     * \brief Includes required functions for processing the INFO command.
24     * \version $Id$
25     */
26    
27 adx 30 #include "stdinc.h"
28 michael 1011 #include "list.h"
29 adx 30 #include "client.h"
30     #include "ircd.h"
31     #include "numeric.h"
32 michael 3347 #include "misc.h"
33     #include "server.h"
34 adx 30 #include "send.h"
35 michael 1309 #include "conf.h"
36 adx 30 #include "parse.h"
37     #include "modules.h"
38 michael 7708 #include "tls.h"
39 adx 30
40 michael 1230
41 michael 3742 /* Types for output_type in InfoStruct */
42     enum
43     {
44     OUTPUT_STRING = 1 << 0, /* Output option as %s w/ dereference */
45     OUTPUT_STRING_PTR = 1 << 1, /* Output option as %s w/out deference */
46     OUTPUT_DECIMAL = 1 << 2, /* Output option as decimal (%d) */
47     OUTPUT_BOOLEAN = 1 << 3, /* Output option as "ON" or "OFF" */
48     OUTPUT_BOOLEAN_YN = 1 << 4, /* Output option as "YES" or "NO" */
49     OUTPUT_BOOLEAN2 = 1 << 5 /* Output option as "YES/NO/MASKED" */
50     };
51    
52 adx 30 /*
53     * jdc -- Structure for our configuration value table
54     */
55     struct InfoStruct
56     {
57 michael 3742 const char *name; /* Displayed variable name */
58     const unsigned int output_type; /* Type of output. See enum above */
59     const void *option; /* Pointer reference to the value */
60     const char *desc; /* ASCII description of the variable */
61 adx 30 };
62    
63     static const struct InfoStruct info_table[] =
64     {
65     /* --[ START OF TABLE ]-------------------------------------------- */
66 michael 1318
67 adx 30 {
68 michael 3236 "DPATH",
69     OUTPUT_STRING,
70 michael 4340 &ConfigGeneral.dpath,
71 michael 3236 "Root directory of installation"
72     },
73     {
74 michael 3239 "SPATH",
75     OUTPUT_STRING,
76 michael 4340 &ConfigGeneral.spath,
77 michael 3239 "Path to server executable"
78     },
79     {
80     "MPATH",
81     OUTPUT_STRING,
82 michael 4340 &ConfigGeneral.mpath,
83 michael 3239 "Path to main motd (Message of the Day) file"
84     },
85     {
86 michael 1318 "CPATH",
87     OUTPUT_STRING,
88 michael 4340 &ConfigGeneral.configfile,
89 michael 1702 "Path to main configuration file"
90 michael 1318 },
91     {
92     "DLPATH",
93     OUTPUT_STRING,
94 michael 4340 &ConfigGeneral.dlinefile,
95 michael 1702 "Path to D-line database file"
96 michael 1318 },
97     {
98     "KPATH",
99     OUTPUT_STRING,
100 michael 4340 &ConfigGeneral.klinefile,
101 michael 1702 "Path to K-line database file"
102 michael 1318 },
103     {
104 michael 1702 "XPATH",
105     OUTPUT_STRING,
106 michael 4340 &ConfigGeneral.xlinefile,
107 michael 1702 "Path to X-line database file"
108     },
109     {
110     "RESVPATH",
111     OUTPUT_STRING,
112 michael 4340 &ConfigGeneral.resvfile,
113 michael 1702 "Path to resv database file"
114     },
115     {
116 adx 30 "network_name",
117     OUTPUT_STRING,
118 michael 4340 &ConfigServerInfo.network_name,
119 adx 30 "Network name"
120     },
121     {
122     "network_desc",
123     OUTPUT_STRING,
124 michael 4340 &ConfigServerInfo.network_desc,
125 adx 30 "Network description"
126     },
127     {
128     "hub",
129     OUTPUT_BOOLEAN_YN,
130 michael 4340 &ConfigServerInfo.hub,
131 adx 30 "Server is a hub"
132     },
133     {
134 michael 5489 "default_max_clients",
135 michael 1754 OUTPUT_DECIMAL,
136 michael 5489 &ConfigServerInfo.default_max_clients,
137     "The default maximum number of clients permitted simultaneously on this server"
138 michael 1754 },
139     {
140     "max_nick_length",
141     OUTPUT_DECIMAL,
142 michael 4340 &ConfigServerInfo.max_nick_length,
143 michael 1754 "Maximum nickname length"
144     },
145     {
146     "max_topic_length",
147     OUTPUT_DECIMAL,
148 michael 4340 &ConfigServerInfo.max_topic_length,
149 michael 1754 "Maximum topic length"
150     },
151     {
152 michael 7258 "libgeoip_ipv4_database_file",
153 michael 7300 OUTPUT_STRING,
154 michael 7258 &ConfigServerInfo.libgeoip_ipv4_database_file,
155     "Path to the libGeoIP IPv4 database file"
156     },
157     {
158     "libgeoip_ipv6_database_file",
159 michael 7300 OUTPUT_STRING,
160 michael 7258 &ConfigServerInfo.libgeoip_ipv6_database_file,
161     "Path to the libGeoIP IPv6 database file"
162     },
163     {
164 adx 30 "use_logging",
165     OUTPUT_BOOLEAN_YN,
166 michael 4340 &ConfigLog.use_logging,
167 adx 30 "Enable logging"
168     },
169     {
170 michael 1767 "disable_fake_channels",
171     OUTPUT_BOOLEAN_YN,
172     &ConfigChannel.disable_fake_channels,
173     "Forbids channels with special ASCII characters in their name"
174     },
175     {
176 michael 3860 "invite_client_count",
177 michael 3764 OUTPUT_DECIMAL,
178 michael 3860 &ConfigChannel.invite_client_count,
179     "How many INVITE attempts are permitted in invite_client_time"
180 michael 3764 },
181     {
182 michael 3860 "invite_client_time",
183 michael 3764 OUTPUT_DECIMAL,
184 michael 3860 &ConfigChannel.invite_client_time,
185 michael 3862 "How many invite_client_count invites are allowed in this time"
186 michael 3764 },
187     {
188 michael 6792 "invite_delay_channel",
189     OUTPUT_DECIMAL,
190     &ConfigChannel.invite_delay_channel,
191     "Delay between INVITE attempts to a channel"
192     },
193     {
194 michael 7793 "invite_expire_time",
195     OUTPUT_DECIMAL,
196     &ConfigChannel.invite_expire_time,
197     "Amount of time an INVITE will be active until it expires"
198     },
199     {
200 michael 3860 "knock_client_count",
201 adx 30 OUTPUT_DECIMAL,
202 michael 3860 &ConfigChannel.knock_client_count,
203 michael 3861 "How many KNOCK attempts are permitted in knock_client_time"
204 adx 30 },
205     {
206 michael 3860 "knock_client_time",
207     OUTPUT_DECIMAL,
208     &ConfigChannel.knock_client_time,
209 michael 4313 "How many knock_client_count knocks are allowed in this time"
210 michael 3860 },
211     {
212 adx 30 "knock_delay_channel",
213     OUTPUT_DECIMAL,
214     &ConfigChannel.knock_delay_channel,
215     "Delay between KNOCK attempts to a channel"
216     },
217     {
218 michael 3933 "max_channels",
219 adx 30 OUTPUT_DECIMAL,
220 michael 3933 &ConfigChannel.max_channels,
221 adx 30 "Maximum number of channels a user can join"
222     },
223     {
224 michael 7766 "max_invites",
225     OUTPUT_DECIMAL,
226     &ConfigChannel.max_invites,
227     "Maximum number of channels a user can be invited to"
228     },
229     {
230 adx 30 "max_bans",
231     OUTPUT_DECIMAL,
232     &ConfigChannel.max_bans,
233     "Total +b/e/I modes allowed in a channel"
234     },
235     {
236 michael 8046 "max_bans_large",
237     OUTPUT_DECIMAL,
238     &ConfigChannel.max_bans_large,
239     "Total +b/e/I modes allowed in a +L channel"
240     },
241     {
242 adx 30 "flatten_links",
243     OUTPUT_BOOLEAN_YN,
244     &ConfigServerHide.flatten_links,
245     "Flatten /links list"
246     },
247     {
248 michael 6597 "flatten_links_delay",
249 adx 30 OUTPUT_DECIMAL,
250 michael 6597 &ConfigServerHide.flatten_links_delay,
251 adx 30 "Links rehash delay"
252     },
253     {
254 michael 6599 "flatten_links_file",
255     OUTPUT_STRING,
256     &ConfigServerHide.flatten_links_file,
257     "Path to the flatten links cache file"
258     },
259     {
260 adx 30 "hidden",
261     OUTPUT_BOOLEAN_YN,
262     &ConfigServerHide.hidden,
263     "Hide this server from a flattened /links on remote servers"
264     },
265     {
266     "hide_servers",
267     OUTPUT_BOOLEAN_YN,
268     &ConfigServerHide.hide_servers,
269     "Hide servernames from users"
270     },
271     {
272 michael 1854 "hide_services",
273     OUTPUT_BOOLEAN_YN,
274     &ConfigServerHide.hide_services,
275     "Hides the location of services server"
276     },
277     {
278 adx 30 "hidden_name",
279     OUTPUT_STRING,
280     &ConfigServerHide.hidden_name,
281     "Server name users see if hide_servers = yes"
282     },
283     {
284     "hide_server_ips",
285     OUTPUT_BOOLEAN_YN,
286     &ConfigServerHide.hide_server_ips,
287 michael 1936 "Prevent people from seeing server IP addresses"
288 adx 30 },
289     {
290 michael 4313 "away_count",
291     OUTPUT_DECIMAL,
292 michael 4340 &ConfigGeneral.away_count,
293 michael 4313 "How many AWAY attempts are permitted in away_time"
294     },
295     {
296     "away_time",
297     OUTPUT_DECIMAL,
298 michael 4340 &ConfigGeneral.away_time,
299 michael 4313 "How many away_count aways are allowed in this time"
300     },
301     {
302 michael 5805 "dline_min_cidr",
303 adx 30 OUTPUT_DECIMAL,
304 michael 5805 &ConfigGeneral.dline_min_cidr,
305     "Minimum required length of a CIDR bitmask for IPv4 D-Lines"
306 adx 30 },
307     {
308 michael 5805 "dline_min_cidr6",
309 adx 30 OUTPUT_DECIMAL,
310 michael 5805 &ConfigGeneral.dline_min_cidr6,
311     "Minimum required length of a CIDR bitmask for IPv6 D-Lines"
312 adx 30 },
313     {
314 michael 5805 "kline_min_cidr",
315     OUTPUT_DECIMAL,
316     &ConfigGeneral.kline_min_cidr,
317     "Minimum required length of a CIDR bitmask for IPv4 K-Lines"
318     },
319     {
320     "kline_min_cidr6",
321     OUTPUT_DECIMAL,
322     &ConfigGeneral.kline_min_cidr6,
323     "Minimum required length of a CIDR bitmask for IPv6 K-Lines"
324     },
325     {
326 adx 30 "invisible_on_connect",
327     OUTPUT_BOOLEAN_YN,
328 michael 4340 &ConfigGeneral.invisible_on_connect,
329 adx 30 "Automatically set mode +i on connecting users"
330     },
331     {
332     "kill_chase_time_limit",
333     OUTPUT_DECIMAL,
334 michael 4340 &ConfigGeneral.kill_chase_time_limit,
335 adx 30 "Nick Change Tracker for KILL"
336     },
337     {
338     "ignore_bogus_ts",
339     OUTPUT_BOOLEAN_YN,
340 michael 4340 &ConfigGeneral.ignore_bogus_ts,
341 adx 30 "Ignore bogus timestamps from other servers"
342     },
343     {
344 michael 2283 "cycle_on_host_change",
345     OUTPUT_BOOLEAN_YN,
346 michael 4340 &ConfigGeneral.cycle_on_host_change,
347 michael 2283 "Send a fake QUIT/JOIN combination on host change"
348     },
349     {
350 adx 30 "disable_auth",
351     OUTPUT_BOOLEAN_YN,
352 michael 4340 &ConfigGeneral.disable_auth,
353 adx 30 "Completely disable ident lookups"
354     },
355     {
356     "disable_remote_commands",
357     OUTPUT_BOOLEAN_YN,
358 michael 2196 &ConfigServerHide.disable_remote_commands,
359 adx 30 "Prevent users issuing commands on remote servers"
360     },
361     {
362     "tkline_expire_notices",
363     OUTPUT_BOOLEAN_YN,
364 michael 4340 &ConfigGeneral.tkline_expire_notices,
365 adx 30 "Show temporary kline/xline expire notices"
366     },
367     {
368     "default_floodcount",
369     OUTPUT_DECIMAL,
370 michael 4340 &ConfigGeneral.default_floodcount,
371 adx 30 "Startup value of FLOODCOUNT"
372     },
373     {
374 michael 7858 "default_floodtime",
375     OUTPUT_DECIMAL,
376     &ConfigGeneral.default_floodtime,
377     "Startup value of FLOODTIME"
378     },
379     {
380 adx 30 "failed_oper_notice",
381 michael 3545 OUTPUT_BOOLEAN_YN,
382 michael 4340 &ConfigGeneral.failed_oper_notice,
383 michael 8057 "Inform opers if someone tries to /oper with the wrong credentials"
384 adx 30 },
385     {
386     "dots_in_ident",
387     OUTPUT_DECIMAL,
388 michael 4340 &ConfigGeneral.dots_in_ident,
389 adx 30 "Number of permissable dots in an ident"
390     },
391     {
392     "min_nonwildcard",
393     OUTPUT_DECIMAL,
394 michael 4340 &ConfigGeneral.min_nonwildcard,
395 michael 5894 "Minimum non-wildcard chars in K/D lines"
396 adx 30 },
397     {
398     "min_nonwildcard_simple",
399     OUTPUT_DECIMAL,
400 michael 4340 &ConfigGeneral.min_nonwildcard_simple,
401 adx 30 "Minimum non-wildcards in gecos bans"
402     },
403     {
404 michael 5620 "max_watch",
405     OUTPUT_DECIMAL,
406     &ConfigGeneral.max_watch,
407     "Maximum nicknames on watch list"
408     },
409     {
410 adx 30 "max_accept",
411     OUTPUT_DECIMAL,
412 michael 4340 &ConfigGeneral.max_accept,
413 adx 30 "Maximum nicknames on accept list"
414     },
415     {
416 michael 7437 "whowas_history_length",
417     OUTPUT_DECIMAL,
418     &ConfigGeneral.whowas_history_length,
419     "Length of the WHOWAS nick name history list"
420     },
421     {
422 adx 30 "anti_nick_flood",
423 michael 3545 OUTPUT_BOOLEAN_YN,
424 michael 4340 &ConfigGeneral.anti_nick_flood,
425 adx 30 "NICK flood protection"
426     },
427     {
428     "max_nick_time",
429     OUTPUT_DECIMAL,
430 michael 4340 &ConfigGeneral.max_nick_time,
431 adx 30 "NICK flood protection time interval"
432     },
433     {
434     "max_nick_changes",
435     OUTPUT_DECIMAL,
436 michael 4340 &ConfigGeneral.max_nick_changes,
437 adx 30 "NICK change threshhold setting"
438     },
439     {
440     "anti_spam_exit_message_time",
441     OUTPUT_DECIMAL,
442 michael 4340 &ConfigGeneral.anti_spam_exit_message_time,
443 adx 30 "Duration a client must be connected for to have an exit message"
444     },
445     {
446     "ts_warn_delta",
447     OUTPUT_DECIMAL,
448 michael 4340 &ConfigGeneral.ts_warn_delta,
449 adx 30 "Maximum permitted TS delta before displaying a warning"
450     },
451     {
452     "ts_max_delta",
453     OUTPUT_DECIMAL,
454 michael 4340 &ConfigGeneral.ts_max_delta,
455 adx 30 "Maximum permitted TS delta from another server"
456     },
457     {
458 michael 3473 "warn_no_connect_block",
459 michael 3545 OUTPUT_BOOLEAN_YN,
460 michael 4340 &ConfigGeneral.warn_no_connect_block,
461 michael 3473 "Display warning if connecting server lacks a connect{} block"
462 adx 30 },
463     {
464 michael 1767 "stats_e_disabled",
465     OUTPUT_BOOLEAN_YN,
466 michael 4340 &ConfigGeneral.stats_e_disabled,
467 michael 1767 "Whether or not STATS e is disabled"
468     },
469     {
470 michael 5620 "stats_m_oper_only",
471     OUTPUT_BOOLEAN_YN,
472     &ConfigGeneral.stats_m_oper_only,
473     "STATS m output is only shown to operators"
474     },
475     {
476 adx 30 "stats_o_oper_only",
477     OUTPUT_BOOLEAN_YN,
478 michael 4340 &ConfigGeneral.stats_o_oper_only,
479 adx 30 "STATS O output is only shown to operators"
480     },
481     {
482     "stats_P_oper_only",
483     OUTPUT_BOOLEAN_YN,
484 michael 4340 &ConfigGeneral.stats_P_oper_only,
485 michael 6533 "STATS P output is only shown to operators"
486 adx 30 },
487     {
488 michael 2269 "stats_u_oper_only",
489     OUTPUT_BOOLEAN_YN,
490 michael 4340 &ConfigGeneral.stats_u_oper_only,
491 michael 6533 "STATS u output is only shown to operators"
492 michael 2269 },
493     {
494 adx 30 "stats_i_oper_only",
495     OUTPUT_BOOLEAN2,
496 michael 4340 &ConfigGeneral.stats_i_oper_only,
497 adx 30 "STATS I output is only shown to operators"
498     },
499     {
500     "stats_k_oper_only",
501     OUTPUT_BOOLEAN2,
502 michael 4340 &ConfigGeneral.stats_k_oper_only,
503 adx 30 "STATS K output is only shown to operators"
504     },
505     {
506     "caller_id_wait",
507     OUTPUT_DECIMAL,
508 michael 4340 &ConfigGeneral.caller_id_wait,
509 adx 30 "Minimum delay between notifying UMODE +g users of messages"
510     },
511     {
512     "opers_bypass_callerid",
513     OUTPUT_BOOLEAN_YN,
514 michael 4340 &ConfigGeneral.opers_bypass_callerid,
515 adx 30 "Allows IRC operators to message users who are +g (callerid)"
516     },
517     {
518     "pace_wait_simple",
519     OUTPUT_DECIMAL,
520 michael 4340 &ConfigGeneral.pace_wait_simple,
521 adx 30 "Minimum delay between less intensive commands"
522     },
523     {
524     "pace_wait",
525     OUTPUT_DECIMAL,
526 michael 4340 &ConfigGeneral.pace_wait,
527 adx 30 "Minimum delay between uses of certain commands"
528     },
529     {
530     "short_motd",
531     OUTPUT_BOOLEAN_YN,
532 michael 4340 &ConfigGeneral.short_motd,
533 adx 30 "Do not show MOTD; only tell clients they should read it"
534     },
535     {
536     "ping_cookie",
537 michael 3545 OUTPUT_BOOLEAN_YN,
538 michael 4340 &ConfigGeneral.ping_cookie,
539 adx 30 "Require ping cookies to connect"
540     },
541     {
542     "no_oper_flood",
543 michael 3545 OUTPUT_BOOLEAN_YN,
544 michael 4340 &ConfigGeneral.no_oper_flood,
545 adx 30 "Reduce flood control for operators"
546     },
547     {
548     "max_targets",
549     OUTPUT_DECIMAL,
550 michael 4340 &ConfigGeneral.max_targets,
551 adx 30 "The maximum number of PRIVMSG/NOTICE targets"
552     },
553     {
554 michael 3877 "throttle_count",
555     OUTPUT_DECIMAL,
556 michael 4340 &ConfigGeneral.throttle_count,
557 michael 3877 "Number of connects in throttle_time before connections are blocked"
558     },
559     {
560 adx 30 "throttle_time",
561     OUTPUT_DECIMAL,
562 michael 4340 &ConfigGeneral.throttle_time,
563 adx 30 "Minimum time between client reconnects"
564     },
565 michael 1459
566 adx 30 /* --[ END OF TABLE ]---------------------------------------------- */
567     {
568     NULL,
569     0,
570     NULL,
571 michael 5022 NULL
572 adx 30 }
573     };
574    
575     /* send_birthdate_online_time()
576     *
577     * inputs - client pointer to send to
578     * output - NONE
579     * side effects - birthdate and online time are sent
580     */
581     static void
582     send_birthdate_online_time(struct Client *source_p)
583     {
584 michael 5583 sendto_one_numeric(source_p, &me, RPL_INFO | SND_EXPLICIT,
585 michael 3573 ":On-line since %s",
586 michael 6510 date(me.connection->firsttime));
587 adx 30 }
588    
589     /* send_conf_options()
590     *
591     * inputs - client pointer to send to
592     * output - NONE
593     * side effects - send config options to client
594     */
595     static void
596     send_conf_options(struct Client *source_p)
597     {
598     /*
599     * Parse the info_table[] and do the magic.
600     */
601 michael 3459 for (const struct InfoStruct *iptr = info_table; iptr->name; ++iptr)
602 adx 30 {
603     switch (iptr->output_type)
604     {
605     /* For "char *" references */
606     case OUTPUT_STRING:
607     {
608 michael 3343 const char *option = *((const char *const *)iptr->option);
609 adx 30
610 michael 5583 sendto_one_numeric(source_p, &me, RPL_INFO | SND_EXPLICIT,
611 michael 4435 ":%-30s %-5s [%s]",
612 michael 3573 iptr->name, option ? option : "NONE",
613     iptr->desc ? iptr->desc : "<none>");
614 adx 30 break;
615     }
616    
617     /* For "char foo[]" references */
618     case OUTPUT_STRING_PTR:
619     {
620     const char *option = iptr->option;
621    
622 michael 5583 sendto_one_numeric(source_p, &me, RPL_INFO | SND_EXPLICIT,
623 michael 4435 ":%-30s %-5s [%s]",
624 michael 3573 iptr->name, option ? option : "NONE",
625     iptr->desc ? iptr->desc : "<none>");
626 adx 30 break;
627     }
628    
629     /* Output info_table[i].option as a decimal value. */
630     case OUTPUT_DECIMAL:
631     {
632 michael 5891 const unsigned int option = *((const unsigned int *const)iptr->option);
633 adx 30
634 michael 5583 sendto_one_numeric(source_p, &me, RPL_INFO | SND_EXPLICIT,
635 michael 5891 ":%-30s %-5u [%s]",
636 michael 3573 iptr->name, option, iptr->desc ? iptr->desc : "<none>");
637 adx 30 break;
638     }
639    
640     /* Output info_table[i].option as "ON" or "OFF" */
641     case OUTPUT_BOOLEAN:
642     {
643 michael 5891 const unsigned int option = *((const unsigned int *const)iptr->option);
644 adx 30
645 michael 5583 sendto_one_numeric(source_p, &me, RPL_INFO | SND_EXPLICIT,
646 michael 4435 ":%-30s %-5s [%s]",
647 michael 3573 iptr->name, option ? "ON" : "OFF",
648     iptr->desc ? iptr->desc : "<none>");
649 adx 30
650     break;
651     }
652    
653     /* Output info_table[i].option as "YES" or "NO" */
654     case OUTPUT_BOOLEAN_YN:
655     {
656 michael 5891 const unsigned int option = *((const unsigned int *const)iptr->option);
657 adx 30
658 michael 5583 sendto_one_numeric(source_p, &me, RPL_INFO | SND_EXPLICIT,
659 michael 4435 ":%-30s %-5s [%s]",
660 michael 3573 iptr->name, option ? "YES" : "NO",
661     iptr->desc ? iptr->desc : "<none>");
662 adx 30 break;
663     }
664    
665     case OUTPUT_BOOLEAN2:
666     {
667 michael 5891 const unsigned int option = *((const unsigned int *const)iptr->option);
668 adx 30
669 michael 5583 sendto_one_numeric(source_p, &me, RPL_INFO | SND_EXPLICIT,
670 michael 4435 ":%-30s %-5s [%s]",
671 michael 3573 iptr->name, option ? ((option == 1) ? "MASK" : "YES") : "NO",
672     iptr->desc ? iptr->desc : "<none>");
673 adx 30 break;
674     }
675     }
676     }
677    
678 michael 3109 sendto_one_numeric(source_p, &me, RPL_INFO, "");
679 adx 30 }
680 michael 1230
681 michael 1827 /* send_info_text()
682     *
683     * inputs - client pointer to send info text to
684     * output - NONE
685     * side effects - info text is sent to client
686     */
687 michael 3156 static void
688 michael 1827 send_info_text(struct Client *source_p)
689     {
690     sendto_realops_flags(UMODE_SPY, L_ALL, SEND_NOTICE,
691     "INFO requested by %s (%s@%s) [%s]",
692     source_p->name, source_p->username,
693     source_p->host, source_p->servptr->name);
694    
695 michael 3893 for (const char **text = infotext; *text; ++text)
696 michael 1827 {
697 michael 3878 const char *line = *text;
698 michael 1827
699     if (*line == '\0')
700     line = " ";
701    
702 michael 3109 sendto_one_numeric(source_p, &me, RPL_INFO, line);
703 michael 1827 }
704    
705     if (HasUMode(source_p, UMODE_OPER))
706 michael 7708 {
707 michael 1827 send_conf_options(source_p);
708    
709 michael 7708 if (tls_is_initialized())
710     sendto_one_numeric(source_p, &me, RPL_INFO, tls_get_version());
711     }
712    
713 michael 1827 send_birthdate_online_time(source_p);
714    
715 michael 3109 sendto_one_numeric(source_p, &me, RPL_ENDOFINFO);
716 michael 1827 }
717    
718 michael 3275 /*! \brief INFO command handler
719     *
720     * \param source_p Pointer to allocated Client struct from which the message
721     * originally comes from. This can be a local or remote client.
722     * \param parc Integer holding the number of supplied arguments.
723     * \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL
724     * pointers.
725     * \note Valid arguments for this command are:
726     * - parv[0] = command
727 michael 3300 * - parv[1] = nickname/servername
728 michael 3275 */
729 michael 2820 static int
730 michael 3156 m_info(struct Client *source_p, int parc, char *parv[])
731 michael 1827 {
732 michael 7330 static uintmax_t last_used = 0;
733 michael 1827
734 michael 4340 if ((last_used + ConfigGeneral.pace_wait) > CurrentTime)
735 michael 1827 {
736 michael 4759 sendto_one_numeric(source_p, &me, RPL_LOAD2HI, "INFO");
737 michael 2820 return 0;
738 michael 1827 }
739    
740     last_used = CurrentTime;
741    
742 michael 2196 if (!ConfigServerHide.disable_remote_commands)
743 michael 7971 if (server_hunt(source_p, ":%s INFO :%s", 1, parc, parv)->ret != HUNTED_ISME)
744 michael 2820 return 0;
745 michael 1827
746 michael 3156 send_info_text(source_p);
747     return 0;
748 michael 1827 }
749    
750 michael 3275 /*! \brief INFO command handler
751     *
752     * \param source_p Pointer to allocated Client struct from which the message
753     * originally comes from. This can be a local or remote client.
754     * \param parc Integer holding the number of supplied arguments.
755     * \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL
756     * pointers.
757     * \note Valid arguments for this command are:
758     * - parv[0] = command
759 michael 3300 * - parv[1] = nickname/servername
760 michael 3275 */
761 michael 2820 static int
762 michael 3156 ms_info(struct Client *source_p, int parc, char *parv[])
763 michael 1827 {
764 michael 7971 if (server_hunt(source_p, ":%s INFO :%s", 1, parc, parv)->ret != HUNTED_ISME)
765 michael 2820 return 0;
766 michael 1827
767 michael 3156 send_info_text(source_p);
768     return 0;
769 michael 1827 }
770    
771 michael 2820 static struct Message info_msgtab =
772     {
773 michael 5881 .cmd = "INFO",
774     .args_max = MAXPARA,
775     .handlers[UNREGISTERED_HANDLER] = m_unregistered,
776     .handlers[CLIENT_HANDLER] = m_info,
777     .handlers[SERVER_HANDLER] = ms_info,
778     .handlers[ENCAP_HANDLER] = m_ignore,
779     .handlers[OPER_HANDLER] = ms_info
780 michael 1230 };
781    
782     static void
783     module_init(void)
784     {
785     mod_add_cmd(&info_msgtab);
786     }
787    
788     static void
789     module_exit(void)
790     {
791     mod_del_cmd(&info_msgtab);
792     }
793    
794 michael 2820 struct module module_entry =
795     {
796 michael 1230 .version = "$Revision$",
797     .modinit = module_init,
798     .modexit = module_exit,
799     };

Properties

Name Value
svn:eol-style native
svn:keywords Id Revision