ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_info.c
Revision: 5620
Committed: Fri Feb 27 19:13:35 2015 UTC (11 years, 4 months ago) by michael
Content type: text/x-csrc
File size: 19237 byte(s)
Log Message:
- m_info.c: added missing 'max_watch' and 'stats_m_oper_only' to /info

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

Properties

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