1 |
/* |
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 |
* $Id$ |
23 |
*/ |
24 |
|
25 |
#include "stdinc.h" |
26 |
#include "list.h" |
27 |
#include "m_info.h" |
28 |
#include "channel.h" |
29 |
#include "client.h" |
30 |
#include "common.h" |
31 |
#include "irc_string.h" |
32 |
#include "ircd.h" |
33 |
#include "hook.h" |
34 |
#include "numeric.h" |
35 |
#include "s_log.h" |
36 |
#include "s_serv.h" |
37 |
#include "s_user.h" |
38 |
#include "send.h" |
39 |
#include "s_conf.h" |
40 |
#include "handlers.h" |
41 |
#include "msg.h" |
42 |
#include "parse.h" |
43 |
#include "modules.h" |
44 |
|
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 |
const char *_version = "$Revision$"; |
59 |
|
60 |
void |
61 |
_modinit(void) |
62 |
{ |
63 |
mod_add_cmd(&info_msgtab); |
64 |
} |
65 |
|
66 |
void |
67 |
_moddeinit(void) |
68 |
{ |
69 |
mod_del_cmd(&info_msgtab); |
70 |
} |
71 |
|
72 |
/* |
73 |
* jdc -- Structure for our configuration value table |
74 |
*/ |
75 |
struct InfoStruct |
76 |
{ |
77 |
const char *name; /* Displayed variable name */ |
78 |
unsigned int output_type; /* See below #defines */ |
79 |
void *option; /* Pointer reference to the value */ |
80 |
const char *desc; /* ASCII description of the variable */ |
81 |
}; |
82 |
|
83 |
/* Types for output_type in InfoStruct */ |
84 |
#define OUTPUT_STRING 0x0001 /* Output option as %s w/ dereference */ |
85 |
#define OUTPUT_STRING_PTR 0x0002 /* Output option as %s w/out deference */ |
86 |
#define OUTPUT_DECIMAL 0x0004 /* Output option as decimal (%d) */ |
87 |
#define OUTPUT_BOOLEAN 0x0008 /* Output option as "ON" or "OFF" */ |
88 |
#define OUTPUT_BOOLEAN_YN 0x0010 /* Output option as "YES" or "NO" */ |
89 |
#define OUTPUT_BOOLEAN2 0x0020 /* Output option as "YES/NO/MASKED" */ |
90 |
|
91 |
static const struct InfoStruct info_table[] = |
92 |
{ |
93 |
/* --[ START OF TABLE ]-------------------------------------------- */ |
94 |
{ |
95 |
"network_name", |
96 |
OUTPUT_STRING, |
97 |
&ServerInfo.network_name, |
98 |
"Network name" |
99 |
}, |
100 |
{ |
101 |
"network_desc", |
102 |
OUTPUT_STRING, |
103 |
&ServerInfo.network_desc, |
104 |
"Network description" |
105 |
}, |
106 |
{ |
107 |
"hub", |
108 |
OUTPUT_BOOLEAN_YN, |
109 |
&ServerInfo.hub, |
110 |
"Server is a hub" |
111 |
}, |
112 |
{ |
113 |
"use_logging", |
114 |
OUTPUT_BOOLEAN_YN, |
115 |
&ConfigLoggingEntry.use_logging, |
116 |
"Enable logging" |
117 |
}, |
118 |
{ |
119 |
"fuserlog", |
120 |
OUTPUT_STRING_PTR, |
121 |
&ConfigLoggingEntry.userlog, |
122 |
"User log file" |
123 |
}, |
124 |
{ |
125 |
"foperlog", |
126 |
OUTPUT_STRING_PTR, |
127 |
&ConfigLoggingEntry.operlog, |
128 |
"Operator log file" |
129 |
}, |
130 |
{ |
131 |
"fkilllog", |
132 |
OUTPUT_STRING_PTR, |
133 |
&ConfigLoggingEntry.killlog, |
134 |
"Kill log file" |
135 |
}, |
136 |
{ |
137 |
"fklinelog", |
138 |
OUTPUT_STRING_PTR, |
139 |
&ConfigLoggingEntry.klinelog, |
140 |
"K-Line log file" |
141 |
}, |
142 |
{ |
143 |
"fglinelog", |
144 |
OUTPUT_STRING_PTR, |
145 |
&ConfigLoggingEntry.glinelog, |
146 |
"G-Line log file" |
147 |
}, |
148 |
{ |
149 |
"restrict_channels", |
150 |
OUTPUT_BOOLEAN_YN, |
151 |
&ConfigChannel.restrict_channels, |
152 |
"Only reserved channels are allowed" |
153 |
}, |
154 |
{ |
155 |
"disable_local_channels", |
156 |
OUTPUT_BOOLEAN_YN, |
157 |
&ConfigChannel.disable_local_channels, |
158 |
"Prevent users from joining &channels" |
159 |
}, |
160 |
{ |
161 |
"use_invex", |
162 |
OUTPUT_BOOLEAN_YN, |
163 |
&ConfigChannel.use_invex, |
164 |
"Enable chanmode +I (invite exceptions)" |
165 |
}, |
166 |
{ |
167 |
"use_except", |
168 |
OUTPUT_BOOLEAN_YN, |
169 |
&ConfigChannel.use_except, |
170 |
"Enable chanmode +e (ban exceptions)" |
171 |
}, |
172 |
{ |
173 |
"use_knock", |
174 |
OUTPUT_BOOLEAN_YN, |
175 |
&ConfigChannel.use_knock, |
176 |
"Enable /KNOCK" |
177 |
}, |
178 |
{ |
179 |
"knock_delay", |
180 |
OUTPUT_DECIMAL, |
181 |
&ConfigChannel.knock_delay, |
182 |
"Delay between a users KNOCK attempts" |
183 |
}, |
184 |
{ |
185 |
"knock_delay_channel", |
186 |
OUTPUT_DECIMAL, |
187 |
&ConfigChannel.knock_delay_channel, |
188 |
"Delay between KNOCK attempts to a channel" |
189 |
}, |
190 |
{ |
191 |
"max_chans_per_user", |
192 |
OUTPUT_DECIMAL, |
193 |
&ConfigChannel.max_chans_per_user, |
194 |
"Maximum number of channels a user can join" |
195 |
}, |
196 |
{ |
197 |
"quiet_on_ban", |
198 |
OUTPUT_BOOLEAN_YN, |
199 |
&ConfigChannel.quiet_on_ban, |
200 |
"Banned users may not send text to a channel" |
201 |
}, |
202 |
{ |
203 |
"max_bans", |
204 |
OUTPUT_DECIMAL, |
205 |
&ConfigChannel.max_bans, |
206 |
"Total +b/e/I modes allowed in a channel" |
207 |
}, |
208 |
{ |
209 |
"default_split_user_count", |
210 |
OUTPUT_DECIMAL, |
211 |
&ConfigChannel.default_split_user_count, |
212 |
"Startup value of SPLITUSERS" |
213 |
}, |
214 |
{ |
215 |
"default_split_server_count", |
216 |
OUTPUT_DECIMAL, |
217 |
&ConfigChannel.default_split_server_count, |
218 |
"Startup value of SPLITNUM" |
219 |
}, |
220 |
{ |
221 |
"no_create_on_split", |
222 |
OUTPUT_BOOLEAN_YN, |
223 |
&ConfigChannel.no_create_on_split, |
224 |
"Disallow creation of channels when split" |
225 |
}, |
226 |
{ |
227 |
"no_join_on_split", |
228 |
OUTPUT_BOOLEAN_YN, |
229 |
&ConfigChannel.no_join_on_split, |
230 |
"Disallow joining channels when split" |
231 |
}, |
232 |
{ |
233 |
"burst_topicwho", |
234 |
OUTPUT_BOOLEAN_YN, |
235 |
&ConfigChannel.burst_topicwho, |
236 |
"Enable sending of who set topic on topicburst" |
237 |
}, |
238 |
{ |
239 |
"flatten_links", |
240 |
OUTPUT_BOOLEAN_YN, |
241 |
&ConfigServerHide.flatten_links, |
242 |
"Flatten /links list" |
243 |
}, |
244 |
{ |
245 |
"links_delay", |
246 |
OUTPUT_DECIMAL, |
247 |
&ConfigServerHide.links_delay, |
248 |
"Links rehash delay" |
249 |
}, |
250 |
{ |
251 |
"hidden", |
252 |
OUTPUT_BOOLEAN_YN, |
253 |
&ConfigServerHide.hidden, |
254 |
"Hide this server from a flattened /links on remote servers" |
255 |
}, |
256 |
{ |
257 |
"disable_hidden", |
258 |
OUTPUT_BOOLEAN_YN, |
259 |
&ConfigServerHide.disable_hidden, |
260 |
"Prevent servers from hiding themselves from a flattened /links" |
261 |
}, |
262 |
{ |
263 |
"hide_servers", |
264 |
OUTPUT_BOOLEAN_YN, |
265 |
&ConfigServerHide.hide_servers, |
266 |
"Hide servernames from users" |
267 |
}, |
268 |
{ |
269 |
"hidden_name", |
270 |
OUTPUT_STRING, |
271 |
&ConfigServerHide.hidden_name, |
272 |
"Server name users see if hide_servers = yes" |
273 |
}, |
274 |
{ |
275 |
"hide_server_ips", |
276 |
OUTPUT_BOOLEAN_YN, |
277 |
&ConfigServerHide.hide_server_ips, |
278 |
"Prevent people from seeing server IPs" |
279 |
}, |
280 |
{ |
281 |
"gline_min_cidr", |
282 |
OUTPUT_DECIMAL, |
283 |
&ConfigFileEntry.gline_min_cidr, |
284 |
"Minimum required length of a CIDR bitmask for IPv4 G-Lines" |
285 |
}, |
286 |
{ |
287 |
"gline_min_cidr6", |
288 |
OUTPUT_DECIMAL, |
289 |
&ConfigFileEntry.gline_min_cidr6, |
290 |
"Minimum required length of a CIDR bitmask for IPv6 G-Lines" |
291 |
}, |
292 |
{ |
293 |
"invisible_on_connect", |
294 |
OUTPUT_BOOLEAN_YN, |
295 |
&ConfigFileEntry.invisible_on_connect, |
296 |
"Automatically set mode +i on connecting users" |
297 |
}, |
298 |
{ |
299 |
"burst_away", |
300 |
OUTPUT_BOOLEAN_YN, |
301 |
&ConfigFileEntry.burst_away, |
302 |
"Send /away string that users have set on the server burst" |
303 |
}, |
304 |
{ |
305 |
"use_whois_actually", |
306 |
OUTPUT_BOOLEAN_YN, |
307 |
&ConfigFileEntry.use_whois_actually, |
308 |
"Show IP address on /WHOIS when possible" |
309 |
}, |
310 |
{ |
311 |
"kill_chase_time_limit", |
312 |
OUTPUT_DECIMAL, |
313 |
&ConfigFileEntry.kill_chase_time_limit, |
314 |
"Nick Change Tracker for KILL" |
315 |
}, |
316 |
{ |
317 |
"hide_spoof_ips", |
318 |
OUTPUT_BOOLEAN_YN, |
319 |
&ConfigFileEntry.hide_spoof_ips, |
320 |
"Hide spoofed IP's" |
321 |
}, |
322 |
{ |
323 |
"ignore_bogus_ts", |
324 |
OUTPUT_BOOLEAN_YN, |
325 |
&ConfigFileEntry.ignore_bogus_ts, |
326 |
"Ignore bogus timestamps from other servers" |
327 |
}, |
328 |
{ |
329 |
"disable_auth", |
330 |
OUTPUT_BOOLEAN_YN, |
331 |
&ConfigFileEntry.disable_auth, |
332 |
"Completely disable ident lookups" |
333 |
}, |
334 |
{ |
335 |
"disable_remote_commands", |
336 |
OUTPUT_BOOLEAN_YN, |
337 |
&ConfigFileEntry.disable_remote, |
338 |
"Prevent users issuing commands on remote servers" |
339 |
}, |
340 |
{ |
341 |
"tkline_expire_notices", |
342 |
OUTPUT_BOOLEAN_YN, |
343 |
&ConfigFileEntry.tkline_expire_notices, |
344 |
"Show temporary kline/xline expire notices" |
345 |
}, |
346 |
{ |
347 |
"default_floodcount", |
348 |
OUTPUT_DECIMAL, |
349 |
&ConfigFileEntry.default_floodcount, |
350 |
"Startup value of FLOODCOUNT" |
351 |
}, |
352 |
{ |
353 |
"failed_oper_notice", |
354 |
OUTPUT_BOOLEAN, |
355 |
&ConfigFileEntry.failed_oper_notice, |
356 |
"Inform opers if someone /oper's with the wrong password" |
357 |
}, |
358 |
{ |
359 |
"dots_in_ident", |
360 |
OUTPUT_DECIMAL, |
361 |
&ConfigFileEntry.dots_in_ident, |
362 |
"Number of permissable dots in an ident" |
363 |
}, |
364 |
{ |
365 |
"min_nonwildcard", |
366 |
OUTPUT_DECIMAL, |
367 |
&ConfigFileEntry.min_nonwildcard, |
368 |
"Minimum non-wildcard chars in K/G lines" |
369 |
}, |
370 |
{ |
371 |
"min_nonwildcard_simple", |
372 |
OUTPUT_DECIMAL, |
373 |
&ConfigFileEntry.min_nonwildcard_simple, |
374 |
"Minimum non-wildcards in gecos bans" |
375 |
}, |
376 |
{ |
377 |
"max_accept", |
378 |
OUTPUT_DECIMAL, |
379 |
&ConfigFileEntry.max_accept, |
380 |
"Maximum nicknames on accept list" |
381 |
}, |
382 |
{ |
383 |
"anti_nick_flood", |
384 |
OUTPUT_BOOLEAN, |
385 |
&ConfigFileEntry.anti_nick_flood, |
386 |
"NICK flood protection" |
387 |
}, |
388 |
{ |
389 |
"max_nick_time", |
390 |
OUTPUT_DECIMAL, |
391 |
&ConfigFileEntry.max_nick_time, |
392 |
"NICK flood protection time interval" |
393 |
}, |
394 |
{ |
395 |
"max_nick_changes", |
396 |
OUTPUT_DECIMAL, |
397 |
&ConfigFileEntry.max_nick_changes, |
398 |
"NICK change threshhold setting" |
399 |
}, |
400 |
{ |
401 |
"anti_spam_exit_message_time", |
402 |
OUTPUT_DECIMAL, |
403 |
&ConfigFileEntry.anti_spam_exit_message_time, |
404 |
"Duration a client must be connected for to have an exit message" |
405 |
}, |
406 |
{ |
407 |
"ts_warn_delta", |
408 |
OUTPUT_DECIMAL, |
409 |
&ConfigFileEntry.ts_warn_delta, |
410 |
"Maximum permitted TS delta before displaying a warning" |
411 |
}, |
412 |
{ |
413 |
"ts_max_delta", |
414 |
OUTPUT_DECIMAL, |
415 |
&ConfigFileEntry.ts_max_delta, |
416 |
"Maximum permitted TS delta from another server" |
417 |
}, |
418 |
{ |
419 |
"kline_with_reason", |
420 |
OUTPUT_BOOLEAN_YN, |
421 |
&ConfigFileEntry.kline_with_reason, |
422 |
"Display K-line reason to client on disconnect" |
423 |
}, |
424 |
{ |
425 |
"kline_reason", |
426 |
OUTPUT_STRING, |
427 |
&ConfigFileEntry.kline_reason, |
428 |
"Reason given to K-lined clients on sign off" |
429 |
}, |
430 |
{ |
431 |
"warn_no_nline", |
432 |
OUTPUT_BOOLEAN, |
433 |
&ConfigFileEntry.warn_no_nline, |
434 |
"Display warning if connecting server lacks N-line" |
435 |
}, |
436 |
{ |
437 |
"stats_o_oper_only", |
438 |
OUTPUT_BOOLEAN_YN, |
439 |
&ConfigFileEntry.stats_o_oper_only, |
440 |
"STATS O output is only shown to operators" |
441 |
}, |
442 |
{ |
443 |
"stats_P_oper_only", |
444 |
OUTPUT_BOOLEAN_YN, |
445 |
&ConfigFileEntry.stats_P_oper_only, |
446 |
"STATS P is only shown to operators" |
447 |
}, |
448 |
{ |
449 |
"stats_i_oper_only", |
450 |
OUTPUT_BOOLEAN2, |
451 |
&ConfigFileEntry.stats_i_oper_only, |
452 |
"STATS I output is only shown to operators" |
453 |
}, |
454 |
{ |
455 |
"stats_k_oper_only", |
456 |
OUTPUT_BOOLEAN2, |
457 |
&ConfigFileEntry.stats_k_oper_only, |
458 |
"STATS K output is only shown to operators" |
459 |
}, |
460 |
{ |
461 |
"caller_id_wait", |
462 |
OUTPUT_DECIMAL, |
463 |
&ConfigFileEntry.caller_id_wait, |
464 |
"Minimum delay between notifying UMODE +g users of messages" |
465 |
}, |
466 |
{ |
467 |
"opers_bypass_callerid", |
468 |
OUTPUT_BOOLEAN_YN, |
469 |
&ConfigFileEntry.opers_bypass_callerid, |
470 |
"Allows IRC operators to message users who are +g (callerid)" |
471 |
}, |
472 |
{ |
473 |
"pace_wait_simple", |
474 |
OUTPUT_DECIMAL, |
475 |
&ConfigFileEntry.pace_wait_simple, |
476 |
"Minimum delay between less intensive commands" |
477 |
}, |
478 |
{ |
479 |
"pace_wait", |
480 |
OUTPUT_DECIMAL, |
481 |
&ConfigFileEntry.pace_wait, |
482 |
"Minimum delay between uses of certain commands" |
483 |
}, |
484 |
{ |
485 |
"short_motd", |
486 |
OUTPUT_BOOLEAN_YN, |
487 |
&ConfigFileEntry.short_motd, |
488 |
"Do not show MOTD; only tell clients they should read it" |
489 |
}, |
490 |
{ |
491 |
"ping_cookie", |
492 |
OUTPUT_BOOLEAN, |
493 |
&ConfigFileEntry.ping_cookie, |
494 |
"Require ping cookies to connect" |
495 |
}, |
496 |
{ |
497 |
"no_oper_flood", |
498 |
OUTPUT_BOOLEAN, |
499 |
&ConfigFileEntry.no_oper_flood, |
500 |
"Reduce flood control for operators" |
501 |
}, |
502 |
{ |
503 |
"true_no_oper_flood", |
504 |
OUTPUT_BOOLEAN, |
505 |
&ConfigFileEntry.true_no_oper_flood, |
506 |
"Completely disable flood control for operators" |
507 |
}, |
508 |
{ |
509 |
"oper_pass_resv", |
510 |
OUTPUT_BOOLEAN_YN, |
511 |
&ConfigFileEntry.oper_pass_resv, |
512 |
"Opers can over-ride RESVs" |
513 |
}, |
514 |
{ |
515 |
"max_targets", |
516 |
OUTPUT_DECIMAL, |
517 |
&ConfigFileEntry.max_targets, |
518 |
"The maximum number of PRIVMSG/NOTICE targets" |
519 |
}, |
520 |
{ |
521 |
"client_flood", |
522 |
OUTPUT_DECIMAL, |
523 |
&ConfigFileEntry.client_flood, |
524 |
"Maximum amount of data in a client's queue before they are disconnected" |
525 |
}, |
526 |
{ |
527 |
"throttle_time", |
528 |
OUTPUT_DECIMAL, |
529 |
&ConfigFileEntry.throttle_time, |
530 |
"Minimum time between client reconnects" |
531 |
}, |
532 |
{ |
533 |
"glines", |
534 |
OUTPUT_BOOLEAN, |
535 |
&ConfigFileEntry.glines, |
536 |
"G-line (network-wide K-line) support" |
537 |
}, |
538 |
{ |
539 |
"duration", |
540 |
OUTPUT_DECIMAL, |
541 |
&ConfigFileEntry.gline_time, |
542 |
"Expiry time for G-lines" |
543 |
}, |
544 |
/* --[ END OF TABLE ]---------------------------------------------- */ |
545 |
{ |
546 |
NULL, |
547 |
0, |
548 |
NULL, |
549 |
0 |
550 |
} |
551 |
}; |
552 |
|
553 |
/* |
554 |
** m_info() |
555 |
** parv[0] = sender prefix |
556 |
** parv[1] = servername |
557 |
*/ |
558 |
static void |
559 |
m_info(struct Client *client_p, struct Client *source_p, |
560 |
int parc, char *parv[]) |
561 |
{ |
562 |
static time_t last_used = 0; |
563 |
|
564 |
if ((last_used + ConfigFileEntry.pace_wait) > CurrentTime) |
565 |
{ |
566 |
/* safe enough to give this on a local connect only */ |
567 |
sendto_one(source_p, form_str(RPL_LOAD2HI), |
568 |
me.name, source_p->name); |
569 |
return; |
570 |
} |
571 |
|
572 |
last_used = CurrentTime; |
573 |
|
574 |
if (!ConfigFileEntry.disable_remote) |
575 |
if (hunt_server(client_p,source_p, ":%s INFO :%s", 1, |
576 |
parc, parv) != HUNTED_ISME) |
577 |
return; |
578 |
|
579 |
send_info_text(source_p); |
580 |
} |
581 |
|
582 |
/* |
583 |
** mo_info() |
584 |
** parv[0] = sender prefix |
585 |
** parv[1] = servername |
586 |
*/ |
587 |
static void |
588 |
mo_info(struct Client *client_p, struct Client *source_p, |
589 |
int parc, char *parv[]) |
590 |
{ |
591 |
if (hunt_server(client_p, source_p, ":%s INFO :%s", 1, |
592 |
parc, parv) != HUNTED_ISME) |
593 |
return; |
594 |
|
595 |
send_info_text(source_p); |
596 |
} |
597 |
|
598 |
/* |
599 |
** ms_info() |
600 |
** parv[0] = sender prefix |
601 |
** parv[1] = servername |
602 |
*/ |
603 |
static void |
604 |
ms_info(struct Client *client_p, struct Client *source_p, |
605 |
int parc, char *parv[]) |
606 |
{ |
607 |
if (!IsClient(source_p)) |
608 |
return; |
609 |
|
610 |
if (hunt_server(client_p, source_p, ":%s INFO :%s", 1, |
611 |
parc, parv) != HUNTED_ISME) |
612 |
return; |
613 |
|
614 |
send_info_text(source_p); |
615 |
} |
616 |
|
617 |
/* send_info_text() |
618 |
* |
619 |
* inputs - client pointer to send info text to |
620 |
* output - NONE |
621 |
* side effects - info text is sent to client |
622 |
*/ |
623 |
static void |
624 |
send_info_text(struct Client *source_p) |
625 |
{ |
626 |
const char **text = infotext; |
627 |
char *source, *target; |
628 |
|
629 |
sendto_realops_flags(UMODE_SPY, L_ALL, |
630 |
"INFO requested by %s (%s@%s) [%s]", |
631 |
source_p->name, source_p->username, |
632 |
source_p->host, source_p->servptr->name); |
633 |
|
634 |
if (!MyClient(source_p) && IsCapable(source_p->from, CAP_TS6) && |
635 |
HasID(source_p)) |
636 |
source = me.id, target = source_p->id; |
637 |
else |
638 |
source = me.name, target = source_p->name; |
639 |
|
640 |
while (*text) |
641 |
{ |
642 |
const char *line = *text++; |
643 |
|
644 |
if (*line == '\0') |
645 |
line = " "; |
646 |
|
647 |
sendto_one(source_p, form_str(RPL_INFO), |
648 |
source, target, line); |
649 |
} |
650 |
|
651 |
if (IsOper(source_p)) |
652 |
send_conf_options(source_p); |
653 |
|
654 |
send_birthdate_online_time(source_p); |
655 |
|
656 |
sendto_one(source_p, form_str(RPL_ENDOFINFO), |
657 |
me.name, source_p->name); |
658 |
} |
659 |
|
660 |
/* send_birthdate_online_time() |
661 |
* |
662 |
* inputs - client pointer to send to |
663 |
* output - NONE |
664 |
* side effects - birthdate and online time are sent |
665 |
*/ |
666 |
static void |
667 |
send_birthdate_online_time(struct Client *source_p) |
668 |
{ |
669 |
if (!MyClient(source_p) && IsCapable(source_p->from, CAP_TS6) && HasID(source_p)) |
670 |
{ |
671 |
sendto_one(source_p, ":%s %d %s :On-line since %s", |
672 |
me.id, RPL_INFO, source_p->id, |
673 |
myctime(me.firsttime)); |
674 |
} |
675 |
else |
676 |
{ |
677 |
sendto_one(source_p, ":%s %d %s :On-line since %s", |
678 |
me.name, RPL_INFO, source_p->name, |
679 |
myctime(me.firsttime)); |
680 |
} |
681 |
} |
682 |
|
683 |
/* send_conf_options() |
684 |
* |
685 |
* inputs - client pointer to send to |
686 |
* output - NONE |
687 |
* side effects - send config options to client |
688 |
*/ |
689 |
static void |
690 |
send_conf_options(struct Client *source_p) |
691 |
{ |
692 |
Info *infoptr; |
693 |
const char *from, *to; |
694 |
const struct InfoStruct *iptr = NULL; |
695 |
|
696 |
/* Now send them a list of all our configuration options |
697 |
* (mostly from defaults.h and config.h) |
698 |
*/ |
699 |
if (!MyClient(source_p) && IsCapable(source_p->from, CAP_TS6) && HasID(source_p)) |
700 |
{ |
701 |
from = me.id; |
702 |
to = source_p->id; |
703 |
} |
704 |
else |
705 |
{ |
706 |
from = me.name; |
707 |
to = source_p->name; |
708 |
} |
709 |
|
710 |
for (infoptr = MyInformation; infoptr->name; infoptr++) |
711 |
{ |
712 |
if (infoptr->intvalue) |
713 |
{ |
714 |
sendto_one(source_p, ":%s %d %s :%-30s %-5d [%-30s]", |
715 |
from, RPL_INFO, to, infoptr->name, |
716 |
infoptr->intvalue, infoptr->desc); |
717 |
} |
718 |
else |
719 |
{ |
720 |
sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]", |
721 |
from, RPL_INFO, to, infoptr->name, |
722 |
infoptr->strvalue, infoptr->desc); |
723 |
} |
724 |
} |
725 |
|
726 |
/* |
727 |
* Parse the info_table[] and do the magic. |
728 |
*/ |
729 |
for (iptr = info_table; iptr->name; ++iptr) |
730 |
{ |
731 |
switch (iptr->output_type) |
732 |
{ |
733 |
/* For "char *" references */ |
734 |
case OUTPUT_STRING: |
735 |
{ |
736 |
const char *option = *((char **)iptr->option); |
737 |
|
738 |
sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]", |
739 |
from, RPL_INFO, to, |
740 |
iptr->name, option ? option : "NONE", |
741 |
iptr->desc ? iptr->desc : "<none>"); |
742 |
break; |
743 |
} |
744 |
|
745 |
/* For "char foo[]" references */ |
746 |
case OUTPUT_STRING_PTR: |
747 |
{ |
748 |
const char *option = iptr->option; |
749 |
|
750 |
sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]", |
751 |
from, RPL_INFO, to, |
752 |
iptr->name, option ? option : "NONE", |
753 |
iptr->desc ? iptr->desc : "<none>"); |
754 |
break; |
755 |
} |
756 |
|
757 |
/* Output info_table[i].option as a decimal value. */ |
758 |
case OUTPUT_DECIMAL: |
759 |
{ |
760 |
const int option = *((int *)iptr->option); |
761 |
|
762 |
sendto_one(source_p, ":%s %d %s :%-30s %-5d [%-30s]", |
763 |
from, RPL_INFO, to, iptr->name, |
764 |
option, iptr->desc ? iptr->desc : "<none>"); |
765 |
break; |
766 |
} |
767 |
|
768 |
/* Output info_table[i].option as "ON" or "OFF" */ |
769 |
case OUTPUT_BOOLEAN: |
770 |
{ |
771 |
const int option = *((int *)iptr->option); |
772 |
|
773 |
sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]", |
774 |
from, RPL_INFO, to, |
775 |
iptr->name, option ? "ON" : "OFF", |
776 |
iptr->desc ? iptr->desc : "<none>"); |
777 |
|
778 |
break; |
779 |
} |
780 |
|
781 |
/* Output info_table[i].option as "YES" or "NO" */ |
782 |
case OUTPUT_BOOLEAN_YN: |
783 |
{ |
784 |
int option = *((int *)iptr->option); |
785 |
|
786 |
sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]", |
787 |
from, RPL_INFO, to, |
788 |
iptr->name, option ? "YES" : "NO", |
789 |
iptr->desc ? iptr->desc : "<none>"); |
790 |
break; |
791 |
} |
792 |
|
793 |
case OUTPUT_BOOLEAN2: |
794 |
{ |
795 |
int option = *((int *)iptr->option); |
796 |
|
797 |
sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]", |
798 |
from, RPL_INFO, to, |
799 |
iptr->name, option ? ((option == 1) ? "MASK" : "YES") : "NO", |
800 |
iptr->desc ? iptr->desc : "<none>"); |
801 |
break; |
802 |
} |
803 |
} |
804 |
} |
805 |
|
806 |
/* Don't send oper_only_umodes...it's a bit mask, we will have to decode it |
807 |
* in order for it to show up properly to opers who issue INFO |
808 |
*/ |
809 |
#ifndef EFNET |
810 |
/* jdc -- Only send compile information to admins. */ |
811 |
if (IsAdmin(source_p)) |
812 |
sendto_one(source_p, ":%s %d %s :Running on [%s]", |
813 |
from, RPL_INFO, to, ircd_platform); |
814 |
#endif |
815 |
sendto_one(source_p, form_str(RPL_INFO), |
816 |
from, to, ""); |
817 |
} |