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 |
17 |
|
* along with this program; if not, write to the Free Software |
18 |
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
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 |
> |
&ConfigFileEntry.dpath, |
70 |
> |
"Root directory of installation" |
71 |
|
}, |
72 |
|
{ |
73 |
< |
"network_desc", |
73 |
> |
"SPATH", |
74 |
|
OUTPUT_STRING, |
75 |
< |
&ServerInfo.network_desc, |
76 |
< |
"Network description" |
75 |
> |
&ConfigFileEntry.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 |
> |
&ConfigFileEntry.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 |
> |
&ConfigFileEntry.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 |
> |
&ConfigFileEntry.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 |
> |
&ConfigFileEntry.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 |
> |
&ConfigFileEntry.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 |
> |
&ConfigFileEntry.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 |
> |
&ConfigFileEntry.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 |
> |
&ServerInfo.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 |
> |
&ServerInfo.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 |
> |
&ServerInfo.hub, |
136 |
> |
"Server is a hub" |
137 |
> |
}, |
138 |
> |
{ |
139 |
> |
"max_clients", |
140 |
> |
OUTPUT_DECIMAL, |
141 |
> |
&ServerInfo.max_clients, |
142 |
> |
"Maximum number of clients permitted simultaneously on this server" |
143 |
> |
}, |
144 |
> |
{ |
145 |
> |
"max_nick_length", |
146 |
> |
OUTPUT_DECIMAL, |
147 |
> |
&ServerInfo.max_nick_length, |
148 |
> |
"Maximum nickname length" |
149 |
> |
}, |
150 |
> |
{ |
151 |
> |
"max_topic_length", |
152 |
> |
OUTPUT_DECIMAL, |
153 |
> |
&ServerInfo.max_topic_length, |
154 |
> |
"Maximum topic length" |
155 |
|
}, |
156 |
|
{ |
157 |
< |
"use_except", |
157 |
> |
"use_logging", |
158 |
|
OUTPUT_BOOLEAN_YN, |
159 |
< |
&ConfigChannel.use_except, |
160 |
< |
"Enable chanmode +e (ban exceptions)" |
159 |
> |
&ConfigLoggingEntry.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", |
178 |
|
"Delay between KNOCK attempts to a channel" |
179 |
|
}, |
180 |
|
{ |
203 |
– |
"invite_ops_only", |
204 |
– |
OUTPUT_BOOLEAN_YN, |
205 |
– |
&ConfigChannel.invite_ops_only, |
206 |
– |
"Restrict invite to ops only" |
207 |
– |
}, |
208 |
– |
{ |
181 |
|
"max_chans_per_user", |
182 |
|
OUTPUT_DECIMAL, |
183 |
|
&ConfigChannel.max_chans_per_user, |
184 |
|
"Maximum number of channels a user can join" |
185 |
|
}, |
186 |
|
{ |
187 |
< |
"quiet_on_ban", |
188 |
< |
OUTPUT_BOOLEAN_YN, |
189 |
< |
&ConfigChannel.quiet_on_ban, |
190 |
< |
"Banned users may not send text to a channel" |
187 |
> |
"max_chans_per_oper", |
188 |
> |
OUTPUT_DECIMAL, |
189 |
> |
&ConfigChannel.max_chans_per_oper, |
190 |
> |
"Maximum number of channels an oper can join" |
191 |
|
}, |
192 |
|
{ |
193 |
|
"max_bans", |
220 |
|
"Disallow joining channels when split" |
221 |
|
}, |
222 |
|
{ |
251 |
– |
"burst_topicwho", |
252 |
– |
OUTPUT_BOOLEAN_YN, |
253 |
– |
&ConfigChannel.burst_topicwho, |
254 |
– |
"Enable sending of who set topic on topicburst" |
255 |
– |
}, |
256 |
– |
{ |
223 |
|
"flatten_links", |
224 |
|
OUTPUT_BOOLEAN_YN, |
225 |
|
&ConfigServerHide.flatten_links, |
238 |
|
"Hide this server from a flattened /links on remote servers" |
239 |
|
}, |
240 |
|
{ |
275 |
– |
"disable_hidden", |
276 |
– |
OUTPUT_BOOLEAN_YN, |
277 |
– |
&ConfigServerHide.disable_hidden, |
278 |
– |
"Prevent servers from hiding themselves from a flattened /links" |
279 |
– |
}, |
280 |
– |
{ |
241 |
|
"hide_servers", |
242 |
|
OUTPUT_BOOLEAN_YN, |
243 |
|
&ConfigServerHide.hide_servers, |
244 |
|
"Hide servernames from users" |
245 |
|
}, |
246 |
|
{ |
247 |
+ |
"hide_services", |
248 |
+ |
OUTPUT_BOOLEAN_YN, |
249 |
+ |
&ConfigServerHide.hide_services, |
250 |
+ |
"Hides the location of services server" |
251 |
+ |
}, |
252 |
+ |
{ |
253 |
|
"hidden_name", |
254 |
|
OUTPUT_STRING, |
255 |
|
&ConfigServerHide.hidden_name, |
259 |
|
"hide_server_ips", |
260 |
|
OUTPUT_BOOLEAN_YN, |
261 |
|
&ConfigServerHide.hide_server_ips, |
262 |
< |
"Prevent people from seeing server IPs" |
262 |
> |
"Prevent people from seeing server IP addresses" |
263 |
|
}, |
264 |
|
{ |
265 |
|
"gline_min_cidr", |
280 |
|
"Automatically set mode +i on connecting users" |
281 |
|
}, |
282 |
|
{ |
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 |
– |
{ |
283 |
|
"kill_chase_time_limit", |
284 |
|
OUTPUT_DECIMAL, |
285 |
|
&ConfigFileEntry.kill_chase_time_limit, |
289 |
|
"hide_spoof_ips", |
290 |
|
OUTPUT_BOOLEAN_YN, |
291 |
|
&ConfigFileEntry.hide_spoof_ips, |
292 |
< |
"Hide spoofed IP's" |
292 |
> |
"Hide spoofed IP addresses" |
293 |
|
}, |
294 |
|
{ |
295 |
|
"ignore_bogus_ts", |
298 |
|
"Ignore bogus timestamps from other servers" |
299 |
|
}, |
300 |
|
{ |
301 |
+ |
"cycle_on_host_change", |
302 |
+ |
OUTPUT_BOOLEAN_YN, |
303 |
+ |
&ConfigFileEntry.cycle_on_host_change, |
304 |
+ |
"Send a fake QUIT/JOIN combination on host change" |
305 |
+ |
}, |
306 |
+ |
{ |
307 |
|
"disable_auth", |
308 |
|
OUTPUT_BOOLEAN_YN, |
309 |
|
&ConfigFileEntry.disable_auth, |
312 |
|
{ |
313 |
|
"disable_remote_commands", |
314 |
|
OUTPUT_BOOLEAN_YN, |
315 |
< |
&ConfigFileEntry.disable_remote, |
315 |
> |
&ConfigServerHide.disable_remote_commands, |
316 |
|
"Prevent users issuing commands on remote servers" |
317 |
|
}, |
318 |
|
{ |
329 |
|
}, |
330 |
|
{ |
331 |
|
"failed_oper_notice", |
332 |
< |
OUTPUT_BOOLEAN, |
332 |
> |
OUTPUT_BOOLEAN_YN, |
333 |
|
&ConfigFileEntry.failed_oper_notice, |
334 |
< |
"Inform opers if someone /oper's with the wrong password" |
334 |
> |
"Inform opers if someone tries to /oper with the wrong password" |
335 |
|
}, |
336 |
|
{ |
337 |
|
"dots_in_ident", |
340 |
|
"Number of permissable dots in an ident" |
341 |
|
}, |
342 |
|
{ |
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 |
– |
{ |
343 |
|
"min_nonwildcard", |
344 |
|
OUTPUT_DECIMAL, |
345 |
|
&ConfigFileEntry.min_nonwildcard, |
359 |
|
}, |
360 |
|
{ |
361 |
|
"anti_nick_flood", |
362 |
< |
OUTPUT_BOOLEAN, |
362 |
> |
OUTPUT_BOOLEAN_YN, |
363 |
|
&ConfigFileEntry.anti_nick_flood, |
364 |
|
"NICK flood protection" |
365 |
|
}, |
394 |
|
"Maximum permitted TS delta from another server" |
395 |
|
}, |
396 |
|
{ |
397 |
< |
"kline_with_reason", |
397 |
> |
"warn_no_connect_block", |
398 |
|
OUTPUT_BOOLEAN_YN, |
399 |
< |
&ConfigFileEntry.kline_with_reason, |
400 |
< |
"Display K-line reason to client on disconnect" |
399 |
> |
&ConfigFileEntry.warn_no_connect_block, |
400 |
> |
"Display warning if connecting server lacks a connect{} block" |
401 |
|
}, |
402 |
|
{ |
403 |
< |
"kline_reason", |
404 |
< |
OUTPUT_STRING, |
405 |
< |
&ConfigFileEntry.kline_reason, |
406 |
< |
"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" |
403 |
> |
"stats_e_disabled", |
404 |
> |
OUTPUT_BOOLEAN_YN, |
405 |
> |
&ConfigFileEntry.stats_e_disabled, |
406 |
> |
"Whether or not STATS e is disabled" |
407 |
|
}, |
408 |
|
{ |
409 |
|
"stats_o_oper_only", |
418 |
|
"STATS P is only shown to operators" |
419 |
|
}, |
420 |
|
{ |
421 |
+ |
"stats_u_oper_only", |
422 |
+ |
OUTPUT_BOOLEAN_YN, |
423 |
+ |
&ConfigFileEntry.stats_u_oper_only, |
424 |
+ |
"STATS u is only shown to operators" |
425 |
+ |
}, |
426 |
+ |
{ |
427 |
|
"stats_i_oper_only", |
428 |
|
OUTPUT_BOOLEAN2, |
429 |
|
&ConfigFileEntry.stats_i_oper_only, |
467 |
|
}, |
468 |
|
{ |
469 |
|
"ping_cookie", |
470 |
< |
OUTPUT_BOOLEAN, |
470 |
> |
OUTPUT_BOOLEAN_YN, |
471 |
|
&ConfigFileEntry.ping_cookie, |
472 |
|
"Require ping cookies to connect" |
473 |
|
}, |
474 |
|
{ |
475 |
|
"no_oper_flood", |
476 |
< |
OUTPUT_BOOLEAN, |
476 |
> |
OUTPUT_BOOLEAN_YN, |
477 |
|
&ConfigFileEntry.no_oper_flood, |
478 |
|
"Reduce flood control for operators" |
479 |
|
}, |
480 |
|
{ |
481 |
|
"true_no_oper_flood", |
482 |
< |
OUTPUT_BOOLEAN, |
482 |
> |
OUTPUT_BOOLEAN_YN, |
483 |
|
&ConfigFileEntry.true_no_oper_flood, |
484 |
|
"Completely disable flood control for operators" |
485 |
|
}, |
490 |
|
"Opers can over-ride RESVs" |
491 |
|
}, |
492 |
|
{ |
539 |
– |
"idletime", |
540 |
– |
OUTPUT_DECIMAL, |
541 |
– |
&ConfigFileEntry.idletime, |
542 |
– |
"Number of seconds before a client is considered idle" |
543 |
– |
}, |
544 |
– |
{ |
493 |
|
"max_targets", |
494 |
|
OUTPUT_DECIMAL, |
495 |
|
&ConfigFileEntry.max_targets, |
496 |
|
"The maximum number of PRIVMSG/NOTICE targets" |
497 |
|
}, |
498 |
|
{ |
551 |
– |
"client_flood", |
552 |
– |
OUTPUT_DECIMAL, |
553 |
– |
&ConfigFileEntry.client_flood, |
554 |
– |
"Maximum amount of data in a client's queue before they are disconnected" |
555 |
– |
}, |
556 |
– |
{ |
499 |
|
"throttle_time", |
500 |
|
OUTPUT_DECIMAL, |
501 |
|
&ConfigFileEntry.throttle_time, |
502 |
|
"Minimum time between client reconnects" |
503 |
|
}, |
504 |
|
{ |
505 |
< |
"glines", |
506 |
< |
OUTPUT_BOOLEAN, |
505 |
> |
"gline_enable", |
506 |
> |
OUTPUT_BOOLEAN_YN, |
507 |
|
&ConfigFileEntry.glines, |
508 |
|
"G-line (network-wide K-line) support" |
509 |
|
}, |
510 |
|
{ |
511 |
< |
"duration", |
511 |
> |
"gline_duration", |
512 |
|
OUTPUT_DECIMAL, |
513 |
|
&ConfigFileEntry.gline_time, |
514 |
|
"Expiry time for G-lines" |
515 |
|
}, |
516 |
+ |
{ |
517 |
+ |
"gline_request_duration", |
518 |
+ |
OUTPUT_DECIMAL, |
519 |
+ |
&ConfigFileEntry.gline_request_time, |
520 |
+ |
"Expiry time for pending G-lines" |
521 |
+ |
}, |
522 |
+ |
|
523 |
|
/* --[ END OF TABLE ]---------------------------------------------- */ |
524 |
|
{ |
525 |
|
NULL, |
529 |
|
} |
530 |
|
}; |
531 |
|
|
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 |
– |
|
532 |
|
/* send_birthdate_online_time() |
533 |
|
* |
534 |
|
* inputs - client pointer to send to |
538 |
|
static void |
539 |
|
send_birthdate_online_time(struct Client *source_p) |
540 |
|
{ |
541 |
< |
if (!MyClient(source_p) && IsCapable(source_p->from, CAP_TS6) && HasID(source_p)) |
542 |
< |
{ |
543 |
< |
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 |
< |
} |
541 |
> |
sendto_one_numeric(source_p, &me, RPL_INFO|SND_EXPLICIT, |
542 |
> |
":On-line since %s", |
543 |
> |
myctime(me.localClient->firsttime)); |
544 |
|
} |
545 |
|
|
546 |
|
/* send_conf_options() |
552 |
|
static void |
553 |
|
send_conf_options(struct Client *source_p) |
554 |
|
{ |
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 |
– |
|
555 |
|
/* |
556 |
|
* Parse the info_table[] and do the magic. |
557 |
|
*/ |
558 |
< |
for (iptr = info_table; iptr->name; ++iptr) |
558 |
> |
for (const struct InfoStruct *iptr = info_table; iptr->name; ++iptr) |
559 |
|
{ |
560 |
|
switch (iptr->output_type) |
561 |
|
{ |
562 |
|
/* For "char *" references */ |
563 |
|
case OUTPUT_STRING: |
564 |
|
{ |
565 |
< |
const char *option = *((char **)iptr->option); |
565 |
> |
const char *option = *((const char *const *)iptr->option); |
566 |
|
|
567 |
< |
sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]", |
568 |
< |
from, RPL_INFO, to, |
569 |
< |
iptr->name, option ? option : "NONE", |
570 |
< |
iptr->desc ? iptr->desc : "<none>"); |
567 |
> |
sendto_one_numeric(source_p, &me, RPL_INFO|SND_EXPLICIT, |
568 |
> |
":%-30s %-5s [%-30s]", |
569 |
> |
iptr->name, option ? option : "NONE", |
570 |
> |
iptr->desc ? iptr->desc : "<none>"); |
571 |
|
break; |
572 |
|
} |
573 |
|
|
576 |
|
{ |
577 |
|
const char *option = iptr->option; |
578 |
|
|
579 |
< |
sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]", |
580 |
< |
from, RPL_INFO, to, |
581 |
< |
iptr->name, option ? option : "NONE", |
582 |
< |
iptr->desc ? iptr->desc : "<none>"); |
579 |
> |
sendto_one_numeric(source_p, &me, RPL_INFO|SND_EXPLICIT, |
580 |
> |
":%-30s %-5s [%-30s]", |
581 |
> |
iptr->name, option ? option : "NONE", |
582 |
> |
iptr->desc ? iptr->desc : "<none>"); |
583 |
|
break; |
584 |
|
} |
585 |
|
|
586 |
|
/* Output info_table[i].option as a decimal value. */ |
587 |
|
case OUTPUT_DECIMAL: |
588 |
|
{ |
589 |
< |
const int option = *((int *)iptr->option); |
589 |
> |
const int option = *((const int *const)iptr->option); |
590 |
|
|
591 |
< |
sendto_one(source_p, ":%s %d %s :%-30s %-5d [%-30s]", |
592 |
< |
from, RPL_INFO, to, iptr->name, |
593 |
< |
option, iptr->desc ? iptr->desc : "<none>"); |
591 |
> |
sendto_one_numeric(source_p, &me, RPL_INFO|SND_EXPLICIT, |
592 |
> |
":%-30s %-5d [%-30s]", |
593 |
> |
iptr->name, option, iptr->desc ? iptr->desc : "<none>"); |
594 |
|
break; |
595 |
|
} |
596 |
|
|
597 |
|
/* Output info_table[i].option as "ON" or "OFF" */ |
598 |
|
case OUTPUT_BOOLEAN: |
599 |
|
{ |
600 |
< |
const int option = *((int *)iptr->option); |
600 |
> |
const int option = *((const int *const)iptr->option); |
601 |
|
|
602 |
< |
sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]", |
603 |
< |
from, RPL_INFO, to, |
604 |
< |
iptr->name, option ? "ON" : "OFF", |
605 |
< |
iptr->desc ? iptr->desc : "<none>"); |
602 |
> |
sendto_one_numeric(source_p, &me, RPL_INFO|SND_EXPLICIT, |
603 |
> |
":%-30s %-5s [%-30s]", |
604 |
> |
iptr->name, option ? "ON" : "OFF", |
605 |
> |
iptr->desc ? iptr->desc : "<none>"); |
606 |
|
|
607 |
|
break; |
608 |
|
} |
610 |
|
/* Output info_table[i].option as "YES" or "NO" */ |
611 |
|
case OUTPUT_BOOLEAN_YN: |
612 |
|
{ |
613 |
< |
int option = *((int *)iptr->option); |
613 |
> |
const int option = *((const int *const)iptr->option); |
614 |
|
|
615 |
< |
sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]", |
616 |
< |
from, RPL_INFO, to, |
617 |
< |
iptr->name, option ? "YES" : "NO", |
618 |
< |
iptr->desc ? iptr->desc : "<none>"); |
615 |
> |
sendto_one_numeric(source_p, &me, RPL_INFO|SND_EXPLICIT, |
616 |
> |
":%-30s %-5s [%-30s]", |
617 |
> |
iptr->name, option ? "YES" : "NO", |
618 |
> |
iptr->desc ? iptr->desc : "<none>"); |
619 |
|
break; |
620 |
|
} |
621 |
|
|
622 |
|
case OUTPUT_BOOLEAN2: |
623 |
|
{ |
624 |
< |
int option = *((int *)iptr->option); |
624 |
> |
const int option = *((const int *const)iptr->option); |
625 |
|
|
626 |
< |
sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]", |
627 |
< |
from, RPL_INFO, to, |
628 |
< |
iptr->name, option ? ((option == 1) ? "MASK" : "YES") : "NO", |
629 |
< |
iptr->desc ? iptr->desc : "<none>"); |
626 |
> |
sendto_one_numeric(source_p, &me, RPL_INFO|SND_EXPLICIT, |
627 |
> |
":%-30s %-5s [%-30s]", |
628 |
> |
iptr->name, option ? ((option == 1) ? "MASK" : "YES") : "NO", |
629 |
> |
iptr->desc ? iptr->desc : "<none>"); |
630 |
|
break; |
631 |
|
} |
632 |
|
} |
633 |
|
} |
634 |
|
|
635 |
< |
/* Don't send oper_only_umodes...it's a bit mask, we will have to decode it |
636 |
< |
* in order for it to show up properly to opers who issue INFO |
637 |
< |
*/ |
638 |
< |
#ifndef EFNET |
639 |
< |
/* jdc -- Only send compile information to admins. */ |
640 |
< |
if (IsAdmin(source_p)) |
641 |
< |
sendto_one(source_p, ":%s %d %s :Running on [%s]", |
642 |
< |
from, RPL_INFO, to, ircd_platform); |
643 |
< |
#endif |
644 |
< |
sendto_one(source_p, form_str(RPL_INFO), |
645 |
< |
from, to, ""); |
635 |
> |
sendto_one_numeric(source_p, &me, RPL_INFO, ""); |
636 |
> |
} |
637 |
> |
|
638 |
> |
/* send_info_text() |
639 |
> |
* |
640 |
> |
* inputs - client pointer to send info text to |
641 |
> |
* output - NONE |
642 |
> |
* side effects - info text is sent to client |
643 |
> |
*/ |
644 |
> |
static void |
645 |
> |
send_info_text(struct Client *source_p) |
646 |
> |
{ |
647 |
> |
const char **text = infotext; |
648 |
> |
|
649 |
> |
sendto_realops_flags(UMODE_SPY, L_ALL, SEND_NOTICE, |
650 |
> |
"INFO requested by %s (%s@%s) [%s]", |
651 |
> |
source_p->name, source_p->username, |
652 |
> |
source_p->host, source_p->servptr->name); |
653 |
> |
|
654 |
> |
while (*text) |
655 |
> |
{ |
656 |
> |
const char *line = *text++; |
657 |
> |
|
658 |
> |
if (*line == '\0') |
659 |
> |
line = " "; |
660 |
> |
|
661 |
> |
sendto_one_numeric(source_p, &me, RPL_INFO, line); |
662 |
> |
} |
663 |
> |
|
664 |
> |
if (HasUMode(source_p, UMODE_OPER)) |
665 |
> |
send_conf_options(source_p); |
666 |
> |
|
667 |
> |
send_birthdate_online_time(source_p); |
668 |
> |
|
669 |
> |
sendto_one_numeric(source_p, &me, RPL_ENDOFINFO); |
670 |
|
} |
671 |
+ |
|
672 |
+ |
/*! \brief INFO command handler |
673 |
+ |
* |
674 |
+ |
* \param source_p Pointer to allocated Client struct from which the message |
675 |
+ |
* originally comes from. This can be a local or remote client. |
676 |
+ |
* \param parc Integer holding the number of supplied arguments. |
677 |
+ |
* \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL |
678 |
+ |
* pointers. |
679 |
+ |
* \note Valid arguments for this command are: |
680 |
+ |
* - parv[0] = command |
681 |
+ |
* - parv[1] = nickname/servername |
682 |
+ |
*/ |
683 |
+ |
static int |
684 |
+ |
m_info(struct Client *source_p, int parc, char *parv[]) |
685 |
+ |
{ |
686 |
+ |
static time_t last_used = 0; |
687 |
+ |
|
688 |
+ |
if ((last_used + ConfigFileEntry.pace_wait) > CurrentTime) |
689 |
+ |
{ |
690 |
+ |
sendto_one_numeric(source_p, &me, RPL_LOAD2HI); |
691 |
+ |
return 0; |
692 |
+ |
} |
693 |
+ |
|
694 |
+ |
last_used = CurrentTime; |
695 |
+ |
|
696 |
+ |
if (!ConfigServerHide.disable_remote_commands) |
697 |
+ |
if (hunt_server(source_p, ":%s INFO :%s", 1, |
698 |
+ |
parc, parv) != HUNTED_ISME) |
699 |
+ |
return 0; |
700 |
+ |
|
701 |
+ |
send_info_text(source_p); |
702 |
+ |
return 0; |
703 |
+ |
} |
704 |
+ |
|
705 |
+ |
/*! \brief INFO command handler |
706 |
+ |
* |
707 |
+ |
* \param source_p Pointer to allocated Client struct from which the message |
708 |
+ |
* originally comes from. This can be a local or remote client. |
709 |
+ |
* \param parc Integer holding the number of supplied arguments. |
710 |
+ |
* \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL |
711 |
+ |
* pointers. |
712 |
+ |
* \note Valid arguments for this command are: |
713 |
+ |
* - parv[0] = command |
714 |
+ |
* - parv[1] = nickname/servername |
715 |
+ |
*/ |
716 |
+ |
static int |
717 |
+ |
ms_info(struct Client *source_p, int parc, char *parv[]) |
718 |
+ |
{ |
719 |
+ |
if (hunt_server(source_p, ":%s INFO :%s", 1, |
720 |
+ |
parc, parv) != HUNTED_ISME) |
721 |
+ |
return 0; |
722 |
+ |
|
723 |
+ |
send_info_text(source_p); |
724 |
+ |
return 0; |
725 |
+ |
} |
726 |
+ |
|
727 |
+ |
static struct Message info_msgtab = |
728 |
+ |
{ |
729 |
+ |
"INFO", 0, 0, 0, MAXPARA, MFLG_SLOW, 0, |
730 |
+ |
{ m_unregistered, m_info, ms_info, m_ignore, ms_info, m_ignore } |
731 |
+ |
}; |
732 |
+ |
|
733 |
+ |
static void |
734 |
+ |
module_init(void) |
735 |
+ |
{ |
736 |
+ |
mod_add_cmd(&info_msgtab); |
737 |
+ |
} |
738 |
+ |
|
739 |
+ |
static void |
740 |
+ |
module_exit(void) |
741 |
+ |
{ |
742 |
+ |
mod_del_cmd(&info_msgtab); |
743 |
+ |
} |
744 |
+ |
|
745 |
+ |
struct module module_entry = |
746 |
+ |
{ |
747 |
+ |
.node = { NULL, NULL, NULL }, |
748 |
+ |
.name = NULL, |
749 |
+ |
.version = "$Revision$", |
750 |
+ |
.handle = NULL, |
751 |
+ |
.modinit = module_init, |
752 |
+ |
.modexit = module_exit, |
753 |
+ |
.flags = 0 |
754 |
+ |
}; |