ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_info.c
(Generate patch)

Comparing ircd-hybrid/trunk/modules/m_info.c (file contents):
Revision 3115 by michael, Fri Mar 7 19:02:12 2014 UTC vs.
Revision 7258 by michael, Sat Feb 6 17:29:57 2016 UTC

# Line 1 | Line 1
1   /*
2   *  ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3   *
4 < *  Copyright (c) 1997-2014 ircd-hybrid development team
4 > *  Copyright (c) 1997-2016 ircd-hybrid development team
5   *
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
# Line 15 | Line 15
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 < *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
18 > *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19   *  USA
20   */
21  
# Line 26 | Line 26
26  
27   #include "stdinc.h"
28   #include "list.h"
29 #include "channel.h"
29   #include "client.h"
31 #include "irc_string.h"
30   #include "ircd.h"
31   #include "numeric.h"
32 < #include "s_misc.h"
33 < #include "s_serv.h"
36 < #include "s_user.h"
32 > #include "misc.h"
33 > #include "server.h"
34   #include "send.h"
35   #include "conf.h"
36   #include "parse.h"
37   #include "modules.h"
38  
39  
40 + /* 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   /*
52   * jdc -- Structure for our configuration value table
53   */
54   struct InfoStruct
55   {
56 <  const char *name;         /* Displayed variable name           */
57 <  unsigned int output_type; /* See below #defines                */
58 <  void *option;             /* Pointer reference to the value    */
59 <  const char *desc;         /* ASCII description of the variable */
56 >  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   };
61  
54 /* Types for output_type in InfoStruct */
55 #define OUTPUT_STRING     0x0001  /* Output option as %s w/ dereference  */
56 #define OUTPUT_STRING_PTR 0x0002  /* Output option as %s w/out deference */
57 #define OUTPUT_DECIMAL    0x0004  /* Output option as decimal (%d)       */
58 #define OUTPUT_BOOLEAN    0x0008  /* Output option as "ON" or "OFF"      */
59 #define OUTPUT_BOOLEAN_YN 0x0010  /* Output option as "YES" or "NO"      */
60 #define OUTPUT_BOOLEAN2   0x0020  /* Output option as "YES/NO/MASKED"    */
61
62   static const struct InfoStruct info_table[] =
63   {
64    /* --[  START OF TABLE  ]-------------------------------------------- */
65  
66    {
67 <    "CPATH",
67 >    "DPATH",
68      OUTPUT_STRING,
69 <    &ConfigFileEntry.configfile,
70 <    "Path to main configuration file"
69 >    &ConfigGeneral.dpath,
70 >    "Root directory of installation"
71    },
72    {
73 <    "DPATH",
73 >    "SPATH",
74      OUTPUT_STRING,
75 <    &ConfigFileEntry.dpath,
76 <    "Root directory of installation"
75 >    &ConfigGeneral.spath,
76 >    "Path to server executable"
77 >  },
78 >  {
79 >    "MPATH",
80 >    OUTPUT_STRING,
81 >    &ConfigGeneral.mpath,
82 >    "Path to main motd (Message of the Day) file"
83 >  },
84 >  {
85 >    "CPATH",
86 >    OUTPUT_STRING,
87 >    &ConfigGeneral.configfile,
88 >    "Path to main configuration file"
89    },
90    {
91      "DLPATH",
92      OUTPUT_STRING,
93 <    &ConfigFileEntry.dlinefile,
93 >    &ConfigGeneral.dlinefile,
94      "Path to D-line database file"
95    },
96    {
97      "KPATH",
98      OUTPUT_STRING,
99 <    &ConfigFileEntry.klinefile,
99 >    &ConfigGeneral.klinefile,
100      "Path to K-line database file"
101    },
102    {
91    "GPATH",
92    OUTPUT_STRING,
93    &ConfigFileEntry.glinefile,
94    "Path to G-line database file"
95  },
96  {
103      "XPATH",
104      OUTPUT_STRING,
105 <    &ConfigFileEntry.xlinefile,
105 >    &ConfigGeneral.xlinefile,
106      "Path to X-line database file"
107    },
108    {
109      "RESVPATH",
110      OUTPUT_STRING,
111 <    &ConfigFileEntry.resvfile,
111 >    &ConfigGeneral.resvfile,
112      "Path to resv database file"
113    },
114    {
115      "network_name",
116      OUTPUT_STRING,
117 <    &ServerInfo.network_name,
117 >    &ConfigServerInfo.network_name,
118      "Network name"
119    },
120    {
121      "network_desc",
122      OUTPUT_STRING,
123 <    &ServerInfo.network_desc,
123 >    &ConfigServerInfo.network_desc,
124      "Network description"
125    },
126    {
127      "hub",
128      OUTPUT_BOOLEAN_YN,
129 <    &ServerInfo.hub,
129 >    &ConfigServerInfo.hub,
130      "Server is a hub"
131    },
132    {
133 <    "max_clients",
133 >    "default_max_clients",
134      OUTPUT_DECIMAL,
135 <    &ServerInfo.max_clients,
136 <    "Maximum number of clients permitted simultaneously on this server"
135 >    &ConfigServerInfo.default_max_clients,
136 >    "The default maximum number of clients permitted simultaneously on this server"
137    },
138    {
139      "max_nick_length",
140      OUTPUT_DECIMAL,
141 <    &ServerInfo.max_nick_length,
141 >    &ConfigServerInfo.max_nick_length,
142      "Maximum nickname length"
143    },
144    {
145      "max_topic_length",
146      OUTPUT_DECIMAL,
147 <    &ServerInfo.max_topic_length,
147 >    &ConfigServerInfo.max_topic_length,
148      "Maximum topic length"
149    },
150    {
151 +    "libgeoip_ipv4_database_file",
152 +    OUTPUT_DECIMAL,
153 +    &ConfigServerInfo.libgeoip_ipv4_database_file,
154 +    "Path to the libGeoIP IPv4 database file"
155 +  },
156 +  {
157 +    "libgeoip_ipv6_database_file",
158 +    OUTPUT_DECIMAL,
159 +    &ConfigServerInfo.libgeoip_ipv6_database_file,
160 +    "Path to the libGeoIP IPv6 database file"
161 +  },
162 +  {
163      "use_logging",
164      OUTPUT_BOOLEAN_YN,
165 <    &ConfigLoggingEntry.use_logging,
165 >    &ConfigLog.use_logging,
166      "Enable logging"
167    },
168    {
# Line 154 | Line 172 | static const struct InfoStruct info_tabl
172      "Forbids channels with special ASCII characters in their name"
173    },
174    {
175 <    "knock_delay",
175 >    "invite_client_count",
176      OUTPUT_DECIMAL,
177 <    &ConfigChannel.knock_delay,
178 <    "Delay between a users KNOCK attempts"
177 >    &ConfigChannel.invite_client_count,
178 >    "How many INVITE attempts are permitted in invite_client_time"
179    },
180    {
181 <    "knock_delay_channel",
181 >    "invite_client_time",
182      OUTPUT_DECIMAL,
183 <    &ConfigChannel.knock_delay_channel,
184 <    "Delay between KNOCK attempts to a channel"
183 >    &ConfigChannel.invite_client_time,
184 >    "How many invite_client_count invites are allowed in this time"
185    },
186 +
187    {
188 <    "max_chans_per_user",
188 >    "invite_delay_channel",
189      OUTPUT_DECIMAL,
190 <    &ConfigChannel.max_chans_per_user,
191 <    "Maximum number of channels a user can join"
190 >    &ConfigChannel.invite_delay_channel,
191 >    "Delay between INVITE attempts to a channel"
192    },
193    {
194 <    "max_chans_per_oper",
194 >    "knock_client_count",
195      OUTPUT_DECIMAL,
196 <    &ConfigChannel.max_chans_per_oper,
197 <    "Maximum number of channels an oper can join"
196 >    &ConfigChannel.knock_client_count,
197 >    "How many KNOCK attempts are permitted in knock_client_time"
198    },
199    {
200 <    "max_bans",
200 >    "knock_client_time",
201      OUTPUT_DECIMAL,
202 <    &ConfigChannel.max_bans,
203 <    "Total +b/e/I modes allowed in a channel"
202 >    &ConfigChannel.knock_client_time,
203 >    "How many knock_client_count knocks are allowed in this time"
204    },
205    {
206 <    "default_split_user_count",
206 >    "knock_delay_channel",
207      OUTPUT_DECIMAL,
208 <    &ConfigChannel.default_split_user_count,
209 <    "Startup value of SPLITUSERS"
208 >    &ConfigChannel.knock_delay_channel,
209 >    "Delay between KNOCK attempts to a channel"
210    },
211    {
212 <    "default_split_server_count",
212 >    "max_channels",
213      OUTPUT_DECIMAL,
214 <    &ConfigChannel.default_split_server_count,
215 <    "Startup value of SPLITNUM"
197 <  },
198 <  {
199 <    "no_create_on_split",
200 <    OUTPUT_BOOLEAN_YN,
201 <    &ConfigChannel.no_create_on_split,
202 <    "Disallow creation of channels when split"
214 >    &ConfigChannel.max_channels,
215 >    "Maximum number of channels a user can join"
216    },
217    {
218 <    "no_join_on_split",
219 <    OUTPUT_BOOLEAN_YN,
220 <    &ConfigChannel.no_join_on_split,
221 <    "Disallow joining channels when split"
218 >    "max_bans",
219 >    OUTPUT_DECIMAL,
220 >    &ConfigChannel.max_bans,
221 >    "Total +b/e/I modes allowed in a channel"
222    },
223    {
224      "flatten_links",
# Line 214 | Line 227 | static const struct InfoStruct info_tabl
227      "Flatten /links list"
228    },
229    {
230 <    "links_delay",
230 >    "flatten_links_delay",
231      OUTPUT_DECIMAL,
232 <    &ConfigServerHide.links_delay,
232 >    &ConfigServerHide.flatten_links_delay,
233      "Links rehash delay"
234    },
235    {
236 +    "flatten_links_file",
237 +    OUTPUT_STRING,
238 +    &ConfigServerHide.flatten_links_file,
239 +    "Path to the flatten links cache file"
240 +  },
241 +  {
242      "hidden",
243      OUTPUT_BOOLEAN_YN,
244      &ConfigServerHide.hidden,
# Line 250 | Line 269 | static const struct InfoStruct info_tabl
269      "Prevent people from seeing server IP addresses"
270    },
271    {
272 <    "gline_min_cidr",
272 >    "away_count",
273      OUTPUT_DECIMAL,
274 <    &ConfigFileEntry.gline_min_cidr,
275 <    "Minimum required length of a CIDR bitmask for IPv4 G-Lines"
274 >    &ConfigGeneral.away_count,
275 >    "How many AWAY attempts are permitted in away_time"
276    },
277    {
278 <    "gline_min_cidr6",
278 >    "away_time",
279      OUTPUT_DECIMAL,
280 <    &ConfigFileEntry.gline_min_cidr6,
281 <    "Minimum required length of a CIDR bitmask for IPv6 G-Lines"
280 >    &ConfigGeneral.away_time,
281 >    "How many away_count aways are allowed in this time"
282 >  },
283 >  {
284 >    "dline_min_cidr",
285 >    OUTPUT_DECIMAL,
286 >    &ConfigGeneral.dline_min_cidr,
287 >    "Minimum required length of a CIDR bitmask for IPv4 D-Lines"
288 >  },
289 >  {
290 >    "dline_min_cidr6",
291 >    OUTPUT_DECIMAL,
292 >    &ConfigGeneral.dline_min_cidr6,
293 >    "Minimum required length of a CIDR bitmask for IPv6 D-Lines"
294 >  },
295 >  {
296 >    "kline_min_cidr",
297 >    OUTPUT_DECIMAL,
298 >    &ConfigGeneral.kline_min_cidr,
299 >    "Minimum required length of a CIDR bitmask for IPv4 K-Lines"
300 >  },
301 >  {
302 >    "kline_min_cidr6",
303 >    OUTPUT_DECIMAL,
304 >    &ConfigGeneral.kline_min_cidr6,
305 >    "Minimum required length of a CIDR bitmask for IPv6 K-Lines"
306    },
307    {
308      "invisible_on_connect",
309      OUTPUT_BOOLEAN_YN,
310 <    &ConfigFileEntry.invisible_on_connect,
310 >    &ConfigGeneral.invisible_on_connect,
311      "Automatically set mode +i on connecting users"
312    },
313    {
314      "kill_chase_time_limit",
315      OUTPUT_DECIMAL,
316 <    &ConfigFileEntry.kill_chase_time_limit,
316 >    &ConfigGeneral.kill_chase_time_limit,
317      "Nick Change Tracker for KILL"
318    },
319    {
277    "hide_spoof_ips",
278    OUTPUT_BOOLEAN_YN,
279    &ConfigFileEntry.hide_spoof_ips,
280    "Hide spoofed IP addresses"
281  },
282  {
320      "ignore_bogus_ts",
321      OUTPUT_BOOLEAN_YN,
322 <    &ConfigFileEntry.ignore_bogus_ts,
322 >    &ConfigGeneral.ignore_bogus_ts,
323      "Ignore bogus timestamps from other servers"
324    },
325    {
326      "cycle_on_host_change",
327      OUTPUT_BOOLEAN_YN,
328 <    &ConfigFileEntry.cycle_on_host_change,
328 >    &ConfigGeneral.cycle_on_host_change,
329      "Send a fake QUIT/JOIN combination on host change"
330    },
331    {
332      "disable_auth",
333      OUTPUT_BOOLEAN_YN,
334 <    &ConfigFileEntry.disable_auth,
334 >    &ConfigGeneral.disable_auth,
335      "Completely disable ident lookups"
336    },
337    {
# Line 306 | Line 343 | static const struct InfoStruct info_tabl
343    {
344      "tkline_expire_notices",
345      OUTPUT_BOOLEAN_YN,
346 <    &ConfigFileEntry.tkline_expire_notices,
346 >    &ConfigGeneral.tkline_expire_notices,
347      "Show temporary kline/xline expire notices"
348    },
349    {
350      "default_floodcount",
351      OUTPUT_DECIMAL,
352 <    &ConfigFileEntry.default_floodcount,
352 >    &ConfigGeneral.default_floodcount,
353      "Startup value of FLOODCOUNT"
354    },
355    {
356      "failed_oper_notice",
357 <    OUTPUT_BOOLEAN,
358 <    &ConfigFileEntry.failed_oper_notice,
357 >    OUTPUT_BOOLEAN_YN,
358 >    &ConfigGeneral.failed_oper_notice,
359      "Inform opers if someone tries to /oper with the wrong password"
360    },
361    {
362      "dots_in_ident",
363      OUTPUT_DECIMAL,
364 <    &ConfigFileEntry.dots_in_ident,
364 >    &ConfigGeneral.dots_in_ident,
365      "Number of permissable dots in an ident"
366    },
367    {
368      "min_nonwildcard",
369      OUTPUT_DECIMAL,
370 <    &ConfigFileEntry.min_nonwildcard,
371 <    "Minimum non-wildcard chars in K/G lines"
370 >    &ConfigGeneral.min_nonwildcard,
371 >    "Minimum non-wildcard chars in K/D lines"
372    },
373    {
374      "min_nonwildcard_simple",
375      OUTPUT_DECIMAL,
376 <    &ConfigFileEntry.min_nonwildcard_simple,
376 >    &ConfigGeneral.min_nonwildcard_simple,
377      "Minimum non-wildcards in gecos bans"
378    },
379    {
380 +    "max_watch",
381 +    OUTPUT_DECIMAL,
382 +    &ConfigGeneral.max_watch,
383 +    "Maximum nicknames on watch list"
384 +  },
385 +  {
386      "max_accept",
387      OUTPUT_DECIMAL,
388 <    &ConfigFileEntry.max_accept,
388 >    &ConfigGeneral.max_accept,
389      "Maximum nicknames on accept list"
390    },
391    {
392      "anti_nick_flood",
393 <    OUTPUT_BOOLEAN,
394 <    &ConfigFileEntry.anti_nick_flood,
393 >    OUTPUT_BOOLEAN_YN,
394 >    &ConfigGeneral.anti_nick_flood,
395      "NICK flood protection"
396    },
397    {
398      "max_nick_time",
399      OUTPUT_DECIMAL,
400 <    &ConfigFileEntry.max_nick_time,
400 >    &ConfigGeneral.max_nick_time,
401      "NICK flood protection time interval"
402    },
403    {
404      "max_nick_changes",
405      OUTPUT_DECIMAL,
406 <    &ConfigFileEntry.max_nick_changes,
406 >    &ConfigGeneral.max_nick_changes,
407      "NICK change threshhold setting"
408    },
409    {
410      "anti_spam_exit_message_time",
411      OUTPUT_DECIMAL,
412 <    &ConfigFileEntry.anti_spam_exit_message_time,
412 >    &ConfigGeneral.anti_spam_exit_message_time,
413      "Duration a client must be connected for to have an exit message"
414    },
415    {
416      "ts_warn_delta",
417      OUTPUT_DECIMAL,
418 <    &ConfigFileEntry.ts_warn_delta,
418 >    &ConfigGeneral.ts_warn_delta,
419      "Maximum permitted TS delta before displaying a warning"
420    },
421    {
422      "ts_max_delta",
423      OUTPUT_DECIMAL,
424 <    &ConfigFileEntry.ts_max_delta,
424 >    &ConfigGeneral.ts_max_delta,
425      "Maximum permitted TS delta from another server"
426    },
427    {
428 <    "warn_no_nline",
429 <    OUTPUT_BOOLEAN,
430 <    &ConfigFileEntry.warn_no_nline,
431 <    "Display warning if connecting server lacks N-line"
428 >    "warn_no_connect_block",
429 >    OUTPUT_BOOLEAN_YN,
430 >    &ConfigGeneral.warn_no_connect_block,
431 >    "Display warning if connecting server lacks a connect{} block"
432    },
433    {
434      "stats_e_disabled",
435      OUTPUT_BOOLEAN_YN,
436 <    &ConfigFileEntry.stats_e_disabled,
436 >    &ConfigGeneral.stats_e_disabled,
437      "Whether or not STATS e is disabled"
438    },
439    {
440 +    "stats_m_oper_only",
441 +    OUTPUT_BOOLEAN_YN,
442 +    &ConfigGeneral.stats_m_oper_only,
443 +    "STATS m output is only shown to operators"
444 +  },
445 +  {
446      "stats_o_oper_only",
447      OUTPUT_BOOLEAN_YN,
448 <    &ConfigFileEntry.stats_o_oper_only,
448 >    &ConfigGeneral.stats_o_oper_only,
449      "STATS O output is only shown to operators"
450    },
451    {
452      "stats_P_oper_only",
453      OUTPUT_BOOLEAN_YN,
454 <    &ConfigFileEntry.stats_P_oper_only,
455 <    "STATS P is only shown to operators"
454 >    &ConfigGeneral.stats_P_oper_only,
455 >    "STATS P output is only shown to operators"
456    },
457    {
458      "stats_u_oper_only",
459      OUTPUT_BOOLEAN_YN,
460 <    &ConfigFileEntry.stats_u_oper_only,
461 <    "STATS u is only shown to operators"
460 >    &ConfigGeneral.stats_u_oper_only,
461 >    "STATS u output is only shown to operators"
462    },
463    {
464      "stats_i_oper_only",
465      OUTPUT_BOOLEAN2,
466 <    &ConfigFileEntry.stats_i_oper_only,
466 >    &ConfigGeneral.stats_i_oper_only,
467      "STATS I output is only shown to operators"
468    },
469    {
470      "stats_k_oper_only",
471      OUTPUT_BOOLEAN2,
472 <    &ConfigFileEntry.stats_k_oper_only,
472 >    &ConfigGeneral.stats_k_oper_only,
473      "STATS K output is only shown to operators"
474    },
475    {
476      "caller_id_wait",
477      OUTPUT_DECIMAL,
478 <    &ConfigFileEntry.caller_id_wait,
478 >    &ConfigGeneral.caller_id_wait,
479      "Minimum delay between notifying UMODE +g users of messages"
480    },
481    {
482      "opers_bypass_callerid",
483      OUTPUT_BOOLEAN_YN,
484 <    &ConfigFileEntry.opers_bypass_callerid,
484 >    &ConfigGeneral.opers_bypass_callerid,
485      "Allows IRC operators to message users who are +g (callerid)"
486    },
487    {
488      "pace_wait_simple",
489      OUTPUT_DECIMAL,
490 <    &ConfigFileEntry.pace_wait_simple,
490 >    &ConfigGeneral.pace_wait_simple,
491      "Minimum delay between less intensive commands"
492    },
493    {
494      "pace_wait",
495      OUTPUT_DECIMAL,
496 <    &ConfigFileEntry.pace_wait,
496 >    &ConfigGeneral.pace_wait,
497      "Minimum delay between uses of certain commands"
498    },
499    {
500      "short_motd",
501      OUTPUT_BOOLEAN_YN,
502 <    &ConfigFileEntry.short_motd,
502 >    &ConfigGeneral.short_motd,
503      "Do not show MOTD; only tell clients they should read it"
504    },
505    {
506      "ping_cookie",
507 <    OUTPUT_BOOLEAN,
508 <    &ConfigFileEntry.ping_cookie,
507 >    OUTPUT_BOOLEAN_YN,
508 >    &ConfigGeneral.ping_cookie,
509      "Require ping cookies to connect"
510    },
511    {
512      "no_oper_flood",
464    OUTPUT_BOOLEAN,
465    &ConfigFileEntry.no_oper_flood,
466    "Reduce flood control for operators"
467  },
468  {
469    "true_no_oper_flood",
470    OUTPUT_BOOLEAN,
471    &ConfigFileEntry.true_no_oper_flood,
472    "Completely disable flood control for operators"
473  },
474  {
475    "oper_pass_resv",
513      OUTPUT_BOOLEAN_YN,
514 <    &ConfigFileEntry.oper_pass_resv,
515 <    "Opers can over-ride RESVs"
514 >    &ConfigGeneral.no_oper_flood,
515 >    "Reduce flood control for operators"
516    },
517    {
518      "max_targets",
519      OUTPUT_DECIMAL,
520 <    &ConfigFileEntry.max_targets,
520 >    &ConfigGeneral.max_targets,
521      "The maximum number of PRIVMSG/NOTICE targets"
522    },
523    {
524 <    "throttle_time",
524 >    "throttle_count",
525      OUTPUT_DECIMAL,
526 <    &ConfigFileEntry.throttle_time,
527 <    "Minimum time between client reconnects"
526 >    &ConfigGeneral.throttle_count,
527 >    "Number of connects in throttle_time before connections are blocked"
528    },
529    {
530 <    "glines",
494 <    OUTPUT_BOOLEAN,
495 <    &ConfigFileEntry.glines,
496 <    "G-line (network-wide K-line) support"
497 <  },
498 <  {
499 <    "gline_duration",
500 <    OUTPUT_DECIMAL,
501 <    &ConfigFileEntry.gline_time,
502 <    "Expiry time for G-lines"
503 <  },
504 <  {
505 <    "gline_request_duration",
530 >    "throttle_time",
531      OUTPUT_DECIMAL,
532 <    &ConfigFileEntry.gline_request_time,
533 <    "Expiry time for pending G-lines"
532 >    &ConfigGeneral.throttle_time,
533 >    "Minimum time between client reconnects"
534    },
535  
536    /* --[  END OF TABLE  ]---------------------------------------------- */
# Line 513 | Line 538 | static const struct InfoStruct info_tabl
538      NULL,
539      0,
540      NULL,
541 <    0
541 >    NULL
542    }
543   };
544  
# Line 526 | Line 551 | static const struct InfoStruct info_tabl
551   static void
552   send_birthdate_online_time(struct Client *source_p)
553   {
554 <  sendto_one(source_p, ":%s %d %s :On-line since %s",
555 <             ID_or_name(&me, source_p), RPL_INFO,
556 <             ID_or_name(source_p, source_p),
532 <             myctime(me.localClient->firsttime));
554 >  sendto_one_numeric(source_p, &me, RPL_INFO | SND_EXPLICIT,
555 >                     ":On-line since %s",
556 >                     date(me.connection->firsttime));
557   }
558  
559   /* send_conf_options()
# Line 541 | Line 565 | send_birthdate_online_time(struct Client
565   static void
566   send_conf_options(struct Client *source_p)
567   {
544  const struct InfoStruct *iptr = NULL;
545
568    /*
569     * Parse the info_table[] and do the magic.
570     */
571 <  for (iptr = info_table; iptr->name; ++iptr)
571 >  for (const struct InfoStruct *iptr = info_table; iptr->name; ++iptr)
572    {
573      switch (iptr->output_type)
574      {
575        /* For "char *" references */
576        case OUTPUT_STRING:
577        {
578 <        const char *option = *((char **)iptr->option);
578 >        const char *option = *((const char *const *)iptr->option);
579  
580 <        sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]",
581 <                   ID_or_name(&me, source_p), RPL_INFO, ID_or_name(source_p, source_p),
582 <                   iptr->name, option ? option : "NONE",
583 <                   iptr->desc ? iptr->desc : "<none>");
580 >        sendto_one_numeric(source_p, &me, RPL_INFO | SND_EXPLICIT,
581 >                           ":%-30s %-5s [%s]",
582 >                           iptr->name, option ? option : "NONE",
583 >                           iptr->desc ? iptr->desc : "<none>");
584          break;
585        }
586  
# Line 567 | Line 589 | send_conf_options(struct Client *source_
589        {
590          const char *option = iptr->option;
591  
592 <        sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]",
593 <                   ID_or_name(&me, source_p), RPL_INFO, ID_or_name(source_p, source_p),
594 <                   iptr->name, option ? option : "NONE",
595 <                   iptr->desc ? iptr->desc : "<none>");
592 >        sendto_one_numeric(source_p, &me, RPL_INFO | SND_EXPLICIT,
593 >                           ":%-30s %-5s [%s]",
594 >                           iptr->name, option ? option : "NONE",
595 >                           iptr->desc ? iptr->desc : "<none>");
596          break;
597        }
598  
599        /* Output info_table[i].option as a decimal value. */
600        case OUTPUT_DECIMAL:
601        {
602 <        const int option = *((int *)iptr->option);
602 >        const unsigned int option = *((const unsigned int *const)iptr->option);
603  
604 <        sendto_one(source_p, ":%s %d %s :%-30s %-5d [%-30s]",
605 <                   ID_or_name(&me, source_p), RPL_INFO, ID_or_name(source_p, source_p),
606 <                   option, iptr->desc ? iptr->desc : "<none>");
604 >        sendto_one_numeric(source_p, &me, RPL_INFO | SND_EXPLICIT,
605 >                           ":%-30s %-5u [%s]",
606 >                           iptr->name, option, iptr->desc ? iptr->desc : "<none>");
607          break;
608        }
609  
610        /* Output info_table[i].option as "ON" or "OFF" */
611        case OUTPUT_BOOLEAN:
612        {
613 <        const int option = *((int *)iptr->option);
613 >        const unsigned int option = *((const unsigned int *const)iptr->option);
614  
615 <        sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]",
616 <                   ID_or_name(&me, source_p), RPL_INFO, ID_or_name(source_p, source_p),
617 <                   iptr->name, option ? "ON" : "OFF",
618 <                   iptr->desc ? iptr->desc : "<none>");
615 >        sendto_one_numeric(source_p, &me, RPL_INFO | SND_EXPLICIT,
616 >                           ":%-30s %-5s [%s]",
617 >                           iptr->name, option ? "ON" : "OFF",
618 >                           iptr->desc ? iptr->desc : "<none>");
619  
620          break;
621        }
# Line 601 | Line 623 | send_conf_options(struct Client *source_
623        /* Output info_table[i].option as "YES" or "NO" */
624        case OUTPUT_BOOLEAN_YN:
625        {
626 <        const int option = *((int *)iptr->option);
626 >        const unsigned int option = *((const unsigned int *const)iptr->option);
627  
628 <        sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]",
629 <                   ID_or_name(&me, source_p), RPL_INFO, ID_or_name(source_p, source_p),
630 <                   iptr->name, option ? "YES" : "NO",
631 <                   iptr->desc ? iptr->desc : "<none>");
628 >        sendto_one_numeric(source_p, &me, RPL_INFO | SND_EXPLICIT,
629 >                           ":%-30s %-5s [%s]",
630 >                           iptr->name, option ? "YES" : "NO",
631 >                           iptr->desc ? iptr->desc : "<none>");
632          break;
633        }
634  
635        case OUTPUT_BOOLEAN2:
636        {
637 <        const int option = *((int *)iptr->option);
637 >        const unsigned int option = *((const unsigned int *const)iptr->option);
638  
639 <        sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]",
640 <                   ID_or_name(&me, source_p), RPL_INFO, ID_or_name(source_p, source_p),
641 <                   iptr->name, option ? ((option == 1) ? "MASK" : "YES") : "NO",
642 <                   iptr->desc ? iptr->desc : "<none>");
639 >        sendto_one_numeric(source_p, &me, RPL_INFO | SND_EXPLICIT,
640 >                           ":%-30s %-5s [%s]",
641 >                           iptr->name, option ? ((option == 1) ? "MASK" : "YES") : "NO",
642 >                           iptr->desc ? iptr->desc : "<none>");
643          break;
644        }
645      }
# Line 632 | Line 654 | send_conf_options(struct Client *source_
654   * output       - NONE
655   * side effects - info text is sent to client
656   */
657 < static int
657 > static void
658   send_info_text(struct Client *source_p)
659   {
638  const char **text = infotext;
639
660    sendto_realops_flags(UMODE_SPY, L_ALL, SEND_NOTICE,
661                         "INFO requested by %s (%s@%s) [%s]",
662                         source_p->name, source_p->username,
663                         source_p->host, source_p->servptr->name);
664  
665 <  while (*text)
665 >  for (const char **text = infotext; *text; ++text)
666    {
667 <    const char *line = *text++;
667 >    const char *line = *text;
668  
669      if (*line == '\0')
670        line = " ";
# Line 658 | Line 678 | send_info_text(struct Client *source_p)
678    send_birthdate_online_time(source_p);
679  
680    sendto_one_numeric(source_p, &me, RPL_ENDOFINFO);
661  return 0;
681   }
682  
683 < /*
684 < ** m_info()
685 < **  parv[0] = command
686 < **  parv[1] = servername
687 < */
683 > /*! \brief INFO command handler
684 > *
685 > * \param source_p Pointer to allocated Client struct from which the message
686 > *                 originally comes from.  This can be a local or remote client.
687 > * \param parc     Integer holding the number of supplied arguments.
688 > * \param parv     Argument vector where parv[0] .. parv[parc-1] are non-NULL
689 > *                 pointers.
690 > * \note Valid arguments for this command are:
691 > *      - parv[0] = command
692 > *      - parv[1] = nickname/servername
693 > */
694   static int
695 < m_info(struct Client *client_p, struct Client *source_p,
671 <       int parc, char *parv[])
695 > m_info(struct Client *source_p, int parc, char *parv[])
696   {
697    static time_t last_used = 0;
698  
699 <  if ((last_used + ConfigFileEntry.pace_wait) > CurrentTime)
699 >  if ((last_used + ConfigGeneral.pace_wait) > CurrentTime)
700    {
701 <    /* safe enough to give this on a local connect only */
678 <    sendto_one_numeric(source_p, &me, RPL_LOAD2HI);
701 >    sendto_one_numeric(source_p, &me, RPL_LOAD2HI, "INFO");
702      return 0;
703    }
704  
705    last_used = CurrentTime;
706  
707    if (!ConfigServerHide.disable_remote_commands)
708 <    if (hunt_server(client_p, source_p, ":%s INFO :%s", 1,
686 <                    parc, parv) != HUNTED_ISME)
708 >    if (hunt_server(source_p, ":%s INFO :%s", 1, parc, parv) != HUNTED_ISME)
709        return 0;
710  
711 <  return send_info_text(source_p);
711 >  send_info_text(source_p);
712 >  return 0;
713   }
714  
715 < /*
716 < ** ms_info()
717 < **  parv[0] = command
718 < **  parv[1] = servername
719 < */
715 > /*! \brief INFO command handler
716 > *
717 > * \param source_p Pointer to allocated Client struct from which the message
718 > *                 originally comes from.  This can be a local or remote client.
719 > * \param parc     Integer holding the number of supplied arguments.
720 > * \param parv     Argument vector where parv[0] .. parv[parc-1] are non-NULL
721 > *                 pointers.
722 > * \note Valid arguments for this command are:
723 > *      - parv[0] = command
724 > *      - parv[1] = nickname/servername
725 > */
726   static int
727 < ms_info(struct Client *client_p, struct Client *source_p,
699 <        int parc, char *parv[])
727 > ms_info(struct Client *source_p, int parc, char *parv[])
728   {
729 <  if (hunt_server(client_p, source_p, ":%s INFO :%s", 1,
702 <                  parc, parv) != HUNTED_ISME)
729 >  if (hunt_server(source_p, ":%s INFO :%s", 1, parc, parv) != HUNTED_ISME)
730      return 0;
731  
732 <  return send_info_text(source_p);
732 >  send_info_text(source_p);
733 >  return 0;
734   }
735  
736   static struct Message info_msgtab =
737   {
738 <  "INFO", 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
739 <  { m_unregistered, m_info, ms_info, m_ignore, ms_info, m_ignore }
738 >  .cmd = "INFO",
739 >  .args_max = MAXPARA,
740 >  .handlers[UNREGISTERED_HANDLER] = m_unregistered,
741 >  .handlers[CLIENT_HANDLER] = m_info,
742 >  .handlers[SERVER_HANDLER] = ms_info,
743 >  .handlers[ENCAP_HANDLER] = m_ignore,
744 >  .handlers[OPER_HANDLER] = ms_info
745   };
746  
747   static void
# Line 725 | Line 758 | module_exit(void)
758  
759   struct module module_entry =
760   {
728  .node    = { NULL, NULL, NULL },
729  .name    = NULL,
761    .version = "$Revision$",
731  .handle  = NULL,
762    .modinit = module_init,
763    .modexit = module_exit,
734  .flags   = 0
764   };

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)