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-8/modules/m_info.c (file contents), Revision 1247 by michael, Sat Oct 1 07:54:24 2011 UTC vs.
ircd-hybrid/trunk/modules/m_info.c (file contents), Revision 5022 by michael, Thu Dec 11 16:12:01 2014 UTC

# Line 1 | Line 1
1   /*
2 < *  ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 < *  m_info.c: Sends information about the server.
2 > *  ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3   *
4 < *  Copyright (C) 2005 by the past and present ircd coders, and others.
4 > *  Copyright (c) 1997-2014 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 16 | 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 < *  $Id$
20 > */
21 >
22 > /*! \file m_info.c
23 > * \brief Includes required functions for processing the INFO command.
24 > * \version $Id$
25   */
26  
27   #include "stdinc.h"
28   #include "list.h"
27 – #include "m_info.h"
28 – #include "channel.h"
29   #include "client.h"
30 – #include "irc_string.h"
30   #include "ircd.h"
31   #include "numeric.h"
32 < #include "s_log.h"
33 < #include "s_serv.h"
35 < #include "s_user.h"
32 > #include "misc.h"
33 > #include "server.h"
34   #include "send.h"
35 < #include "s_conf.h"
35 > #include "conf.h"
36   #include "parse.h"
37   #include "modules.h"
38  
39  
40 < static void send_conf_options(struct Client *);
41 < static void send_birthdate_online_time(struct Client *);
42 < static void send_info_text(struct Client *);
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  
57 – /* Types for output_type in InfoStruct */
58 – #define OUTPUT_STRING     0x0001 /* Output option as %s w/ dereference  */
59 – #define OUTPUT_STRING_PTR 0x0002 /* Output option as %s w/out deference */
60 – #define OUTPUT_DECIMAL    0x0004 /* Output option as decimal (%d)       */
61 – #define OUTPUT_BOOLEAN    0x0008 /* Output option as "ON" or "OFF"      */
62 – #define OUTPUT_BOOLEAN_YN 0x0010 /* Output option as "YES" or "NO"      */
63 – #define OUTPUT_BOOLEAN2   0x0020 /* Output option as "YES/NO/MASKED"    */
64 –
62   static const struct InfoStruct info_table[] =
63   {
64    /* --[  START OF TABLE  ]-------------------------------------------- */
65 +
66 +  {
67 +    "DPATH",
68 +    OUTPUT_STRING,
69 +    &ConfigGeneral.dpath,
70 +    "Root directory of installation"
71 +  },
72 +  {
73 +    "SPATH",
74 +    OUTPUT_STRING,
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 +    &ConfigGeneral.dlinefile,
94 +    "Path to D-line database file"
95 +  },
96 +  {
97 +    "KPATH",
98 +    OUTPUT_STRING,
99 +    &ConfigGeneral.klinefile,
100 +    "Path to K-line database file"
101 +  },
102 +  {
103 +    "GPATH",
104 +    OUTPUT_STRING,
105 +    &ConfigGeneral.glinefile,
106 +    "Path to G-line database file"
107 +  },
108 +  {
109 +    "XPATH",
110 +    OUTPUT_STRING,
111 +    &ConfigGeneral.xlinefile,
112 +    "Path to X-line database file"
113 +  },
114 +  {
115 +    "RESVPATH",
116 +    OUTPUT_STRING,
117 +    &ConfigGeneral.resvfile,
118 +    "Path to resv database file"
119 +  },
120    {
121      "network_name",
122      OUTPUT_STRING,
123 <    &ServerInfo.network_name,
123 >    &ConfigServerInfo.network_name,
124      "Network name"
125    },
126    {
127      "network_desc",
128      OUTPUT_STRING,
129 <    &ServerInfo.network_desc,
129 >    &ConfigServerInfo.network_desc,
130      "Network description"
131    },
132    {
133      "hub",
134      OUTPUT_BOOLEAN_YN,
135 <    &ServerInfo.hub,
135 >    &ConfigServerInfo.hub,
136      "Server is a hub"
137    },
138    {
139 +    "max_clients",
140 +    OUTPUT_DECIMAL,
141 +    &ConfigServerInfo.max_clients,
142 +    "Maximum number of clients permitted simultaneously on this server"
143 +  },
144 +  {
145 +    "max_nick_length",
146 +    OUTPUT_DECIMAL,
147 +    &ConfigServerInfo.max_nick_length,
148 +    "Maximum nickname length"
149 +  },
150 +  {
151 +    "max_topic_length",
152 +    OUTPUT_DECIMAL,
153 +    &ConfigServerInfo.max_topic_length,
154 +    "Maximum topic length"
155 +  },
156 +  {
157      "use_logging",
158      OUTPUT_BOOLEAN_YN,
159 <    &ConfigLoggingEntry.use_logging,
159 >    &ConfigLog.use_logging,
160      "Enable logging"
161    },
162    {
163 <    "restrict_channels",
163 >    "disable_fake_channels",
164      OUTPUT_BOOLEAN_YN,
165 <    &ConfigChannel.restrict_channels,
166 <    "Only reserved channels are allowed"
165 >    &ConfigChannel.disable_fake_channels,
166 >    "Forbids channels with special ASCII characters in their name"
167    },
168    {
169 <    "disable_local_channels",
170 <    OUTPUT_BOOLEAN_YN,
171 <    &ConfigChannel.disable_local_channels,
172 <    "Prevent users from joining &channels"
103 <  },
104 < {
105 <    "use_invex",
106 <    OUTPUT_BOOLEAN_YN,
107 <    &ConfigChannel.use_invex,
108 <    "Enable chanmode +I (invite exceptions)"
169 >    "invite_client_count",
170 >    OUTPUT_DECIMAL,
171 >    &ConfigChannel.invite_client_count,
172 >    "How many INVITE attempts are permitted in invite_client_time"
173    },
174 +
175    {
176 <    "use_except",
177 <    OUTPUT_BOOLEAN_YN,
178 <    &ConfigChannel.use_except,
179 <    "Enable chanmode +e (ban exceptions)"
176 >    "invite_client_time",
177 >    OUTPUT_DECIMAL,
178 >    &ConfigChannel.invite_client_time,
179 >    "How many invite_client_count invites are allowed in this time"
180    },
181    {
182 <    "use_knock",
183 <    OUTPUT_BOOLEAN_YN,
184 <    &ConfigChannel.use_knock,
185 <    "Enable /KNOCK"
182 >    "knock_client_count",
183 >    OUTPUT_DECIMAL,
184 >    &ConfigChannel.knock_client_count,
185 >    "How many KNOCK attempts are permitted in knock_client_time"
186    },
187    {
188 <    "knock_delay",
188 >    "knock_client_time",
189      OUTPUT_DECIMAL,
190 <    &ConfigChannel.knock_delay,
191 <    "Delay between a users KNOCK attempts"
190 >    &ConfigChannel.knock_client_time,
191 >    "How many knock_client_count knocks are allowed in this time"
192    },
193    {
194      "knock_delay_channel",
# Line 132 | Line 197 | static const struct InfoStruct info_tabl
197      "Delay between KNOCK attempts to a channel"
198    },
199    {
200 <    "max_chans_per_user",
200 >    "max_channels",
201      OUTPUT_DECIMAL,
202 <    &ConfigChannel.max_chans_per_user,
202 >    &ConfigChannel.max_channels,
203      "Maximum number of channels a user can join"
204    },
205    {
141 –    "quiet_on_ban",
142 –    OUTPUT_BOOLEAN_YN,
143 –    &ConfigChannel.quiet_on_ban,
144 –    "Banned users may not send text to a channel"
145 –  },
146 –  {
206      "max_bans",
207      OUTPUT_DECIMAL,
208      &ConfigChannel.max_bans,
# Line 174 | Line 233 | static const struct InfoStruct info_tabl
233      "Disallow joining channels when split"
234    },
235    {
177 –    "burst_topicwho",
178 –    OUTPUT_BOOLEAN_YN,
179 –    &ConfigChannel.burst_topicwho,
180 –    "Enable sending of who set topic on topicburst"
181 –  },
182 –  {
236      "flatten_links",
237      OUTPUT_BOOLEAN_YN,
238      &ConfigServerHide.flatten_links,
# Line 198 | Line 251 | static const struct InfoStruct info_tabl
251      "Hide this server from a flattened /links on remote servers"
252    },
253    {
201 –    "disable_hidden",
202 –    OUTPUT_BOOLEAN_YN,
203 –    &ConfigServerHide.disable_hidden,
204 –    "Prevent servers from hiding themselves from a flattened /links"
205 –  },
206 –  {
254      "hide_servers",
255      OUTPUT_BOOLEAN_YN,
256      &ConfigServerHide.hide_servers,
257      "Hide servernames from users"
258    },
259    {
260 +    "hide_services",
261 +    OUTPUT_BOOLEAN_YN,
262 +    &ConfigServerHide.hide_services,
263 +    "Hides the location of services server"
264 +  },
265 +  {
266      "hidden_name",
267      OUTPUT_STRING,
268      &ConfigServerHide.hidden_name,
# Line 219 | Line 272 | static const struct InfoStruct info_tabl
272      "hide_server_ips",
273      OUTPUT_BOOLEAN_YN,
274      &ConfigServerHide.hide_server_ips,
275 <    "Prevent people from seeing server IPs"
275 >    "Prevent people from seeing server IP addresses"
276 >  },
277 >  {
278 >    "away_count",
279 >    OUTPUT_DECIMAL,
280 >    &ConfigGeneral.away_count,
281 >    "How many AWAY attempts are permitted in away_time"
282 >  },
283 >  {
284 >    "away_time",
285 >    OUTPUT_DECIMAL,
286 >    &ConfigGeneral.away_time,
287 >    "How many away_count aways are allowed in this time"
288    },
289    {
290      "gline_min_cidr",
291      OUTPUT_DECIMAL,
292 <    &ConfigFileEntry.gline_min_cidr,
292 >    &ConfigGeneral.gline_min_cidr,
293      "Minimum required length of a CIDR bitmask for IPv4 G-Lines"
294    },
295    {
296      "gline_min_cidr6",
297      OUTPUT_DECIMAL,
298 <    &ConfigFileEntry.gline_min_cidr6,
298 >    &ConfigGeneral.gline_min_cidr6,
299      "Minimum required length of a CIDR bitmask for IPv6 G-Lines"
300    },
301    {
302      "invisible_on_connect",
303      OUTPUT_BOOLEAN_YN,
304 <    &ConfigFileEntry.invisible_on_connect,
304 >    &ConfigGeneral.invisible_on_connect,
305      "Automatically set mode +i on connecting users"
306    },
307    {
243 –    "burst_away",
244 –    OUTPUT_BOOLEAN_YN,
245 –    &ConfigFileEntry.burst_away,
246 –    "Send /away string that users have set on the server burst"
247 –  },
248 –  {
249 –    "use_whois_actually",
250 –    OUTPUT_BOOLEAN_YN,
251 –    &ConfigFileEntry.use_whois_actually,
252 –    "Show IP address on /WHOIS when possible"
253 –  },
254 –  {
308      "kill_chase_time_limit",
309      OUTPUT_DECIMAL,
310 <    &ConfigFileEntry.kill_chase_time_limit,
310 >    &ConfigGeneral.kill_chase_time_limit,
311      "Nick Change Tracker for KILL"
312    },
313    {
314 <    "hide_spoof_ips",
314 >    "ignore_bogus_ts",
315      OUTPUT_BOOLEAN_YN,
316 <    &ConfigFileEntry.hide_spoof_ips,
317 <    "Hide spoofed IP's"
316 >    &ConfigGeneral.ignore_bogus_ts,
317 >    "Ignore bogus timestamps from other servers"
318    },
319    {
320 <    "ignore_bogus_ts",
320 >    "cycle_on_host_change",
321      OUTPUT_BOOLEAN_YN,
322 <    &ConfigFileEntry.ignore_bogus_ts,
323 <    "Ignore bogus timestamps from other servers"
322 >    &ConfigGeneral.cycle_on_host_change,
323 >    "Send a fake QUIT/JOIN combination on host change"
324    },
325    {
326      "disable_auth",
327      OUTPUT_BOOLEAN_YN,
328 <    &ConfigFileEntry.disable_auth,
328 >    &ConfigGeneral.disable_auth,
329      "Completely disable ident lookups"
330    },
331    {
332      "disable_remote_commands",
333      OUTPUT_BOOLEAN_YN,
334 <    &ConfigFileEntry.disable_remote,
334 >    &ConfigServerHide.disable_remote_commands,
335      "Prevent users issuing commands on remote servers"
336    },
337    {
338      "tkline_expire_notices",
339      OUTPUT_BOOLEAN_YN,
340 <    &ConfigFileEntry.tkline_expire_notices,
340 >    &ConfigGeneral.tkline_expire_notices,
341      "Show temporary kline/xline expire notices"
342    },
343    {
344      "default_floodcount",
345      OUTPUT_DECIMAL,
346 <    &ConfigFileEntry.default_floodcount,
346 >    &ConfigGeneral.default_floodcount,
347      "Startup value of FLOODCOUNT"
348    },
349    {
350      "failed_oper_notice",
351 <    OUTPUT_BOOLEAN,
352 <    &ConfigFileEntry.failed_oper_notice,
353 <    "Inform opers if someone /oper's with the wrong password"
351 >    OUTPUT_BOOLEAN_YN,
352 >    &ConfigGeneral.failed_oper_notice,
353 >    "Inform opers if someone tries to /oper with the wrong password"
354    },
355    {
356      "dots_in_ident",
357      OUTPUT_DECIMAL,
358 <    &ConfigFileEntry.dots_in_ident,
358 >    &ConfigGeneral.dots_in_ident,
359      "Number of permissable dots in an ident"
360    },
361    {
362      "min_nonwildcard",
363      OUTPUT_DECIMAL,
364 <    &ConfigFileEntry.min_nonwildcard,
364 >    &ConfigGeneral.min_nonwildcard,
365      "Minimum non-wildcard chars in K/G lines"
366    },
367    {
368      "min_nonwildcard_simple",
369      OUTPUT_DECIMAL,
370 <    &ConfigFileEntry.min_nonwildcard_simple,
370 >    &ConfigGeneral.min_nonwildcard_simple,
371      "Minimum non-wildcards in gecos bans"
372    },
373    {
374      "max_accept",
375      OUTPUT_DECIMAL,
376 <    &ConfigFileEntry.max_accept,
376 >    &ConfigGeneral.max_accept,
377      "Maximum nicknames on accept list"
378    },
379    {
380      "anti_nick_flood",
381 <    OUTPUT_BOOLEAN,
382 <    &ConfigFileEntry.anti_nick_flood,
381 >    OUTPUT_BOOLEAN_YN,
382 >    &ConfigGeneral.anti_nick_flood,
383      "NICK flood protection"
384    },
385    {
386      "max_nick_time",
387      OUTPUT_DECIMAL,
388 <    &ConfigFileEntry.max_nick_time,
388 >    &ConfigGeneral.max_nick_time,
389      "NICK flood protection time interval"
390    },
391    {
392      "max_nick_changes",
393      OUTPUT_DECIMAL,
394 <    &ConfigFileEntry.max_nick_changes,
394 >    &ConfigGeneral.max_nick_changes,
395      "NICK change threshhold setting"
396    },
397    {
398      "anti_spam_exit_message_time",
399      OUTPUT_DECIMAL,
400 <    &ConfigFileEntry.anti_spam_exit_message_time,
400 >    &ConfigGeneral.anti_spam_exit_message_time,
401      "Duration a client must be connected for to have an exit message"
402    },
403    {
404      "ts_warn_delta",
405      OUTPUT_DECIMAL,
406 <    &ConfigFileEntry.ts_warn_delta,
406 >    &ConfigGeneral.ts_warn_delta,
407      "Maximum permitted TS delta before displaying a warning"
408    },
409    {
410      "ts_max_delta",
411      OUTPUT_DECIMAL,
412 <    &ConfigFileEntry.ts_max_delta,
412 >    &ConfigGeneral.ts_max_delta,
413      "Maximum permitted TS delta from another server"
414    },
415    {
416 <    "kline_with_reason",
416 >    "warn_no_connect_block",
417      OUTPUT_BOOLEAN_YN,
418 <    &ConfigFileEntry.kline_with_reason,
419 <    "Display K-line reason to client on disconnect"
418 >    &ConfigGeneral.warn_no_connect_block,
419 >    "Display warning if connecting server lacks a connect{} block"
420    },
421    {
422 <    "kline_reason",
423 <    OUTPUT_STRING,
424 <    &ConfigFileEntry.kline_reason,
425 <    "Reason given to K-lined clients on sign off"
373 <  },
374 <  {
375 <    "warn_no_nline",
376 <    OUTPUT_BOOLEAN,
377 <    &ConfigFileEntry.warn_no_nline,
378 <    "Display warning if connecting server lacks N-line"
422 >    "stats_e_disabled",
423 >    OUTPUT_BOOLEAN_YN,
424 >    &ConfigGeneral.stats_e_disabled,
425 >    "Whether or not STATS e is disabled"
426    },
427    {
428      "stats_o_oper_only",
429      OUTPUT_BOOLEAN_YN,
430 <    &ConfigFileEntry.stats_o_oper_only,
430 >    &ConfigGeneral.stats_o_oper_only,
431      "STATS O output is only shown to operators"
432    },
433    {
434      "stats_P_oper_only",
435      OUTPUT_BOOLEAN_YN,
436 <    &ConfigFileEntry.stats_P_oper_only,
436 >    &ConfigGeneral.stats_P_oper_only,
437      "STATS P is only shown to operators"
438    },
439    {
440 +    "stats_u_oper_only",
441 +    OUTPUT_BOOLEAN_YN,
442 +    &ConfigGeneral.stats_u_oper_only,
443 +    "STATS u is only shown to operators"
444 +  },
445 +  {
446      "stats_i_oper_only",
447      OUTPUT_BOOLEAN2,
448 <    &ConfigFileEntry.stats_i_oper_only,
448 >    &ConfigGeneral.stats_i_oper_only,
449      "STATS I output is only shown to operators"
450    },
451    {
452      "stats_k_oper_only",
453      OUTPUT_BOOLEAN2,
454 <    &ConfigFileEntry.stats_k_oper_only,
454 >    &ConfigGeneral.stats_k_oper_only,
455      "STATS K output is only shown to operators"
456    },
457    {
458      "caller_id_wait",
459      OUTPUT_DECIMAL,
460 <    &ConfigFileEntry.caller_id_wait,
460 >    &ConfigGeneral.caller_id_wait,
461      "Minimum delay between notifying UMODE +g users of messages"
462    },
463    {
464      "opers_bypass_callerid",
465      OUTPUT_BOOLEAN_YN,
466 <    &ConfigFileEntry.opers_bypass_callerid,
466 >    &ConfigGeneral.opers_bypass_callerid,
467      "Allows IRC operators to message users who are +g (callerid)"
468    },
469    {
470      "pace_wait_simple",
471      OUTPUT_DECIMAL,
472 <    &ConfigFileEntry.pace_wait_simple,
472 >    &ConfigGeneral.pace_wait_simple,
473      "Minimum delay between less intensive commands"
474    },
475    {
476      "pace_wait",
477      OUTPUT_DECIMAL,
478 <    &ConfigFileEntry.pace_wait,
478 >    &ConfigGeneral.pace_wait,
479      "Minimum delay between uses of certain commands"
480    },
481    {
482      "short_motd",
483      OUTPUT_BOOLEAN_YN,
484 <    &ConfigFileEntry.short_motd,
484 >    &ConfigGeneral.short_motd,
485      "Do not show MOTD; only tell clients they should read it"
486    },
487    {
488      "ping_cookie",
489 <    OUTPUT_BOOLEAN,
490 <    &ConfigFileEntry.ping_cookie,
489 >    OUTPUT_BOOLEAN_YN,
490 >    &ConfigGeneral.ping_cookie,
491      "Require ping cookies to connect"
492    },
493    {
494      "no_oper_flood",
495 <    OUTPUT_BOOLEAN,
496 <    &ConfigFileEntry.no_oper_flood,
495 >    OUTPUT_BOOLEAN_YN,
496 >    &ConfigGeneral.no_oper_flood,
497      "Reduce flood control for operators"
498    },
499    {
447 –    "true_no_oper_flood",
448 –    OUTPUT_BOOLEAN,
449 –    &ConfigFileEntry.true_no_oper_flood,
450 –    "Completely disable flood control for operators"
451 –  },
452 –  {
500      "oper_pass_resv",
501      OUTPUT_BOOLEAN_YN,
502 <    &ConfigFileEntry.oper_pass_resv,
502 >    &ConfigGeneral.oper_pass_resv,
503      "Opers can over-ride RESVs"
504    },
505    {
506      "max_targets",
507      OUTPUT_DECIMAL,
508 <    &ConfigFileEntry.max_targets,
508 >    &ConfigGeneral.max_targets,
509      "The maximum number of PRIVMSG/NOTICE targets"
510    },
511    {
512 <    "client_flood",
512 >    "throttle_count",
513      OUTPUT_DECIMAL,
514 <    &ConfigFileEntry.client_flood,
515 <    "Maximum amount of data in a client's queue before they are disconnected"
514 >    &ConfigGeneral.throttle_count,
515 >    "Number of connects in throttle_time before connections are blocked"
516    },
517    {
518      "throttle_time",
519      OUTPUT_DECIMAL,
520 <    &ConfigFileEntry.throttle_time,
520 >    &ConfigGeneral.throttle_time,
521      "Minimum time between client reconnects"
522    },
523    {
524 <    "glines",
525 <    OUTPUT_BOOLEAN,
526 <    &ConfigFileEntry.glines,
524 >    "gline_enable",
525 >    OUTPUT_BOOLEAN_YN,
526 >    &ConfigGeneral.glines,
527      "G-line (network-wide K-line) support"
528    },
529    {
530 <    "duration",
530 >    "gline_duration",
531      OUTPUT_DECIMAL,
532 <    &ConfigFileEntry.gline_time,
532 >    &ConfigGeneral.gline_time,
533      "Expiry time for G-lines"
534    },
535 +  {
536 +    "gline_request_duration",
537 +    OUTPUT_DECIMAL,
538 +    &ConfigGeneral.gline_request_time,
539 +    "Expiry time for pending G-lines"
540 +  },
541 +
542    /* --[  END OF TABLE  ]---------------------------------------------- */
543    {
544      NULL,
545      0,
546      NULL,
547 <    0
547 >    NULL
548    }
549   };
550  
497 – /*
498 – ** m_info()
499 – **  parv[0] = sender prefix
500 – **  parv[1] = servername
501 – */
502 – static void
503 – m_info(struct Client *client_p, struct Client *source_p,
504 –       int parc, char *parv[])
505 – {
506 –  static time_t last_used = 0;
507 –
508 –  if ((last_used + ConfigFileEntry.pace_wait) > CurrentTime)
509 –  {
510 –    /* safe enough to give this on a local connect only */
511 –    sendto_one(source_p, form_str(RPL_LOAD2HI),
512 –               me.name, source_p->name);
513 –    return;
514 –  }
515 –
516 –  last_used = CurrentTime;
517 –
518 –  if (!ConfigFileEntry.disable_remote)
519 –    if (hunt_server(client_p,source_p, ":%s INFO :%s", 1,
520 –                    parc, parv) != HUNTED_ISME)
521 –      return;
522 –
523 –  send_info_text(source_p);
524 – }
525 –
526 – /*
527 – ** mo_info()
528 – **  parv[0] = sender prefix
529 – **  parv[1] = servername
530 – */
531 – static void
532 – mo_info(struct Client *client_p, struct Client *source_p,
533 –        int parc, char *parv[])
534 – {
535 –  if (hunt_server(client_p, source_p, ":%s INFO :%s", 1,
536 –                  parc, parv) != HUNTED_ISME)
537 –    return;
538 –
539 –  send_info_text(source_p);
540 – }
541 –
542 – /*
543 – ** ms_info()
544 – **  parv[0] = sender prefix
545 – **  parv[1] = servername
546 – */
547 – static void
548 – ms_info(struct Client *client_p, struct Client *source_p,
549 –        int parc, char *parv[])
550 – {
551 –  if (!IsClient(source_p))
552 –      return;
553 –
554 –  if (hunt_server(client_p, source_p, ":%s INFO :%s", 1,
555 –                  parc, parv) != HUNTED_ISME)
556 –    return;
557 –
558 –  send_info_text(source_p);
559 – }
560 –
561 – /* send_info_text()
562 – *
563 – * inputs       - client pointer to send info text to
564 – * output       - NONE
565 – * side effects - info text is sent to client
566 – */
567 – static void
568 – send_info_text(struct Client *source_p)
569 – {
570 –  const char **text = infotext;
571 –  char *source, *target;
572 –
573 –  sendto_realops_flags(UMODE_SPY, L_ALL,
574 –                       "INFO requested by %s (%s@%s) [%s]",
575 –                       source_p->name, source_p->username,
576 –                       source_p->host, source_p->servptr->name);
577 –
578 –  if (!MyClient(source_p) && IsCapable(source_p->from, CAP_TS6) &&
579 –      HasID(source_p))
580 –    source = me.id, target = source_p->id;
581 –  else
582 –    source = me.name, target = source_p->name;
583 –
584 –  while (*text)
585 –  {
586 –    const char *line = *text++;
587 –
588 –    if (*line == '\0')
589 –      line = " ";
590 –
591 –    sendto_one(source_p, form_str(RPL_INFO),
592 –               source, target, line);
593 –  }
594 –
595 –  if (HasUMode(source_p, UMODE_OPER))
596 –    send_conf_options(source_p);
597 –
598 –  send_birthdate_online_time(source_p);
599 –
600 –  sendto_one(source_p, form_str(RPL_ENDOFINFO),
601 –             me.name, source_p->name);
602 – }
603 –
551   /* send_birthdate_online_time()
552   *
553   * inputs       - client pointer to send to
# Line 610 | Line 557 | send_info_text(struct Client *source_p)
557   static void
558   send_birthdate_online_time(struct Client *source_p)
559   {
560 <  if (!MyClient(source_p) && IsCapable(source_p->from, CAP_TS6) && HasID(source_p))
561 <  {
562 <    sendto_one(source_p, ":%s %d %s :On-line since %s",
616 <               me.id, RPL_INFO, source_p->id,
617 <               myctime(me.localClient->firsttime));
618 <  }
619 <  else
620 <  {
621 <    sendto_one(source_p, ":%s %d %s :On-line since %s",
622 <               me.name, RPL_INFO, source_p->name,
623 <               myctime(me.localClient->firsttime));
624 <  }
560 >  sendto_one_numeric(source_p, &me, RPL_INFO|SND_EXPLICIT,
561 >                     ":On-line since %s",
562 >                     myctime(me.connection->firsttime));
563   }
564  
565   /* send_conf_options()
# Line 633 | Line 571 | send_birthdate_online_time(struct Client
571   static void
572   send_conf_options(struct Client *source_p)
573   {
636 –  Info *infoptr;
637 –  const char *from, *to;
638 –  const struct InfoStruct *iptr = NULL;
639 –
640 –  /* Now send them a list of all our configuration options
641 –   * (mostly from defaults.h and config.h)
642 –   */
643 –  if (!MyClient(source_p) && IsCapable(source_p->from, CAP_TS6) && HasID(source_p))
644 –  {
645 –    from = me.id;
646 –    to = source_p->id;
647 –  }
648 –  else
649 –  {
650 –    from = me.name;
651 –    to = source_p->name;
652 –  }
653 –
654 –  for (infoptr = MyInformation; infoptr->name; infoptr++)
655 –  {
656 –    if (infoptr->intvalue)
657 –    {
658 –      sendto_one(source_p, ":%s %d %s :%-30s %-5d [%-30s]",
659 –                 from, RPL_INFO, to, infoptr->name,
660 –                 infoptr->intvalue, infoptr->desc);
661 –    }
662 –    else
663 –    {
664 –      sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]",
665 –                 from, RPL_INFO, to, infoptr->name,
666 –                 infoptr->strvalue, infoptr->desc);
667 –    }
668 –  }
669 –
574    /*
575     * Parse the info_table[] and do the magic.
576     */
577 <  for (iptr = info_table; iptr->name; ++iptr)
577 >  for (const struct InfoStruct *iptr = info_table; iptr->name; ++iptr)
578    {
579      switch (iptr->output_type)
580      {
581        /* For "char *" references */
582        case OUTPUT_STRING:
583        {
584 <        const char *option = *((char **)iptr->option);
584 >        const char *option = *((const char *const *)iptr->option);
585  
586 <        sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]",
587 <                   from, RPL_INFO, to,
588 <                   iptr->name, option ? option : "NONE",
589 <                   iptr->desc ? iptr->desc : "<none>");
586 >        sendto_one_numeric(source_p, &me, RPL_INFO|SND_EXPLICIT,
587 >                           ":%-30s %-5s [%s]",
588 >                           iptr->name, option ? option : "NONE",
589 >                           iptr->desc ? iptr->desc : "<none>");
590          break;
591        }
592  
# Line 691 | Line 595 | send_conf_options(struct Client *source_
595        {
596          const char *option = iptr->option;
597  
598 <        sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]",
599 <                   from, RPL_INFO, to,
600 <                   iptr->name, option ? option : "NONE",
601 <                   iptr->desc ? iptr->desc : "<none>");
598 >        sendto_one_numeric(source_p, &me, RPL_INFO|SND_EXPLICIT,
599 >                           ":%-30s %-5s [%s]",
600 >                           iptr->name, option ? option : "NONE",
601 >                           iptr->desc ? iptr->desc : "<none>");
602          break;
603        }
604  
605        /* Output info_table[i].option as a decimal value. */
606        case OUTPUT_DECIMAL:
607        {
608 <        const int option = *((int *)iptr->option);
608 >        const int option = *((const int *const)iptr->option);
609  
610 <        sendto_one(source_p, ":%s %d %s :%-30s %-5d [%-30s]",
611 <                   from, RPL_INFO, to, iptr->name,
612 <                   option, iptr->desc ? iptr->desc : "<none>");
610 >        sendto_one_numeric(source_p, &me, RPL_INFO|SND_EXPLICIT,
611 >                           ":%-30s %-5d [%s]",
612 >                           iptr->name, option, iptr->desc ? iptr->desc : "<none>");
613          break;
614        }
615  
616        /* Output info_table[i].option as "ON" or "OFF" */
617        case OUTPUT_BOOLEAN:
618        {
619 <        const int option = *((int *)iptr->option);
619 >        const int option = *((const int *const)iptr->option);
620  
621 <        sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]",
622 <                   from, RPL_INFO, to,
623 <                   iptr->name, option ? "ON" : "OFF",
624 <                   iptr->desc ? iptr->desc : "<none>");
621 >        sendto_one_numeric(source_p, &me, RPL_INFO|SND_EXPLICIT,
622 >                           ":%-30s %-5s [%s]",
623 >                           iptr->name, option ? "ON" : "OFF",
624 >                           iptr->desc ? iptr->desc : "<none>");
625  
626          break;
627        }
# Line 725 | Line 629 | send_conf_options(struct Client *source_
629        /* Output info_table[i].option as "YES" or "NO" */
630        case OUTPUT_BOOLEAN_YN:
631        {
632 <        int option = *((int *)iptr->option);
632 >        const int option = *((const int *const)iptr->option);
633  
634 <        sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]",
635 <                   from, RPL_INFO, to,
636 <                   iptr->name, option ? "YES" : "NO",
637 <                   iptr->desc ? iptr->desc : "<none>");
634 >        sendto_one_numeric(source_p, &me, RPL_INFO|SND_EXPLICIT,
635 >                           ":%-30s %-5s [%s]",
636 >                           iptr->name, option ? "YES" : "NO",
637 >                           iptr->desc ? iptr->desc : "<none>");
638          break;
639        }
640  
641        case OUTPUT_BOOLEAN2:
642        {
643 <        int option = *((int *)iptr->option);
643 >        const int option = *((const int *const)iptr->option);
644  
645 <        sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]",
646 <                   from, RPL_INFO, to,
647 <                   iptr->name, option ? ((option == 1) ? "MASK" : "YES") : "NO",
648 <                   iptr->desc ? iptr->desc : "<none>");
645 >        sendto_one_numeric(source_p, &me, RPL_INFO|SND_EXPLICIT,
646 >                           ":%-30s %-5s [%s]",
647 >                           iptr->name, option ? ((option == 1) ? "MASK" : "YES") : "NO",
648 >                           iptr->desc ? iptr->desc : "<none>");
649          break;
650        }
651      }
652    }
653  
654 <  /* Don't send oper_only_umodes...it's a bit mask, we will have to decode it
751 <   * in order for it to show up properly to opers who issue INFO
752 <   */
753 < #ifndef EFNET
754 <  /* jdc -- Only send compile information to admins. */
755 <  if (HasUMode(source_p, UMODE_ADMIN))
756 <    sendto_one(source_p, ":%s %d %s :Running on [%s]",
757 <               from, RPL_INFO, to, ircd_platform);
758 < #endif
759 <  sendto_one(source_p, form_str(RPL_INFO),
760 <             from, to, "");
654 >  sendto_one_numeric(source_p, &me, RPL_INFO, "");
655   }
656  
657 < static struct Message info_msgtab = {
658 <  "INFO", 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
659 <  { m_unregistered, m_info, ms_info, m_ignore, mo_info, m_ignore }
657 > /* send_info_text()
658 > *
659 > * inputs       - client pointer to send info text to
660 > * output       - NONE
661 > * side effects - info text is sent to client
662 > */
663 > static void
664 > send_info_text(struct Client *source_p)
665 > {
666 >  sendto_realops_flags(UMODE_SPY, L_ALL, SEND_NOTICE,
667 >                       "INFO requested by %s (%s@%s) [%s]",
668 >                       source_p->name, source_p->username,
669 >                       source_p->host, source_p->servptr->name);
670 >
671 >  for (const char **text = infotext; *text; ++text)
672 >  {
673 >    const char *line = *text;
674 >
675 >    if (*line == '\0')
676 >      line = " ";
677 >
678 >    sendto_one_numeric(source_p, &me, RPL_INFO, line);
679 >  }
680 >
681 >  if (HasUMode(source_p, UMODE_OPER))
682 >    send_conf_options(source_p);
683 >
684 >  send_birthdate_online_time(source_p);
685 >
686 >  sendto_one_numeric(source_p, &me, RPL_ENDOFINFO);
687 > }
688 >
689 > /*! \brief INFO command handler
690 > *
691 > * \param source_p Pointer to allocated Client struct from which the message
692 > *                 originally comes from.  This can be a local or remote client.
693 > * \param parc     Integer holding the number of supplied arguments.
694 > * \param parv     Argument vector where parv[0] .. parv[parc-1] are non-NULL
695 > *                 pointers.
696 > * \note Valid arguments for this command are:
697 > *      - parv[0] = command
698 > *      - parv[1] = nickname/servername
699 > */
700 > static int
701 > m_info(struct Client *source_p, int parc, char *parv[])
702 > {
703 >  static time_t last_used = 0;
704 >
705 >  if ((last_used + ConfigGeneral.pace_wait) > CurrentTime)
706 >  {
707 >    sendto_one_numeric(source_p, &me, RPL_LOAD2HI, "INFO");
708 >    return 0;
709 >  }
710 >
711 >  last_used = CurrentTime;
712 >
713 >  if (!ConfigServerHide.disable_remote_commands)
714 >    if (hunt_server(source_p, ":%s INFO :%s", 1, parc, parv) != HUNTED_ISME)
715 >      return 0;
716 >
717 >  send_info_text(source_p);
718 >  return 0;
719 > }
720 >
721 > /*! \brief INFO command handler
722 > *
723 > * \param source_p Pointer to allocated Client struct from which the message
724 > *                 originally comes from.  This can be a local or remote client.
725 > * \param parc     Integer holding the number of supplied arguments.
726 > * \param parv     Argument vector where parv[0] .. parv[parc-1] are non-NULL
727 > *                 pointers.
728 > * \note Valid arguments for this command are:
729 > *      - parv[0] = command
730 > *      - parv[1] = nickname/servername
731 > */
732 > static int
733 > ms_info(struct Client *source_p, int parc, char *parv[])
734 > {
735 >  if (hunt_server(source_p, ":%s INFO :%s", 1, parc, parv) != HUNTED_ISME)
736 >    return 0;
737 >
738 >  send_info_text(source_p);
739 >  return 0;
740 > }
741 >
742 > static struct Message info_msgtab =
743 > {
744 >  "INFO", NULL, 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
745 >  { m_unregistered, m_info, ms_info, m_ignore, ms_info, m_ignore }
746   };
747  
748   static void
# Line 777 | Line 757 | module_exit(void)
757    mod_del_cmd(&info_msgtab);
758   }
759  
760 < struct module module_entry = {
760 > struct module module_entry =
761 > {
762    .node    = { NULL, NULL, NULL },
763    .name    = NULL,
764    .version = "$Revision$",

Diff Legend

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