1 |
adx |
30 |
/* |
2 |
|
|
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). |
3 |
|
|
* m_info.c: Sends information about the server. |
4 |
|
|
* |
5 |
|
|
* Copyright (C) 2005 by the past and present ircd coders, and others. |
6 |
|
|
* |
7 |
|
|
* This program is free software; you can redistribute it and/or modify |
8 |
|
|
* it under the terms of the GNU General Public License as published by |
9 |
|
|
* the Free Software Foundation; either version 2 of the License, or |
10 |
|
|
* (at your option) any later version. |
11 |
|
|
* |
12 |
|
|
* This program is distributed in the hope that it will be useful, |
13 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
|
|
* GNU General Public License for more details. |
16 |
|
|
* |
17 |
|
|
* You should have received a copy of the GNU General Public License |
18 |
|
|
* along with this program; if not, write to the Free Software |
19 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
20 |
|
|
* USA |
21 |
|
|
* |
22 |
knight |
31 |
* $Id$ |
23 |
adx |
30 |
*/ |
24 |
|
|
|
25 |
|
|
#include "stdinc.h" |
26 |
michael |
1011 |
#include "list.h" |
27 |
adx |
30 |
#include "channel.h" |
28 |
|
|
#include "client.h" |
29 |
|
|
#include "irc_string.h" |
30 |
|
|
#include "ircd.h" |
31 |
|
|
#include "numeric.h" |
32 |
|
|
#include "s_serv.h" |
33 |
|
|
#include "s_user.h" |
34 |
|
|
#include "send.h" |
35 |
michael |
1309 |
#include "conf.h" |
36 |
adx |
30 |
#include "parse.h" |
37 |
|
|
#include "modules.h" |
38 |
|
|
|
39 |
michael |
1230 |
|
40 |
adx |
30 |
static void send_conf_options(struct Client *); |
41 |
|
|
static void send_birthdate_online_time(struct Client *); |
42 |
|
|
static void send_info_text(struct Client *); |
43 |
|
|
|
44 |
|
|
/* |
45 |
|
|
* jdc -- Structure for our configuration value table |
46 |
|
|
*/ |
47 |
|
|
struct InfoStruct |
48 |
|
|
{ |
49 |
|
|
const char *name; /* Displayed variable name */ |
50 |
|
|
unsigned int output_type; /* See below #defines */ |
51 |
|
|
void *option; /* Pointer reference to the value */ |
52 |
|
|
const char *desc; /* ASCII description of the variable */ |
53 |
|
|
}; |
54 |
|
|
|
55 |
|
|
/* Types for output_type in InfoStruct */ |
56 |
|
|
#define OUTPUT_STRING 0x0001 /* Output option as %s w/ dereference */ |
57 |
|
|
#define OUTPUT_STRING_PTR 0x0002 /* Output option as %s w/out deference */ |
58 |
|
|
#define OUTPUT_DECIMAL 0x0004 /* Output option as decimal (%d) */ |
59 |
|
|
#define OUTPUT_BOOLEAN 0x0008 /* Output option as "ON" or "OFF" */ |
60 |
|
|
#define OUTPUT_BOOLEAN_YN 0x0010 /* Output option as "YES" or "NO" */ |
61 |
|
|
#define OUTPUT_BOOLEAN2 0x0020 /* Output option as "YES/NO/MASKED" */ |
62 |
|
|
|
63 |
|
|
static const struct InfoStruct info_table[] = |
64 |
|
|
{ |
65 |
|
|
/* --[ START OF TABLE ]-------------------------------------------- */ |
66 |
michael |
1318 |
|
67 |
adx |
30 |
{ |
68 |
michael |
1318 |
"CPATH", |
69 |
|
|
OUTPUT_STRING, |
70 |
|
|
&ConfigFileEntry.configfile, |
71 |
michael |
1702 |
"Path to main configuration file" |
72 |
michael |
1318 |
}, |
73 |
|
|
{ |
74 |
|
|
"DPATH", |
75 |
|
|
OUTPUT_STRING, |
76 |
|
|
&ConfigFileEntry.dpath, |
77 |
michael |
1702 |
"Directory containing configuration files" |
78 |
michael |
1318 |
}, |
79 |
|
|
{ |
80 |
|
|
"DLPATH", |
81 |
|
|
OUTPUT_STRING, |
82 |
|
|
&ConfigFileEntry.dlinefile, |
83 |
michael |
1702 |
"Path to D-line database file" |
84 |
michael |
1318 |
}, |
85 |
|
|
{ |
86 |
|
|
"KPATH", |
87 |
|
|
OUTPUT_STRING, |
88 |
|
|
&ConfigFileEntry.klinefile, |
89 |
michael |
1702 |
"Path to K-line database file" |
90 |
michael |
1318 |
}, |
91 |
|
|
{ |
92 |
michael |
1702 |
"GPATH", |
93 |
|
|
OUTPUT_STRING, |
94 |
|
|
&ConfigFileEntry.glinefile, |
95 |
|
|
"Path to G-line database file" |
96 |
|
|
}, |
97 |
|
|
{ |
98 |
|
|
"XPATH", |
99 |
|
|
OUTPUT_STRING, |
100 |
|
|
&ConfigFileEntry.xlinefile, |
101 |
|
|
"Path to X-line database file" |
102 |
|
|
}, |
103 |
|
|
{ |
104 |
|
|
"RESVPATH", |
105 |
|
|
OUTPUT_STRING, |
106 |
|
|
&ConfigFileEntry.xlinefile, |
107 |
|
|
"Path to resv database file" |
108 |
|
|
}, |
109 |
|
|
{ |
110 |
adx |
30 |
"network_name", |
111 |
|
|
OUTPUT_STRING, |
112 |
|
|
&ServerInfo.network_name, |
113 |
|
|
"Network name" |
114 |
|
|
}, |
115 |
|
|
{ |
116 |
|
|
"network_desc", |
117 |
|
|
OUTPUT_STRING, |
118 |
|
|
&ServerInfo.network_desc, |
119 |
|
|
"Network description" |
120 |
|
|
}, |
121 |
|
|
{ |
122 |
|
|
"hub", |
123 |
|
|
OUTPUT_BOOLEAN_YN, |
124 |
|
|
&ServerInfo.hub, |
125 |
|
|
"Server is a hub" |
126 |
|
|
}, |
127 |
|
|
{ |
128 |
michael |
1754 |
"max_clients", |
129 |
|
|
OUTPUT_DECIMAL, |
130 |
|
|
&ServerInfo.max_clients, |
131 |
|
|
"Maximum number of clients permitted simultaneously on this server" |
132 |
|
|
}, |
133 |
|
|
{ |
134 |
|
|
"max_nick_length", |
135 |
|
|
OUTPUT_DECIMAL, |
136 |
|
|
&ServerInfo.max_nick_length, |
137 |
|
|
"Maximum nickname length" |
138 |
|
|
}, |
139 |
|
|
{ |
140 |
|
|
"max_topic_length", |
141 |
|
|
OUTPUT_DECIMAL, |
142 |
|
|
&ServerInfo.max_topic_length, |
143 |
|
|
"Maximum topic length" |
144 |
|
|
}, |
145 |
|
|
{ |
146 |
adx |
30 |
"use_logging", |
147 |
|
|
OUTPUT_BOOLEAN_YN, |
148 |
|
|
&ConfigLoggingEntry.use_logging, |
149 |
|
|
"Enable logging" |
150 |
|
|
}, |
151 |
|
|
{ |
152 |
|
|
"restrict_channels", |
153 |
|
|
OUTPUT_BOOLEAN_YN, |
154 |
|
|
&ConfigChannel.restrict_channels, |
155 |
|
|
"Only reserved channels are allowed" |
156 |
|
|
}, |
157 |
|
|
{ |
158 |
|
|
"knock_delay", |
159 |
|
|
OUTPUT_DECIMAL, |
160 |
|
|
&ConfigChannel.knock_delay, |
161 |
|
|
"Delay between a users KNOCK attempts" |
162 |
|
|
}, |
163 |
|
|
{ |
164 |
|
|
"knock_delay_channel", |
165 |
|
|
OUTPUT_DECIMAL, |
166 |
|
|
&ConfigChannel.knock_delay_channel, |
167 |
|
|
"Delay between KNOCK attempts to a channel" |
168 |
|
|
}, |
169 |
|
|
{ |
170 |
|
|
"max_chans_per_user", |
171 |
|
|
OUTPUT_DECIMAL, |
172 |
|
|
&ConfigChannel.max_chans_per_user, |
173 |
|
|
"Maximum number of channels a user can join" |
174 |
|
|
}, |
175 |
|
|
{ |
176 |
michael |
1432 |
"max_chans_per_oper", |
177 |
|
|
OUTPUT_DECIMAL, |
178 |
|
|
&ConfigChannel.max_chans_per_oper, |
179 |
|
|
"Maximum number of channels an oper can join" |
180 |
|
|
}, |
181 |
|
|
{ |
182 |
adx |
30 |
"quiet_on_ban", |
183 |
|
|
OUTPUT_BOOLEAN_YN, |
184 |
|
|
&ConfigChannel.quiet_on_ban, |
185 |
|
|
"Banned users may not send text to a channel" |
186 |
|
|
}, |
187 |
|
|
{ |
188 |
|
|
"max_bans", |
189 |
|
|
OUTPUT_DECIMAL, |
190 |
|
|
&ConfigChannel.max_bans, |
191 |
|
|
"Total +b/e/I modes allowed in a channel" |
192 |
|
|
}, |
193 |
|
|
{ |
194 |
|
|
"default_split_user_count", |
195 |
|
|
OUTPUT_DECIMAL, |
196 |
|
|
&ConfigChannel.default_split_user_count, |
197 |
|
|
"Startup value of SPLITUSERS" |
198 |
|
|
}, |
199 |
|
|
{ |
200 |
|
|
"default_split_server_count", |
201 |
|
|
OUTPUT_DECIMAL, |
202 |
|
|
&ConfigChannel.default_split_server_count, |
203 |
|
|
"Startup value of SPLITNUM" |
204 |
|
|
}, |
205 |
|
|
{ |
206 |
|
|
"no_create_on_split", |
207 |
|
|
OUTPUT_BOOLEAN_YN, |
208 |
|
|
&ConfigChannel.no_create_on_split, |
209 |
|
|
"Disallow creation of channels when split" |
210 |
|
|
}, |
211 |
|
|
{ |
212 |
|
|
"no_join_on_split", |
213 |
|
|
OUTPUT_BOOLEAN_YN, |
214 |
|
|
&ConfigChannel.no_join_on_split, |
215 |
|
|
"Disallow joining channels when split" |
216 |
|
|
}, |
217 |
|
|
{ |
218 |
|
|
"flatten_links", |
219 |
|
|
OUTPUT_BOOLEAN_YN, |
220 |
|
|
&ConfigServerHide.flatten_links, |
221 |
|
|
"Flatten /links list" |
222 |
|
|
}, |
223 |
|
|
{ |
224 |
|
|
"links_delay", |
225 |
|
|
OUTPUT_DECIMAL, |
226 |
|
|
&ConfigServerHide.links_delay, |
227 |
|
|
"Links rehash delay" |
228 |
|
|
}, |
229 |
|
|
{ |
230 |
|
|
"hidden", |
231 |
|
|
OUTPUT_BOOLEAN_YN, |
232 |
|
|
&ConfigServerHide.hidden, |
233 |
|
|
"Hide this server from a flattened /links on remote servers" |
234 |
|
|
}, |
235 |
|
|
{ |
236 |
|
|
"hide_servers", |
237 |
|
|
OUTPUT_BOOLEAN_YN, |
238 |
|
|
&ConfigServerHide.hide_servers, |
239 |
|
|
"Hide servernames from users" |
240 |
|
|
}, |
241 |
|
|
{ |
242 |
|
|
"hidden_name", |
243 |
|
|
OUTPUT_STRING, |
244 |
|
|
&ConfigServerHide.hidden_name, |
245 |
|
|
"Server name users see if hide_servers = yes" |
246 |
|
|
}, |
247 |
|
|
{ |
248 |
|
|
"hide_server_ips", |
249 |
|
|
OUTPUT_BOOLEAN_YN, |
250 |
|
|
&ConfigServerHide.hide_server_ips, |
251 |
|
|
"Prevent people from seeing server IPs" |
252 |
|
|
}, |
253 |
|
|
{ |
254 |
|
|
"gline_min_cidr", |
255 |
|
|
OUTPUT_DECIMAL, |
256 |
|
|
&ConfigFileEntry.gline_min_cidr, |
257 |
|
|
"Minimum required length of a CIDR bitmask for IPv4 G-Lines" |
258 |
|
|
}, |
259 |
|
|
{ |
260 |
|
|
"gline_min_cidr6", |
261 |
|
|
OUTPUT_DECIMAL, |
262 |
|
|
&ConfigFileEntry.gline_min_cidr6, |
263 |
|
|
"Minimum required length of a CIDR bitmask for IPv6 G-Lines" |
264 |
|
|
}, |
265 |
|
|
{ |
266 |
|
|
"invisible_on_connect", |
267 |
|
|
OUTPUT_BOOLEAN_YN, |
268 |
|
|
&ConfigFileEntry.invisible_on_connect, |
269 |
|
|
"Automatically set mode +i on connecting users" |
270 |
|
|
}, |
271 |
|
|
{ |
272 |
|
|
"kill_chase_time_limit", |
273 |
|
|
OUTPUT_DECIMAL, |
274 |
|
|
&ConfigFileEntry.kill_chase_time_limit, |
275 |
|
|
"Nick Change Tracker for KILL" |
276 |
|
|
}, |
277 |
|
|
{ |
278 |
|
|
"hide_spoof_ips", |
279 |
|
|
OUTPUT_BOOLEAN_YN, |
280 |
|
|
&ConfigFileEntry.hide_spoof_ips, |
281 |
|
|
"Hide spoofed IP's" |
282 |
|
|
}, |
283 |
|
|
{ |
284 |
|
|
"ignore_bogus_ts", |
285 |
|
|
OUTPUT_BOOLEAN_YN, |
286 |
|
|
&ConfigFileEntry.ignore_bogus_ts, |
287 |
|
|
"Ignore bogus timestamps from other servers" |
288 |
|
|
}, |
289 |
|
|
{ |
290 |
|
|
"disable_auth", |
291 |
|
|
OUTPUT_BOOLEAN_YN, |
292 |
|
|
&ConfigFileEntry.disable_auth, |
293 |
|
|
"Completely disable ident lookups" |
294 |
|
|
}, |
295 |
|
|
{ |
296 |
|
|
"disable_remote_commands", |
297 |
|
|
OUTPUT_BOOLEAN_YN, |
298 |
|
|
&ConfigFileEntry.disable_remote, |
299 |
|
|
"Prevent users issuing commands on remote servers" |
300 |
|
|
}, |
301 |
|
|
{ |
302 |
|
|
"tkline_expire_notices", |
303 |
|
|
OUTPUT_BOOLEAN_YN, |
304 |
|
|
&ConfigFileEntry.tkline_expire_notices, |
305 |
|
|
"Show temporary kline/xline expire notices" |
306 |
|
|
}, |
307 |
|
|
{ |
308 |
|
|
"default_floodcount", |
309 |
|
|
OUTPUT_DECIMAL, |
310 |
|
|
&ConfigFileEntry.default_floodcount, |
311 |
|
|
"Startup value of FLOODCOUNT" |
312 |
|
|
}, |
313 |
|
|
{ |
314 |
|
|
"failed_oper_notice", |
315 |
|
|
OUTPUT_BOOLEAN, |
316 |
|
|
&ConfigFileEntry.failed_oper_notice, |
317 |
michael |
1702 |
"Inform opers if someone tries to /oper with the wrong password" |
318 |
adx |
30 |
}, |
319 |
|
|
{ |
320 |
|
|
"dots_in_ident", |
321 |
|
|
OUTPUT_DECIMAL, |
322 |
|
|
&ConfigFileEntry.dots_in_ident, |
323 |
|
|
"Number of permissable dots in an ident" |
324 |
|
|
}, |
325 |
|
|
{ |
326 |
|
|
"min_nonwildcard", |
327 |
|
|
OUTPUT_DECIMAL, |
328 |
|
|
&ConfigFileEntry.min_nonwildcard, |
329 |
|
|
"Minimum non-wildcard chars in K/G lines" |
330 |
|
|
}, |
331 |
|
|
{ |
332 |
|
|
"min_nonwildcard_simple", |
333 |
|
|
OUTPUT_DECIMAL, |
334 |
|
|
&ConfigFileEntry.min_nonwildcard_simple, |
335 |
|
|
"Minimum non-wildcards in gecos bans" |
336 |
|
|
}, |
337 |
|
|
{ |
338 |
|
|
"max_accept", |
339 |
|
|
OUTPUT_DECIMAL, |
340 |
|
|
&ConfigFileEntry.max_accept, |
341 |
|
|
"Maximum nicknames on accept list" |
342 |
|
|
}, |
343 |
|
|
{ |
344 |
|
|
"anti_nick_flood", |
345 |
|
|
OUTPUT_BOOLEAN, |
346 |
|
|
&ConfigFileEntry.anti_nick_flood, |
347 |
|
|
"NICK flood protection" |
348 |
|
|
}, |
349 |
|
|
{ |
350 |
|
|
"max_nick_time", |
351 |
|
|
OUTPUT_DECIMAL, |
352 |
|
|
&ConfigFileEntry.max_nick_time, |
353 |
|
|
"NICK flood protection time interval" |
354 |
|
|
}, |
355 |
|
|
{ |
356 |
|
|
"max_nick_changes", |
357 |
|
|
OUTPUT_DECIMAL, |
358 |
|
|
&ConfigFileEntry.max_nick_changes, |
359 |
|
|
"NICK change threshhold setting" |
360 |
|
|
}, |
361 |
|
|
{ |
362 |
|
|
"anti_spam_exit_message_time", |
363 |
|
|
OUTPUT_DECIMAL, |
364 |
|
|
&ConfigFileEntry.anti_spam_exit_message_time, |
365 |
|
|
"Duration a client must be connected for to have an exit message" |
366 |
|
|
}, |
367 |
|
|
{ |
368 |
|
|
"ts_warn_delta", |
369 |
|
|
OUTPUT_DECIMAL, |
370 |
|
|
&ConfigFileEntry.ts_warn_delta, |
371 |
|
|
"Maximum permitted TS delta before displaying a warning" |
372 |
|
|
}, |
373 |
|
|
{ |
374 |
|
|
"ts_max_delta", |
375 |
|
|
OUTPUT_DECIMAL, |
376 |
|
|
&ConfigFileEntry.ts_max_delta, |
377 |
|
|
"Maximum permitted TS delta from another server" |
378 |
|
|
}, |
379 |
|
|
{ |
380 |
|
|
"warn_no_nline", |
381 |
|
|
OUTPUT_BOOLEAN, |
382 |
|
|
&ConfigFileEntry.warn_no_nline, |
383 |
|
|
"Display warning if connecting server lacks N-line" |
384 |
|
|
}, |
385 |
|
|
{ |
386 |
|
|
"stats_o_oper_only", |
387 |
|
|
OUTPUT_BOOLEAN_YN, |
388 |
|
|
&ConfigFileEntry.stats_o_oper_only, |
389 |
|
|
"STATS O output is only shown to operators" |
390 |
|
|
}, |
391 |
|
|
{ |
392 |
|
|
"stats_P_oper_only", |
393 |
|
|
OUTPUT_BOOLEAN_YN, |
394 |
|
|
&ConfigFileEntry.stats_P_oper_only, |
395 |
|
|
"STATS P is only shown to operators" |
396 |
|
|
}, |
397 |
|
|
{ |
398 |
|
|
"stats_i_oper_only", |
399 |
|
|
OUTPUT_BOOLEAN2, |
400 |
|
|
&ConfigFileEntry.stats_i_oper_only, |
401 |
|
|
"STATS I output is only shown to operators" |
402 |
|
|
}, |
403 |
|
|
{ |
404 |
|
|
"stats_k_oper_only", |
405 |
|
|
OUTPUT_BOOLEAN2, |
406 |
|
|
&ConfigFileEntry.stats_k_oper_only, |
407 |
|
|
"STATS K output is only shown to operators" |
408 |
|
|
}, |
409 |
|
|
{ |
410 |
|
|
"caller_id_wait", |
411 |
|
|
OUTPUT_DECIMAL, |
412 |
|
|
&ConfigFileEntry.caller_id_wait, |
413 |
|
|
"Minimum delay between notifying UMODE +g users of messages" |
414 |
|
|
}, |
415 |
|
|
{ |
416 |
|
|
"opers_bypass_callerid", |
417 |
|
|
OUTPUT_BOOLEAN_YN, |
418 |
|
|
&ConfigFileEntry.opers_bypass_callerid, |
419 |
|
|
"Allows IRC operators to message users who are +g (callerid)" |
420 |
|
|
}, |
421 |
|
|
{ |
422 |
|
|
"pace_wait_simple", |
423 |
|
|
OUTPUT_DECIMAL, |
424 |
|
|
&ConfigFileEntry.pace_wait_simple, |
425 |
|
|
"Minimum delay between less intensive commands" |
426 |
|
|
}, |
427 |
|
|
{ |
428 |
|
|
"pace_wait", |
429 |
|
|
OUTPUT_DECIMAL, |
430 |
|
|
&ConfigFileEntry.pace_wait, |
431 |
|
|
"Minimum delay between uses of certain commands" |
432 |
|
|
}, |
433 |
|
|
{ |
434 |
|
|
"short_motd", |
435 |
|
|
OUTPUT_BOOLEAN_YN, |
436 |
|
|
&ConfigFileEntry.short_motd, |
437 |
|
|
"Do not show MOTD; only tell clients they should read it" |
438 |
|
|
}, |
439 |
|
|
{ |
440 |
|
|
"ping_cookie", |
441 |
|
|
OUTPUT_BOOLEAN, |
442 |
|
|
&ConfigFileEntry.ping_cookie, |
443 |
|
|
"Require ping cookies to connect" |
444 |
|
|
}, |
445 |
|
|
{ |
446 |
|
|
"no_oper_flood", |
447 |
|
|
OUTPUT_BOOLEAN, |
448 |
|
|
&ConfigFileEntry.no_oper_flood, |
449 |
|
|
"Reduce flood control for operators" |
450 |
|
|
}, |
451 |
|
|
{ |
452 |
|
|
"true_no_oper_flood", |
453 |
|
|
OUTPUT_BOOLEAN, |
454 |
|
|
&ConfigFileEntry.true_no_oper_flood, |
455 |
|
|
"Completely disable flood control for operators" |
456 |
|
|
}, |
457 |
|
|
{ |
458 |
|
|
"oper_pass_resv", |
459 |
|
|
OUTPUT_BOOLEAN_YN, |
460 |
|
|
&ConfigFileEntry.oper_pass_resv, |
461 |
|
|
"Opers can over-ride RESVs" |
462 |
|
|
}, |
463 |
|
|
{ |
464 |
|
|
"max_targets", |
465 |
|
|
OUTPUT_DECIMAL, |
466 |
|
|
&ConfigFileEntry.max_targets, |
467 |
|
|
"The maximum number of PRIVMSG/NOTICE targets" |
468 |
|
|
}, |
469 |
|
|
{ |
470 |
|
|
"throttle_time", |
471 |
|
|
OUTPUT_DECIMAL, |
472 |
|
|
&ConfigFileEntry.throttle_time, |
473 |
|
|
"Minimum time between client reconnects" |
474 |
|
|
}, |
475 |
|
|
{ |
476 |
|
|
"glines", |
477 |
|
|
OUTPUT_BOOLEAN, |
478 |
|
|
&ConfigFileEntry.glines, |
479 |
|
|
"G-line (network-wide K-line) support" |
480 |
|
|
}, |
481 |
|
|
{ |
482 |
michael |
1459 |
"gline_duration", |
483 |
adx |
30 |
OUTPUT_DECIMAL, |
484 |
|
|
&ConfigFileEntry.gline_time, |
485 |
|
|
"Expiry time for G-lines" |
486 |
|
|
}, |
487 |
michael |
1459 |
|
488 |
|
|
{ |
489 |
|
|
"gline_request_duration", |
490 |
|
|
OUTPUT_DECIMAL, |
491 |
|
|
&ConfigFileEntry.gline_request_time, |
492 |
|
|
"Expiry time for pending G-lines" |
493 |
|
|
}, |
494 |
|
|
|
495 |
adx |
30 |
/* --[ END OF TABLE ]---------------------------------------------- */ |
496 |
|
|
{ |
497 |
|
|
NULL, |
498 |
|
|
0, |
499 |
|
|
NULL, |
500 |
|
|
0 |
501 |
|
|
} |
502 |
|
|
}; |
503 |
|
|
|
504 |
|
|
/* |
505 |
|
|
** m_info() |
506 |
|
|
** parv[0] = sender prefix |
507 |
|
|
** parv[1] = servername |
508 |
|
|
*/ |
509 |
|
|
static void |
510 |
|
|
m_info(struct Client *client_p, struct Client *source_p, |
511 |
|
|
int parc, char *parv[]) |
512 |
|
|
{ |
513 |
|
|
static time_t last_used = 0; |
514 |
|
|
|
515 |
|
|
if ((last_used + ConfigFileEntry.pace_wait) > CurrentTime) |
516 |
|
|
{ |
517 |
|
|
/* safe enough to give this on a local connect only */ |
518 |
|
|
sendto_one(source_p, form_str(RPL_LOAD2HI), |
519 |
|
|
me.name, source_p->name); |
520 |
|
|
return; |
521 |
|
|
} |
522 |
|
|
|
523 |
michael |
1121 |
last_used = CurrentTime; |
524 |
|
|
|
525 |
adx |
30 |
if (!ConfigFileEntry.disable_remote) |
526 |
michael |
1144 |
if (hunt_server(client_p,source_p, ":%s INFO :%s", 1, |
527 |
|
|
parc, parv) != HUNTED_ISME) |
528 |
adx |
30 |
return; |
529 |
|
|
|
530 |
michael |
1144 |
send_info_text(source_p); |
531 |
adx |
30 |
} |
532 |
|
|
|
533 |
|
|
/* |
534 |
|
|
** mo_info() |
535 |
|
|
** parv[0] = sender prefix |
536 |
|
|
** parv[1] = servername |
537 |
|
|
*/ |
538 |
|
|
static void |
539 |
|
|
mo_info(struct Client *client_p, struct Client *source_p, |
540 |
|
|
int parc, char *parv[]) |
541 |
|
|
{ |
542 |
|
|
if (hunt_server(client_p, source_p, ":%s INFO :%s", 1, |
543 |
|
|
parc, parv) != HUNTED_ISME) |
544 |
|
|
return; |
545 |
|
|
|
546 |
michael |
1144 |
send_info_text(source_p); |
547 |
adx |
30 |
} |
548 |
|
|
|
549 |
|
|
/* |
550 |
|
|
** ms_info() |
551 |
|
|
** parv[0] = sender prefix |
552 |
|
|
** parv[1] = servername |
553 |
|
|
*/ |
554 |
|
|
static void |
555 |
|
|
ms_info(struct Client *client_p, struct Client *source_p, |
556 |
|
|
int parc, char *parv[]) |
557 |
|
|
{ |
558 |
|
|
if (!IsClient(source_p)) |
559 |
|
|
return; |
560 |
|
|
|
561 |
michael |
1144 |
if (hunt_server(client_p, source_p, ":%s INFO :%s", 1, |
562 |
|
|
parc, parv) != HUNTED_ISME) |
563 |
adx |
30 |
return; |
564 |
|
|
|
565 |
michael |
1144 |
send_info_text(source_p); |
566 |
adx |
30 |
} |
567 |
|
|
|
568 |
|
|
/* send_info_text() |
569 |
|
|
* |
570 |
|
|
* inputs - client pointer to send info text to |
571 |
|
|
* output - NONE |
572 |
|
|
* side effects - info text is sent to client |
573 |
|
|
*/ |
574 |
|
|
static void |
575 |
|
|
send_info_text(struct Client *source_p) |
576 |
|
|
{ |
577 |
|
|
const char **text = infotext; |
578 |
|
|
char *source, *target; |
579 |
michael |
1144 |
|
580 |
michael |
1618 |
sendto_realops_flags(UMODE_SPY, L_ALL, SEND_NOTICE, |
581 |
michael |
1144 |
"INFO requested by %s (%s@%s) [%s]", |
582 |
|
|
source_p->name, source_p->username, |
583 |
|
|
source_p->host, source_p->servptr->name); |
584 |
|
|
|
585 |
adx |
30 |
if (!MyClient(source_p) && IsCapable(source_p->from, CAP_TS6) && |
586 |
|
|
HasID(source_p)) |
587 |
|
|
source = me.id, target = source_p->id; |
588 |
|
|
else |
589 |
|
|
source = me.name, target = source_p->name; |
590 |
|
|
|
591 |
|
|
while (*text) |
592 |
|
|
{ |
593 |
|
|
const char *line = *text++; |
594 |
|
|
|
595 |
|
|
if (*line == '\0') |
596 |
|
|
line = " "; |
597 |
|
|
|
598 |
|
|
sendto_one(source_p, form_str(RPL_INFO), |
599 |
|
|
source, target, line); |
600 |
|
|
} |
601 |
|
|
|
602 |
michael |
1219 |
if (HasUMode(source_p, UMODE_OPER)) |
603 |
adx |
30 |
send_conf_options(source_p); |
604 |
|
|
|
605 |
|
|
send_birthdate_online_time(source_p); |
606 |
|
|
|
607 |
|
|
sendto_one(source_p, form_str(RPL_ENDOFINFO), |
608 |
|
|
me.name, source_p->name); |
609 |
|
|
} |
610 |
|
|
|
611 |
|
|
/* send_birthdate_online_time() |
612 |
|
|
* |
613 |
|
|
* inputs - client pointer to send to |
614 |
|
|
* output - NONE |
615 |
|
|
* side effects - birthdate and online time are sent |
616 |
|
|
*/ |
617 |
|
|
static void |
618 |
|
|
send_birthdate_online_time(struct Client *source_p) |
619 |
|
|
{ |
620 |
|
|
if (!MyClient(source_p) && IsCapable(source_p->from, CAP_TS6) && HasID(source_p)) |
621 |
|
|
{ |
622 |
|
|
sendto_one(source_p, ":%s %d %s :On-line since %s", |
623 |
|
|
me.id, RPL_INFO, source_p->id, |
624 |
michael |
1241 |
myctime(me.localClient->firsttime)); |
625 |
adx |
30 |
} |
626 |
|
|
else |
627 |
|
|
{ |
628 |
|
|
sendto_one(source_p, ":%s %d %s :On-line since %s", |
629 |
|
|
me.name, RPL_INFO, source_p->name, |
630 |
michael |
1241 |
myctime(me.localClient->firsttime)); |
631 |
adx |
30 |
} |
632 |
|
|
} |
633 |
|
|
|
634 |
|
|
/* send_conf_options() |
635 |
|
|
* |
636 |
|
|
* inputs - client pointer to send to |
637 |
|
|
* output - NONE |
638 |
|
|
* side effects - send config options to client |
639 |
|
|
*/ |
640 |
|
|
static void |
641 |
|
|
send_conf_options(struct Client *source_p) |
642 |
|
|
{ |
643 |
|
|
const char *from, *to; |
644 |
|
|
const struct InfoStruct *iptr = NULL; |
645 |
|
|
|
646 |
|
|
/* Now send them a list of all our configuration options |
647 |
michael |
912 |
* (mostly from defaults.h and config.h) |
648 |
adx |
30 |
*/ |
649 |
|
|
if (!MyClient(source_p) && IsCapable(source_p->from, CAP_TS6) && HasID(source_p)) |
650 |
|
|
{ |
651 |
|
|
from = me.id; |
652 |
|
|
to = source_p->id; |
653 |
|
|
} |
654 |
|
|
else |
655 |
|
|
{ |
656 |
|
|
from = me.name; |
657 |
|
|
to = source_p->name; |
658 |
|
|
} |
659 |
|
|
|
660 |
|
|
/* |
661 |
|
|
* Parse the info_table[] and do the magic. |
662 |
|
|
*/ |
663 |
|
|
for (iptr = info_table; iptr->name; ++iptr) |
664 |
|
|
{ |
665 |
|
|
switch (iptr->output_type) |
666 |
|
|
{ |
667 |
|
|
/* For "char *" references */ |
668 |
|
|
case OUTPUT_STRING: |
669 |
|
|
{ |
670 |
|
|
const char *option = *((char **)iptr->option); |
671 |
|
|
|
672 |
|
|
sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]", |
673 |
|
|
from, RPL_INFO, to, |
674 |
|
|
iptr->name, option ? option : "NONE", |
675 |
|
|
iptr->desc ? iptr->desc : "<none>"); |
676 |
|
|
break; |
677 |
|
|
} |
678 |
|
|
|
679 |
|
|
/* For "char foo[]" references */ |
680 |
|
|
case OUTPUT_STRING_PTR: |
681 |
|
|
{ |
682 |
|
|
const char *option = iptr->option; |
683 |
|
|
|
684 |
|
|
sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]", |
685 |
|
|
from, RPL_INFO, to, |
686 |
|
|
iptr->name, option ? option : "NONE", |
687 |
|
|
iptr->desc ? iptr->desc : "<none>"); |
688 |
|
|
break; |
689 |
|
|
} |
690 |
|
|
|
691 |
|
|
/* Output info_table[i].option as a decimal value. */ |
692 |
|
|
case OUTPUT_DECIMAL: |
693 |
|
|
{ |
694 |
|
|
const int option = *((int *)iptr->option); |
695 |
|
|
|
696 |
|
|
sendto_one(source_p, ":%s %d %s :%-30s %-5d [%-30s]", |
697 |
|
|
from, RPL_INFO, to, iptr->name, |
698 |
|
|
option, iptr->desc ? iptr->desc : "<none>"); |
699 |
|
|
break; |
700 |
|
|
} |
701 |
|
|
|
702 |
|
|
/* Output info_table[i].option as "ON" or "OFF" */ |
703 |
|
|
case OUTPUT_BOOLEAN: |
704 |
|
|
{ |
705 |
|
|
const int option = *((int *)iptr->option); |
706 |
|
|
|
707 |
|
|
sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]", |
708 |
|
|
from, RPL_INFO, to, |
709 |
|
|
iptr->name, option ? "ON" : "OFF", |
710 |
|
|
iptr->desc ? iptr->desc : "<none>"); |
711 |
|
|
|
712 |
|
|
break; |
713 |
|
|
} |
714 |
|
|
|
715 |
|
|
/* Output info_table[i].option as "YES" or "NO" */ |
716 |
|
|
case OUTPUT_BOOLEAN_YN: |
717 |
|
|
{ |
718 |
|
|
int option = *((int *)iptr->option); |
719 |
|
|
|
720 |
|
|
sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]", |
721 |
|
|
from, RPL_INFO, to, |
722 |
|
|
iptr->name, option ? "YES" : "NO", |
723 |
|
|
iptr->desc ? iptr->desc : "<none>"); |
724 |
|
|
break; |
725 |
|
|
} |
726 |
|
|
|
727 |
|
|
case OUTPUT_BOOLEAN2: |
728 |
|
|
{ |
729 |
|
|
int option = *((int *)iptr->option); |
730 |
|
|
|
731 |
|
|
sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]", |
732 |
|
|
from, RPL_INFO, to, |
733 |
|
|
iptr->name, option ? ((option == 1) ? "MASK" : "YES") : "NO", |
734 |
|
|
iptr->desc ? iptr->desc : "<none>"); |
735 |
|
|
break; |
736 |
|
|
} |
737 |
|
|
} |
738 |
|
|
} |
739 |
|
|
|
740 |
|
|
sendto_one(source_p, form_str(RPL_INFO), |
741 |
|
|
from, to, ""); |
742 |
|
|
} |
743 |
michael |
1230 |
|
744 |
|
|
static struct Message info_msgtab = { |
745 |
|
|
"INFO", 0, 0, 0, MAXPARA, MFLG_SLOW, 0, |
746 |
|
|
{ m_unregistered, m_info, ms_info, m_ignore, mo_info, m_ignore } |
747 |
|
|
}; |
748 |
|
|
|
749 |
|
|
static void |
750 |
|
|
module_init(void) |
751 |
|
|
{ |
752 |
|
|
mod_add_cmd(&info_msgtab); |
753 |
|
|
} |
754 |
|
|
|
755 |
|
|
static void |
756 |
|
|
module_exit(void) |
757 |
|
|
{ |
758 |
|
|
mod_del_cmd(&info_msgtab); |
759 |
|
|
} |
760 |
|
|
|
761 |
|
|
struct module module_entry = { |
762 |
|
|
.node = { NULL, NULL, NULL }, |
763 |
|
|
.name = NULL, |
764 |
|
|
.version = "$Revision$", |
765 |
|
|
.handle = NULL, |
766 |
|
|
.modinit = module_init, |
767 |
|
|
.modexit = module_exit, |
768 |
|
|
.flags = 0 |
769 |
|
|
}; |