ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_info.c
Revision: 6375
Committed: Fri Aug 21 10:34:16 2015 UTC (10 years ago) by michael
Content type: text/x-csrc
File size: 18615 byte(s)
Log Message:
- Remove splitmode checking

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

Properties

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