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/modules/m_info.c (file contents), Revision 32 by knight, Sun Oct 2 20:41:23 2005 UTC vs.
ircd-hybrid/trunk/modules/m_info.c (file contents), Revision 4588 by michael, Tue Aug 26 15:59:07 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 "tools.h"
27 < #include "m_info.h"
28 < #include "channel.h"
28 > #include "list.h"
29   #include "client.h"
30 #include "common.h"
31 #include "irc_string.h"
30   #include "ircd.h"
33 #include "hook.h"
31   #include "numeric.h"
32 < #include "s_log.h"
33 < #include "s_serv.h"
37 < #include "s_user.h"
32 > #include "misc.h"
33 > #include "server.h"
34   #include "send.h"
35 < #include "s_conf.h"
40 < #include "handlers.h"
41 < #include "msg.h"
35 > #include "conf.h"
36   #include "parse.h"
37   #include "modules.h"
38  
45 static void send_conf_options(struct Client *);
46 static void send_birthdate_online_time(struct Client *);
47 static void send_info_text(struct Client *);
48
49 static void m_info(struct Client *, struct Client *, int, char *[]);
50 static void ms_info(struct Client *, struct Client *, int, char *[]);
51 static void mo_info(struct Client *, struct Client *, int, char *[]);
52
53 struct Message info_msgtab = {
54  "INFO", 0, 0, 0, 0, MFLG_SLOW, 0,
55  { m_unregistered, m_info, ms_info, m_ignore, mo_info, m_ignore }
56 };
57
58 #ifndef STATIC_MODULES
59 const char *_version = "$Revision$";
60 static struct Callback *info_cb;
61
62 static void *
63 va_send_info_text(va_list args)
64 {
65  send_info_text(va_arg(args, struct Client *));
66  return NULL;
67 }
68
69 void
70 _modinit(void)
71 {
72  info_cb = register_callback("doing_info", va_send_info_text);
73  mod_add_cmd(&info_msgtab);
74 }
39  
40 < void
41 < _moddeinit(void)
40 > /* Types for output_type in InfoStruct */
41 > enum
42   {
43 <  mod_del_cmd(&info_msgtab);
44 <  uninstall_hook(info_cb, va_send_info_text);
45 < }
46 < #endif
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  
95 /* Types for output_type in InfoStruct */
96 #define OUTPUT_STRING     0x0001 /* Output option as %s w/ dereference  */
97 #define OUTPUT_STRING_PTR 0x0002 /* Output option as %s w/out deference */
98 #define OUTPUT_DECIMAL    0x0004 /* Output option as decimal (%d)       */
99 #define OUTPUT_BOOLEAN    0x0008 /* Output option as "ON" or "OFF"      */
100 #define OUTPUT_BOOLEAN_YN 0x0010 /* Output option as "YES" or "NO"      */
101 #define OUTPUT_BOOLEAN2   0x0020 /* Output option as "YES/NO/MASKED"    */
102
62   static const struct InfoStruct info_table[] =
63   {
64    /* --[  START OF TABLE  ]-------------------------------------------- */
65 +
66    {
67 <    "network_name",
67 >    "DPATH",
68      OUTPUT_STRING,
69 <    &ServerInfo.network_name,
70 <    "Network name"
69 >    &ConfigGeneral.dpath,
70 >    "Root directory of installation"
71    },
72    {
73 <    "network_desc",
73 >    "SPATH",
74      OUTPUT_STRING,
75 <    &ServerInfo.network_desc,
76 <    "Network description"
75 >    &ConfigGeneral.spath,
76 >    "Path to server executable"
77    },
78    {
79 <    "hub",
80 <    OUTPUT_BOOLEAN_YN,
81 <    &ServerInfo.hub,
82 <    "Server is a hub"
79 >    "MPATH",
80 >    OUTPUT_STRING,
81 >    &ConfigGeneral.mpath,
82 >    "Path to main motd (Message of the Day) file"
83    },
84    {
85 <    "use_logging",
86 <    OUTPUT_BOOLEAN_YN,
87 <    &ConfigLoggingEntry.use_logging,
88 <    "Enable logging"
85 >    "CPATH",
86 >    OUTPUT_STRING,
87 >    &ConfigGeneral.configfile,
88 >    "Path to main configuration file"
89    },
90    {
91 <    "fuserlog",
92 <    OUTPUT_STRING_PTR,
93 <    &ConfigLoggingEntry.userlog,
94 <    "User log file"
91 >    "DLPATH",
92 >    OUTPUT_STRING,
93 >    &ConfigGeneral.dlinefile,
94 >    "Path to D-line database file"
95    },
96    {
97 <    "foperlog",
98 <    OUTPUT_STRING_PTR,
99 <    &ConfigLoggingEntry.operlog,
100 <    "Operator log file"
97 >    "KPATH",
98 >    OUTPUT_STRING,
99 >    &ConfigGeneral.klinefile,
100 >    "Path to K-line database file"
101    },
102    {
103 <    "fkilllog",
104 <    OUTPUT_STRING_PTR,
105 <    &ConfigLoggingEntry.killlog,
106 <    "Kill log file"
103 >    "GPATH",
104 >    OUTPUT_STRING,
105 >    &ConfigGeneral.glinefile,
106 >    "Path to G-line database file"
107    },
108    {
109 <    "fklinelog",
110 <    OUTPUT_STRING_PTR,
111 <    &ConfigLoggingEntry.klinelog,
112 <    "K-Line log file"
109 >    "XPATH",
110 >    OUTPUT_STRING,
111 >    &ConfigGeneral.xlinefile,
112 >    "Path to X-line database file"
113    },
114    {
115 <    "fglinelog",
116 <    OUTPUT_STRING_PTR,
117 <    &ConfigLoggingEntry.glinelog,
118 <    "G-Line log file"
115 >    "RESVPATH",
116 >    OUTPUT_STRING,
117 >    &ConfigGeneral.resvfile,
118 >    "Path to resv database file"
119    },
120    {
121 <    "restrict_channels",
122 <    OUTPUT_BOOLEAN_YN,
123 <    &ConfigChannel.restrict_channels,
124 <    "Only reserved channels are allowed"
121 >    "network_name",
122 >    OUTPUT_STRING,
123 >    &ConfigServerInfo.network_name,
124 >    "Network name"
125    },
126    {
127 <    "disable_local_channels",
128 <    OUTPUT_BOOLEAN_YN,
129 <    &ConfigChannel.disable_local_channels,
130 <    "Prevent users from joining &channels"
127 >    "network_desc",
128 >    OUTPUT_STRING,
129 >    &ConfigServerInfo.network_desc,
130 >    "Network description"
131    },
132 < {
133 <    "use_invex",
132 >  {
133 >    "hub",
134      OUTPUT_BOOLEAN_YN,
135 <    &ConfigChannel.use_invex,
136 <    "Enable chanmode +I (invite exceptions)"
135 >    &ConfigServerInfo.hub,
136 >    "Server is a hub"
137    },
138    {
139 <    "use_except",
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 <    &ConfigChannel.use_except,
160 <    "Enable chanmode +e (ban exceptions)"
159 >    &ConfigLog.use_logging,
160 >    "Enable logging"
161    },
162    {
163 <    "use_knock",
163 >    "disable_fake_channels",
164      OUTPUT_BOOLEAN_YN,
165 <    &ConfigChannel.use_knock,
166 <    "Enable /KNOCK"
165 >    &ConfigChannel.disable_fake_channels,
166 >    "Forbids channels with special ASCII characters in their name"
167    },
168    {
169 <    "knock_delay",
169 >    "invite_client_count",
170      OUTPUT_DECIMAL,
171 <    &ConfigChannel.knock_delay,
172 <    "Delay between a users KNOCK attempts"
171 >    &ConfigChannel.invite_client_count,
172 >    "How many INVITE attempts are permitted in invite_client_time"
173    },
174 +
175    {
176 <    "knock_delay_channel",
176 >    "invite_client_time",
177      OUTPUT_DECIMAL,
178 <    &ConfigChannel.knock_delay_channel,
179 <    "Delay between KNOCK attempts to a channel"
178 >    &ConfigChannel.invite_client_time,
179 >    "How many invite_client_count invites are allowed in this time"
180    },
181    {
182 <    "invite_ops_only",
183 <    OUTPUT_BOOLEAN_YN,
184 <    &ConfigChannel.invite_ops_only,
185 <    "Restrict invite to ops only"
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 <    "max_chans_per_user",
188 >    "knock_client_time",
189      OUTPUT_DECIMAL,
190 <    &ConfigChannel.max_chans_per_user,
191 <    "Maximum number of channels a user can join"
190 >    &ConfigChannel.knock_client_time,
191 >    "How many knock_client_count knocks are allowed in this time"
192    },
193    {
194 <    "quiet_on_ban",
195 <    OUTPUT_BOOLEAN_YN,
196 <    &ConfigChannel.quiet_on_ban,
197 <    "Banned users may not send text to a channel"
194 >    "knock_delay_channel",
195 >    OUTPUT_DECIMAL,
196 >    &ConfigChannel.knock_delay_channel,
197 >    "Delay between KNOCK attempts to a channel"
198 >  },
199 >  {
200 >    "max_channels",
201 >    OUTPUT_DECIMAL,
202 >    &ConfigChannel.max_channels,
203 >    "Maximum number of channels a user can join"
204    },
205    {
206      "max_bans",
# Line 248 | Line 233 | static const struct InfoStruct info_tabl
233      "Disallow joining channels when split"
234    },
235    {
251    "burst_topicwho",
252    OUTPUT_BOOLEAN_YN,
253    &ConfigChannel.burst_topicwho,
254    "Enable sending of who set topic on topicburst"
255  },
256  {
236      "flatten_links",
237      OUTPUT_BOOLEAN_YN,
238      &ConfigServerHide.flatten_links,
# Line 272 | Line 251 | static const struct InfoStruct info_tabl
251      "Hide this server from a flattened /links on remote servers"
252    },
253    {
275    "disable_hidden",
276    OUTPUT_BOOLEAN_YN,
277    &ConfigServerHide.disable_hidden,
278    "Prevent servers from hiding themselves from a flattened /links"
279  },
280  {
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 293 | 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    {
317    "burst_away",
318    OUTPUT_BOOLEAN_YN,
319    &ConfigFileEntry.burst_away,
320    "Send /away string that users have set on the server burst"
321  },
322  {
323    "use_whois_actually",
324    OUTPUT_BOOLEAN_YN,
325    &ConfigFileEntry.use_whois_actually,
326    "Show IP address on /WHOIS when possible"
327  },
328  {
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",
315      OUTPUT_BOOLEAN_YN,
316 <    &ConfigFileEntry.hide_spoof_ips,
317 <    "Hide spoofed IP's"
316 >    &ConfigGeneral.hide_spoof_ips,
317 >    "Hide spoofed IP addresses"
318    },
319    {
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 +    &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    {
338      "disable_remote_commands",
339      OUTPUT_BOOLEAN_YN,
340 <    &ConfigFileEntry.disable_remote,
340 >    &ConfigServerHide.disable_remote_commands,
341      "Prevent users issuing commands on remote servers"
342    },
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,
359 <    "Inform opers if someone /oper's with the wrong password"
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    {
383    "dot_in_ip6_addr",
384    OUTPUT_BOOLEAN,
385    &ConfigFileEntry.dot_in_ip6_addr,
386    "Suffix a . to ip6 addresses (for linked servers still running hybrid-6)"
387  },
388  {
368      "min_nonwildcard",
369      OUTPUT_DECIMAL,
370 <    &ConfigFileEntry.min_nonwildcard,
370 >    &ConfigGeneral.min_nonwildcard,
371      "Minimum non-wildcard chars in K/G 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_accept",
381      OUTPUT_DECIMAL,
382 <    &ConfigFileEntry.max_accept,
382 >    &ConfigGeneral.max_accept,
383      "Maximum nicknames on accept list"
384    },
385    {
386      "anti_nick_flood",
387 <    OUTPUT_BOOLEAN,
388 <    &ConfigFileEntry.anti_nick_flood,
387 >    OUTPUT_BOOLEAN_YN,
388 >    &ConfigGeneral.anti_nick_flood,
389      "NICK flood protection"
390    },
391    {
392      "max_nick_time",
393      OUTPUT_DECIMAL,
394 <    &ConfigFileEntry.max_nick_time,
394 >    &ConfigGeneral.max_nick_time,
395      "NICK flood protection time interval"
396    },
397    {
398      "max_nick_changes",
399      OUTPUT_DECIMAL,
400 <    &ConfigFileEntry.max_nick_changes,
400 >    &ConfigGeneral.max_nick_changes,
401      "NICK change threshhold setting"
402    },
403    {
404      "anti_spam_exit_message_time",
405      OUTPUT_DECIMAL,
406 <    &ConfigFileEntry.anti_spam_exit_message_time,
406 >    &ConfigGeneral.anti_spam_exit_message_time,
407      "Duration a client must be connected for to have an exit message"
408    },
409    {
410      "ts_warn_delta",
411      OUTPUT_DECIMAL,
412 <    &ConfigFileEntry.ts_warn_delta,
412 >    &ConfigGeneral.ts_warn_delta,
413      "Maximum permitted TS delta before displaying a warning"
414    },
415    {
416      "ts_max_delta",
417      OUTPUT_DECIMAL,
418 <    &ConfigFileEntry.ts_max_delta,
418 >    &ConfigGeneral.ts_max_delta,
419      "Maximum permitted TS delta from another server"
420    },
421    {
422 <    "kline_with_reason",
422 >    "warn_no_connect_block",
423      OUTPUT_BOOLEAN_YN,
424 <    &ConfigFileEntry.kline_with_reason,
425 <    "Display K-line reason to client on disconnect"
424 >    &ConfigGeneral.warn_no_connect_block,
425 >    "Display warning if connecting server lacks a connect{} block"
426    },
427    {
428 <    "kline_reason",
429 <    OUTPUT_STRING,
430 <    &ConfigFileEntry.kline_reason,
431 <    "Reason given to K-lined clients on sign off"
453 <  },
454 <  {
455 <    "warn_no_nline",
456 <    OUTPUT_BOOLEAN,
457 <    &ConfigFileEntry.warn_no_nline,
458 <    "Display warning if connecting server lacks N-line"
428 >    "stats_e_disabled",
429 >    OUTPUT_BOOLEAN_YN,
430 >    &ConfigGeneral.stats_e_disabled,
431 >    "Whether or not STATS e is disabled"
432    },
433    {
434      "stats_o_oper_only",
435      OUTPUT_BOOLEAN_YN,
436 <    &ConfigFileEntry.stats_o_oper_only,
436 >    &ConfigGeneral.stats_o_oper_only,
437      "STATS O output is only shown to operators"
438    },
439    {
440      "stats_P_oper_only",
441      OUTPUT_BOOLEAN_YN,
442 <    &ConfigFileEntry.stats_P_oper_only,
442 >    &ConfigGeneral.stats_P_oper_only,
443      "STATS P is only shown to operators"
444    },
445    {
446 +    "stats_u_oper_only",
447 +    OUTPUT_BOOLEAN_YN,
448 +    &ConfigGeneral.stats_u_oper_only,
449 +    "STATS u is only shown to operators"
450 +  },
451 +  {
452      "stats_i_oper_only",
453      OUTPUT_BOOLEAN2,
454 <    &ConfigFileEntry.stats_i_oper_only,
454 >    &ConfigGeneral.stats_i_oper_only,
455      "STATS I output is only shown to operators"
456    },
457    {
458      "stats_k_oper_only",
459      OUTPUT_BOOLEAN2,
460 <    &ConfigFileEntry.stats_k_oper_only,
460 >    &ConfigGeneral.stats_k_oper_only,
461      "STATS K output is only shown to operators"
462    },
463    {
464      "caller_id_wait",
465      OUTPUT_DECIMAL,
466 <    &ConfigFileEntry.caller_id_wait,
466 >    &ConfigGeneral.caller_id_wait,
467      "Minimum delay between notifying UMODE +g users of messages"
468    },
469    {
470      "opers_bypass_callerid",
471      OUTPUT_BOOLEAN_YN,
472 <    &ConfigFileEntry.opers_bypass_callerid,
472 >    &ConfigGeneral.opers_bypass_callerid,
473      "Allows IRC operators to message users who are +g (callerid)"
474    },
475    {
476      "pace_wait_simple",
477      OUTPUT_DECIMAL,
478 <    &ConfigFileEntry.pace_wait_simple,
478 >    &ConfigGeneral.pace_wait_simple,
479      "Minimum delay between less intensive commands"
480    },
481    {
482      "pace_wait",
483      OUTPUT_DECIMAL,
484 <    &ConfigFileEntry.pace_wait,
484 >    &ConfigGeneral.pace_wait,
485      "Minimum delay between uses of certain commands"
486    },
487    {
488      "short_motd",
489      OUTPUT_BOOLEAN_YN,
490 <    &ConfigFileEntry.short_motd,
490 >    &ConfigGeneral.short_motd,
491      "Do not show MOTD; only tell clients they should read it"
492    },
493    {
494      "ping_cookie",
495 <    OUTPUT_BOOLEAN,
496 <    &ConfigFileEntry.ping_cookie,
495 >    OUTPUT_BOOLEAN_YN,
496 >    &ConfigGeneral.ping_cookie,
497      "Require ping cookies to connect"
498    },
499    {
500      "no_oper_flood",
501 <    OUTPUT_BOOLEAN,
502 <    &ConfigFileEntry.no_oper_flood,
501 >    OUTPUT_BOOLEAN_YN,
502 >    &ConfigGeneral.no_oper_flood,
503      "Reduce flood control for operators"
504    },
505    {
506      "true_no_oper_flood",
507 <    OUTPUT_BOOLEAN,
508 <    &ConfigFileEntry.true_no_oper_flood,
507 >    OUTPUT_BOOLEAN_YN,
508 >    &ConfigGeneral.true_no_oper_flood,
509      "Completely disable flood control for operators"
510    },
511    {
512      "oper_pass_resv",
513      OUTPUT_BOOLEAN_YN,
514 <    &ConfigFileEntry.oper_pass_resv,
514 >    &ConfigGeneral.oper_pass_resv,
515      "Opers can over-ride RESVs"
516    },
517    {
539    "idletime",
540    OUTPUT_DECIMAL,
541    &ConfigFileEntry.idletime,
542    "Number of seconds before a client is considered idle"
543  },
544  {
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 <    "client_flood",
524 >    "throttle_count",
525      OUTPUT_DECIMAL,
526 <    &ConfigFileEntry.client_flood,
527 <    "Maximum amount of data in a client's queue before they are disconnected"
526 >    &ConfigGeneral.throttle_count,
527 >    "Number of connects in throttle_time before connections are blocked"
528    },
529    {
530      "throttle_time",
531      OUTPUT_DECIMAL,
532 <    &ConfigFileEntry.throttle_time,
532 >    &ConfigGeneral.throttle_time,
533      "Minimum time between client reconnects"
534    },
535    {
536 <    "glines",
537 <    OUTPUT_BOOLEAN,
538 <    &ConfigFileEntry.glines,
536 >    "gline_enable",
537 >    OUTPUT_BOOLEAN_YN,
538 >    &ConfigGeneral.glines,
539      "G-line (network-wide K-line) support"
540    },
541    {
542 <    "duration",
542 >    "gline_duration",
543      OUTPUT_DECIMAL,
544 <    &ConfigFileEntry.gline_time,
544 >    &ConfigGeneral.gline_time,
545      "Expiry time for G-lines"
546    },
547 +  {
548 +    "gline_request_duration",
549 +    OUTPUT_DECIMAL,
550 +    &ConfigGeneral.gline_request_time,
551 +    "Expiry time for pending G-lines"
552 +  },
553 +
554    /* --[  END OF TABLE  ]---------------------------------------------- */
555    {
556      NULL,
# Line 580 | Line 560 | static const struct InfoStruct info_tabl
560    }
561   };
562  
583 /*
584 ** m_info()
585 **  parv[0] = sender prefix
586 **  parv[1] = servername
587 */
588 static void
589 m_info(struct Client *client_p, struct Client *source_p,
590       int parc, char *parv[])
591 {
592  static time_t last_used = 0;
593
594  if ((last_used + ConfigFileEntry.pace_wait) > CurrentTime)
595  {
596    /* safe enough to give this on a local connect only */
597    sendto_one(source_p, form_str(RPL_LOAD2HI),
598               me.name, source_p->name);
599    return;
600  }
601  else
602    last_used = CurrentTime;
603
604  if (!ConfigFileEntry.disable_remote)
605  {
606    if (hunt_server(client_p,source_p, ":%s INFO :%s",
607                    1, parc, parv) != HUNTED_ISME)
608    {
609      return;
610    }
611  }
612
613 #ifdef STATIC_MODULES
614  send_info_text(source_p);
615 #else
616  execute_callback(info_cb, source_p, parc, parv);
617 #endif
618 }
619
620 /*
621 ** mo_info()
622 **  parv[0] = sender prefix
623 **  parv[1] = servername
624 */
625 static void
626 mo_info(struct Client *client_p, struct Client *source_p,
627        int parc, char *parv[])
628 {
629  if (hunt_server(client_p, source_p, ":%s INFO :%s", 1,
630                  parc, parv) != HUNTED_ISME)
631    return;
632
633 #ifdef STATIC_MODULES
634  send_info_text(source_p);
635 #else
636  execute_callback(info_cb, source_p, parc, parv);
637 #endif
638 }
639
640 /*
641 ** ms_info()
642 **  parv[0] = sender prefix
643 **  parv[1] = servername
644 */
645 static void
646 ms_info(struct Client *client_p, struct Client *source_p,
647        int parc, char *parv[])
648 {
649  if (!IsClient(source_p))
650      return;
651
652  if (hunt_server(client_p, source_p, ":%s INFO :%s",
653                  1, parc, parv) != HUNTED_ISME)
654    return;
655
656 #ifdef STATIC_MODULES
657  send_info_text(source_p);
658 #else
659  execute_callback(info_cb, source_p, parc, parv);
660 #endif
661 }
662
663 /* send_info_text()
664 *
665 * inputs       - client pointer to send info text to
666 * output       - NONE
667 * side effects - info text is sent to client
668 */
669 static void
670 send_info_text(struct Client *source_p)
671 {
672  const char **text = infotext;
673  char *source, *target;
674  
675  if (!MyClient(source_p) && IsCapable(source_p->from, CAP_TS6) &&
676      HasID(source_p))
677    source = me.id, target = source_p->id;
678  else
679    source = me.name, target = source_p->name;
680
681  while (*text)
682  {
683    const char *line = *text++;
684
685    if (*line == '\0')
686      line = " ";
687
688    sendto_one(source_p, form_str(RPL_INFO),
689               source, target, line);
690  }
691
692  if (IsOper(source_p))
693    send_conf_options(source_p);
694
695  send_birthdate_online_time(source_p);
696
697  sendto_one(source_p, form_str(RPL_ENDOFINFO),
698             me.name, source_p->name);
699 }
700
563   /* send_birthdate_online_time()
564   *
565   * inputs       - client pointer to send to
# Line 707 | Line 569 | send_info_text(struct Client *source_p)
569   static void
570   send_birthdate_online_time(struct Client *source_p)
571   {
572 <  if (!MyClient(source_p) && IsCapable(source_p->from, CAP_TS6) && HasID(source_p))
573 <  {
574 <    sendto_one(source_p, ":%s %d %s :On-line since %s",
713 <               me.id, RPL_INFO, source_p->id,
714 <               myctime(me.firsttime));
715 <  }
716 <  else
717 <  {
718 <    sendto_one(source_p, ":%s %d %s :On-line since %s",
719 <               me.name, RPL_INFO, source_p->name,
720 <               myctime(me.firsttime));
721 <  }
572 >  sendto_one_numeric(source_p, &me, RPL_INFO|SND_EXPLICIT,
573 >                     ":On-line since %s",
574 >                     myctime(me.connection->firsttime));
575   }
576  
577   /* send_conf_options()
# Line 730 | Line 583 | send_birthdate_online_time(struct Client
583   static void
584   send_conf_options(struct Client *source_p)
585   {
733  Info *infoptr;
734  const char *from, *to;
735  const struct InfoStruct *iptr = NULL;
736
737  /* Now send them a list of all our configuration options
738   * (mostly from defaults.h and setup.h)
739   */
740  if (!MyClient(source_p) && IsCapable(source_p->from, CAP_TS6) && HasID(source_p))
741  {
742    from = me.id;
743    to = source_p->id;
744  }
745  else
746  {
747    from = me.name;
748    to = source_p->name;
749  }
750
751  for (infoptr = MyInformation; infoptr->name; infoptr++)
752  {
753    if (infoptr->intvalue)
754    {
755      sendto_one(source_p, ":%s %d %s :%-30s %-5d [%-30s]",
756                 from, RPL_INFO, to, infoptr->name,
757                 infoptr->intvalue, infoptr->desc);
758    }
759    else
760    {
761      sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]",
762                 from, RPL_INFO, to, infoptr->name,
763                 infoptr->strvalue, infoptr->desc);
764    }
765  }
766
586    /*
587     * Parse the info_table[] and do the magic.
588     */
589 <  for (iptr = info_table; iptr->name; ++iptr)
589 >  for (const struct InfoStruct *iptr = info_table; iptr->name; ++iptr)
590    {
591      switch (iptr->output_type)
592      {
593        /* For "char *" references */
594        case OUTPUT_STRING:
595        {
596 <        const char *option = *((char **)iptr->option);
596 >        const char *option = *((const char *const *)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  
# Line 788 | Line 607 | send_conf_options(struct Client *source_
607        {
608          const char *option = iptr->option;
609  
610 <        sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]",
611 <                   from, RPL_INFO, to,
612 <                   iptr->name, option ? option : "NONE",
613 <                   iptr->desc ? iptr->desc : "<none>");
610 >        sendto_one_numeric(source_p, &me, RPL_INFO|SND_EXPLICIT,
611 >                           ":%-30s %-5s [%s]",
612 >                           iptr->name, option ? option : "NONE",
613 >                           iptr->desc ? iptr->desc : "<none>");
614          break;
615        }
616  
617        /* Output info_table[i].option as a decimal value. */
618        case OUTPUT_DECIMAL:
619        {
620 <        const int option = *((int *)iptr->option);
620 >        const int option = *((const int *const)iptr->option);
621  
622 <        sendto_one(source_p, ":%s %d %s :%-30s %-5d [%-30s]",
623 <                   from, RPL_INFO, to, iptr->name,
624 <                   option, iptr->desc ? iptr->desc : "<none>");
622 >        sendto_one_numeric(source_p, &me, RPL_INFO|SND_EXPLICIT,
623 >                           ":%-30s %-5d [%s]",
624 >                           iptr->name, option, iptr->desc ? iptr->desc : "<none>");
625          break;
626        }
627  
628        /* Output info_table[i].option as "ON" or "OFF" */
629        case OUTPUT_BOOLEAN:
630        {
631 <        const int option = *((int *)iptr->option);
631 >        const int option = *((const int *const)iptr->option);
632  
633 <        sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]",
634 <                   from, RPL_INFO, to,
635 <                   iptr->name, option ? "ON" : "OFF",
636 <                   iptr->desc ? iptr->desc : "<none>");
633 >        sendto_one_numeric(source_p, &me, RPL_INFO|SND_EXPLICIT,
634 >                           ":%-30s %-5s [%s]",
635 >                           iptr->name, option ? "ON" : "OFF",
636 >                           iptr->desc ? iptr->desc : "<none>");
637  
638          break;
639        }
# Line 822 | Line 641 | send_conf_options(struct Client *source_
641        /* Output info_table[i].option as "YES" or "NO" */
642        case OUTPUT_BOOLEAN_YN:
643        {
644 <        int option = *((int *)iptr->option);
644 >        const int option = *((const int *const)iptr->option);
645  
646 <        sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]",
647 <                   from, RPL_INFO, to,
648 <                   iptr->name, option ? "YES" : "NO",
649 <                   iptr->desc ? iptr->desc : "<none>");
646 >        sendto_one_numeric(source_p, &me, RPL_INFO|SND_EXPLICIT,
647 >                           ":%-30s %-5s [%s]",
648 >                           iptr->name, option ? "YES" : "NO",
649 >                           iptr->desc ? iptr->desc : "<none>");
650          break;
651        }
652  
653        case OUTPUT_BOOLEAN2:
654        {
655 <        int option = *((int *)iptr->option);
655 >        const int option = *((const int *const)iptr->option);
656  
657 <        sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]",
658 <                   from, RPL_INFO, to,
659 <                   iptr->name, option ? ((option == 1) ? "MASK" : "YES") : "NO",
660 <                   iptr->desc ? iptr->desc : "<none>");
657 >        sendto_one_numeric(source_p, &me, RPL_INFO|SND_EXPLICIT,
658 >                           ":%-30s %-5s [%s]",
659 >                           iptr->name, option ? ((option == 1) ? "MASK" : "YES") : "NO",
660 >                           iptr->desc ? iptr->desc : "<none>");
661          break;
662        }
663      }
664    }
665  
666 <  /* Don't send oper_only_umodes...it's a bit mask, we will have to decode it
667 <   * in order for it to show up properly to opers who issue INFO
668 <   */
669 < #ifndef EFNET
670 <  /* jdc -- Only send compile information to admins. */
671 <  if (IsAdmin(source_p))
672 <    sendto_one(source_p, ":%s %d %s :Running on [%s]",
673 <               from, RPL_INFO, to, ircd_platform);
674 < #endif
675 <  sendto_one(source_p, form_str(RPL_INFO),
676 <             from, to, "");
666 >  sendto_one_numeric(source_p, &me, RPL_INFO, "");
667 > }
668 >
669 > /* 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 > static void
676 > 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 >  for (const char **text = infotext; *text; ++text)
684 >  {
685 >    const char *line = *text;
686 >
687 >    if (*line == '\0')
688 >      line = " ";
689 >
690 >    sendto_one_numeric(source_p, &me, RPL_INFO, line);
691 >  }
692 >
693 >  if (HasUMode(source_p, UMODE_OPER))
694 >    send_conf_options(source_p);
695 >
696 >  send_birthdate_online_time(source_p);
697 >
698 >  sendto_one_numeric(source_p, &me, RPL_ENDOFINFO);
699 > }
700 >
701 > /*! \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 > *      - parv[1] = nickname/servername
711 > */
712 > static int
713 > m_info(struct Client *source_p, int parc, char *parv[])
714 > {
715 >  static time_t last_used = 0;
716 >
717 >  if ((last_used + ConfigGeneral.pace_wait) > CurrentTime)
718 >  {
719 >    sendto_one_numeric(source_p, &me, RPL_LOAD2HI);
720 >    return 0;
721 >  }
722 >
723 >  last_used = CurrentTime;
724 >
725 >  if (!ConfigServerHide.disable_remote_commands)
726 >    if (hunt_server(source_p, ":%s INFO :%s", 1,
727 >                    parc, parv) != HUNTED_ISME)
728 >      return 0;
729 >
730 >  send_info_text(source_p);
731 >  return 0;
732 > }
733 >
734 > /*! \brief INFO command handler
735 > *
736 > * \param source_p Pointer to allocated Client struct from which the message
737 > *                 originally comes from.  This can be a local or remote client.
738 > * \param parc     Integer holding the number of supplied arguments.
739 > * \param parv     Argument vector where parv[0] .. parv[parc-1] are non-NULL
740 > *                 pointers.
741 > * \note Valid arguments for this command are:
742 > *      - parv[0] = command
743 > *      - parv[1] = nickname/servername
744 > */
745 > static int
746 > ms_info(struct Client *source_p, int parc, char *parv[])
747 > {
748 >  if (hunt_server(source_p, ":%s INFO :%s", 1,
749 >                  parc, parv) != HUNTED_ISME)
750 >    return 0;
751 >
752 >  send_info_text(source_p);
753 >  return 0;
754   }
755 +
756 + static struct Message info_msgtab =
757 + {
758 +  "INFO", NULL, 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
759 +  { m_unregistered, m_info, ms_info, m_ignore, ms_info, m_ignore }
760 + };
761 +
762 + static void
763 + module_init(void)
764 + {
765 +  mod_add_cmd(&info_msgtab);
766 + }
767 +
768 + static void
769 + module_exit(void)
770 + {
771 +  mod_del_cmd(&info_msgtab);
772 + }
773 +
774 + struct module module_entry =
775 + {
776 +  .node    = { NULL, NULL, NULL },
777 +  .name    = NULL,
778 +  .version = "$Revision$",
779 +  .handle  = NULL,
780 +  .modinit = module_init,
781 +  .modexit = module_exit,
782 +  .flags   = 0
783 + };

Comparing:
ircd-hybrid/modules/m_info.c (property svn:keywords), Revision 32 by knight, Sun Oct 2 20:41:23 2005 UTC vs.
ircd-hybrid/trunk/modules/m_info.c (property svn:keywords), Revision 4588 by michael, Tue Aug 26 15:59:07 2014 UTC

# Line 1 | Line 1
1 < Revision
1 > Id Revision

Diff Legend

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