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 "list.h" |
27 |
– |
#include "m_info.h" |
29 |
|
#include "channel.h" |
30 |
|
#include "client.h" |
30 |
– |
#include "common.h" |
31 |
|
#include "irc_string.h" |
32 |
|
#include "ircd.h" |
33 |
– |
#include "hook.h" |
33 |
|
#include "numeric.h" |
35 |
– |
#include "s_log.h" |
34 |
|
#include "s_serv.h" |
35 |
|
#include "s_user.h" |
36 |
|
#include "send.h" |
37 |
< |
#include "s_conf.h" |
40 |
< |
#include "handlers.h" |
41 |
< |
#include "msg.h" |
37 |
> |
#include "conf.h" |
38 |
|
#include "parse.h" |
39 |
|
#include "modules.h" |
40 |
|
|
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, MAXPARA, 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 |
– |
} |
41 |
|
|
42 |
|
/* |
43 |
|
* jdc -- Structure for our configuration value table |
51 |
|
}; |
52 |
|
|
53 |
|
/* Types for output_type in InfoStruct */ |
54 |
< |
#define OUTPUT_STRING 0x0001 /* Output option as %s w/ dereference */ |
55 |
< |
#define OUTPUT_STRING_PTR 0x0002 /* Output option as %s w/out deference */ |
56 |
< |
#define OUTPUT_DECIMAL 0x0004 /* Output option as decimal (%d) */ |
57 |
< |
#define OUTPUT_BOOLEAN 0x0008 /* Output option as "ON" or "OFF" */ |
58 |
< |
#define OUTPUT_BOOLEAN_YN 0x0010 /* Output option as "YES" or "NO" */ |
59 |
< |
#define OUTPUT_BOOLEAN2 0x0020 /* Output option as "YES/NO/MASKED" */ |
54 |
> |
#define OUTPUT_STRING 0x0001 /* Output option as %s w/ dereference */ |
55 |
> |
#define OUTPUT_STRING_PTR 0x0002 /* Output option as %s w/out deference */ |
56 |
> |
#define OUTPUT_DECIMAL 0x0004 /* Output option as decimal (%d) */ |
57 |
> |
#define OUTPUT_BOOLEAN 0x0008 /* Output option as "ON" or "OFF" */ |
58 |
> |
#define OUTPUT_BOOLEAN_YN 0x0010 /* Output option as "YES" or "NO" */ |
59 |
> |
#define OUTPUT_BOOLEAN2 0x0020 /* Output option as "YES/NO/MASKED" */ |
60 |
|
|
61 |
|
static const struct InfoStruct info_table[] = |
62 |
|
{ |
63 |
|
/* --[ START OF TABLE ]-------------------------------------------- */ |
64 |
+ |
|
65 |
|
{ |
66 |
< |
"network_name", |
66 |
> |
"CPATH", |
67 |
|
OUTPUT_STRING, |
68 |
< |
&ServerInfo.network_name, |
69 |
< |
"Network name" |
68 |
> |
&ConfigFileEntry.configfile, |
69 |
> |
"Path to main configuration file" |
70 |
|
}, |
71 |
|
{ |
72 |
< |
"network_desc", |
72 |
> |
"DPATH", |
73 |
|
OUTPUT_STRING, |
74 |
< |
&ServerInfo.network_desc, |
75 |
< |
"Network description" |
74 |
> |
&ConfigFileEntry.dpath, |
75 |
> |
"Root directory of installation" |
76 |
|
}, |
77 |
|
{ |
78 |
< |
"hub", |
79 |
< |
OUTPUT_BOOLEAN_YN, |
80 |
< |
&ServerInfo.hub, |
81 |
< |
"Server is a hub" |
78 |
> |
"DLPATH", |
79 |
> |
OUTPUT_STRING, |
80 |
> |
&ConfigFileEntry.dlinefile, |
81 |
> |
"Path to D-line database file" |
82 |
|
}, |
83 |
|
{ |
84 |
< |
"use_logging", |
85 |
< |
OUTPUT_BOOLEAN_YN, |
86 |
< |
&ConfigLoggingEntry.use_logging, |
87 |
< |
"Enable logging" |
84 |
> |
"KPATH", |
85 |
> |
OUTPUT_STRING, |
86 |
> |
&ConfigFileEntry.klinefile, |
87 |
> |
"Path to K-line database file" |
88 |
|
}, |
89 |
|
{ |
90 |
< |
"fuserlog", |
91 |
< |
OUTPUT_STRING_PTR, |
92 |
< |
&ConfigLoggingEntry.userlog, |
93 |
< |
"User log file" |
90 |
> |
"GPATH", |
91 |
> |
OUTPUT_STRING, |
92 |
> |
&ConfigFileEntry.glinefile, |
93 |
> |
"Path to G-line database file" |
94 |
|
}, |
95 |
|
{ |
96 |
< |
"foperlog", |
97 |
< |
OUTPUT_STRING_PTR, |
98 |
< |
&ConfigLoggingEntry.operlog, |
99 |
< |
"Operator log file" |
96 |
> |
"XPATH", |
97 |
> |
OUTPUT_STRING, |
98 |
> |
&ConfigFileEntry.xlinefile, |
99 |
> |
"Path to X-line database file" |
100 |
|
}, |
101 |
|
{ |
102 |
< |
"fkilllog", |
103 |
< |
OUTPUT_STRING_PTR, |
104 |
< |
&ConfigLoggingEntry.killlog, |
105 |
< |
"Kill log file" |
102 |
> |
"RESVPATH", |
103 |
> |
OUTPUT_STRING, |
104 |
> |
&ConfigFileEntry.resvfile, |
105 |
> |
"Path to resv database file" |
106 |
|
}, |
107 |
|
{ |
108 |
< |
"fklinelog", |
109 |
< |
OUTPUT_STRING_PTR, |
110 |
< |
&ConfigLoggingEntry.klinelog, |
111 |
< |
"K-Line log file" |
108 |
> |
"network_name", |
109 |
> |
OUTPUT_STRING, |
110 |
> |
&ServerInfo.network_name, |
111 |
> |
"Network name" |
112 |
|
}, |
113 |
|
{ |
114 |
< |
"fglinelog", |
115 |
< |
OUTPUT_STRING_PTR, |
116 |
< |
&ConfigLoggingEntry.glinelog, |
117 |
< |
"G-Line log file" |
114 |
> |
"network_desc", |
115 |
> |
OUTPUT_STRING, |
116 |
> |
&ServerInfo.network_desc, |
117 |
> |
"Network description" |
118 |
|
}, |
119 |
|
{ |
120 |
< |
"restrict_channels", |
120 |
> |
"hub", |
121 |
|
OUTPUT_BOOLEAN_YN, |
122 |
< |
&ConfigChannel.restrict_channels, |
123 |
< |
"Only reserved channels are allowed" |
122 |
> |
&ServerInfo.hub, |
123 |
> |
"Server is a hub" |
124 |
|
}, |
125 |
|
{ |
126 |
< |
"disable_local_channels", |
127 |
< |
OUTPUT_BOOLEAN_YN, |
128 |
< |
&ConfigChannel.disable_local_channels, |
129 |
< |
"Prevent users from joining &channels" |
126 |
> |
"max_clients", |
127 |
> |
OUTPUT_DECIMAL, |
128 |
> |
&ServerInfo.max_clients, |
129 |
> |
"Maximum number of clients permitted simultaneously on this server" |
130 |
|
}, |
131 |
< |
{ |
132 |
< |
"use_invex", |
133 |
< |
OUTPUT_BOOLEAN_YN, |
134 |
< |
&ConfigChannel.use_invex, |
135 |
< |
"Enable chanmode +I (invite exceptions)" |
131 |
> |
{ |
132 |
> |
"max_nick_length", |
133 |
> |
OUTPUT_DECIMAL, |
134 |
> |
&ServerInfo.max_nick_length, |
135 |
> |
"Maximum nickname length" |
136 |
|
}, |
137 |
|
{ |
138 |
< |
"use_except", |
138 |
> |
"max_topic_length", |
139 |
> |
OUTPUT_DECIMAL, |
140 |
> |
&ServerInfo.max_topic_length, |
141 |
> |
"Maximum topic length" |
142 |
> |
}, |
143 |
> |
{ |
144 |
> |
"use_logging", |
145 |
|
OUTPUT_BOOLEAN_YN, |
146 |
< |
&ConfigChannel.use_except, |
147 |
< |
"Enable chanmode +e (ban exceptions)" |
146 |
> |
&ConfigLoggingEntry.use_logging, |
147 |
> |
"Enable logging" |
148 |
|
}, |
149 |
|
{ |
150 |
< |
"use_knock", |
150 |
> |
"disable_fake_channels", |
151 |
|
OUTPUT_BOOLEAN_YN, |
152 |
< |
&ConfigChannel.use_knock, |
153 |
< |
"Enable /KNOCK" |
152 |
> |
&ConfigChannel.disable_fake_channels, |
153 |
> |
"Forbids channels with special ASCII characters in their name" |
154 |
|
}, |
155 |
|
{ |
156 |
|
"knock_delay", |
171 |
|
"Maximum number of channels a user can join" |
172 |
|
}, |
173 |
|
{ |
174 |
< |
"quiet_on_ban", |
175 |
< |
OUTPUT_BOOLEAN_YN, |
176 |
< |
&ConfigChannel.quiet_on_ban, |
177 |
< |
"Banned users may not send text to a channel" |
174 |
> |
"max_chans_per_oper", |
175 |
> |
OUTPUT_DECIMAL, |
176 |
> |
&ConfigChannel.max_chans_per_oper, |
177 |
> |
"Maximum number of channels an oper can join" |
178 |
|
}, |
179 |
|
{ |
180 |
|
"max_bans", |
207 |
|
"Disallow joining channels when split" |
208 |
|
}, |
209 |
|
{ |
233 |
– |
"burst_topicwho", |
234 |
– |
OUTPUT_BOOLEAN_YN, |
235 |
– |
&ConfigChannel.burst_topicwho, |
236 |
– |
"Enable sending of who set topic on topicburst" |
237 |
– |
}, |
238 |
– |
{ |
210 |
|
"flatten_links", |
211 |
|
OUTPUT_BOOLEAN_YN, |
212 |
|
&ConfigServerHide.flatten_links, |
225 |
|
"Hide this server from a flattened /links on remote servers" |
226 |
|
}, |
227 |
|
{ |
257 |
– |
"disable_hidden", |
258 |
– |
OUTPUT_BOOLEAN_YN, |
259 |
– |
&ConfigServerHide.disable_hidden, |
260 |
– |
"Prevent servers from hiding themselves from a flattened /links" |
261 |
– |
}, |
262 |
– |
{ |
228 |
|
"hide_servers", |
229 |
|
OUTPUT_BOOLEAN_YN, |
230 |
|
&ConfigServerHide.hide_servers, |
231 |
|
"Hide servernames from users" |
232 |
|
}, |
233 |
|
{ |
234 |
+ |
"hide_services", |
235 |
+ |
OUTPUT_BOOLEAN_YN, |
236 |
+ |
&ConfigServerHide.hide_services, |
237 |
+ |
"Hides the location of services server" |
238 |
+ |
}, |
239 |
+ |
{ |
240 |
|
"hidden_name", |
241 |
|
OUTPUT_STRING, |
242 |
|
&ConfigServerHide.hidden_name, |
246 |
|
"hide_server_ips", |
247 |
|
OUTPUT_BOOLEAN_YN, |
248 |
|
&ConfigServerHide.hide_server_ips, |
249 |
< |
"Prevent people from seeing server IPs" |
249 |
> |
"Prevent people from seeing server IP addresses" |
250 |
|
}, |
251 |
|
{ |
252 |
|
"gline_min_cidr", |
267 |
|
"Automatically set mode +i on connecting users" |
268 |
|
}, |
269 |
|
{ |
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 |
– |
{ |
270 |
|
"kill_chase_time_limit", |
271 |
|
OUTPUT_DECIMAL, |
272 |
|
&ConfigFileEntry.kill_chase_time_limit, |
276 |
|
"hide_spoof_ips", |
277 |
|
OUTPUT_BOOLEAN_YN, |
278 |
|
&ConfigFileEntry.hide_spoof_ips, |
279 |
< |
"Hide spoofed IP's" |
279 |
> |
"Hide spoofed IP addresses" |
280 |
|
}, |
281 |
|
{ |
282 |
|
"ignore_bogus_ts", |
285 |
|
"Ignore bogus timestamps from other servers" |
286 |
|
}, |
287 |
|
{ |
288 |
+ |
"cycle_on_host_change", |
289 |
+ |
OUTPUT_BOOLEAN_YN, |
290 |
+ |
&ConfigFileEntry.cycle_on_host_change, |
291 |
+ |
"Send a fake QUIT/JOIN combination on host change" |
292 |
+ |
}, |
293 |
+ |
{ |
294 |
|
"disable_auth", |
295 |
|
OUTPUT_BOOLEAN_YN, |
296 |
|
&ConfigFileEntry.disable_auth, |
299 |
|
{ |
300 |
|
"disable_remote_commands", |
301 |
|
OUTPUT_BOOLEAN_YN, |
302 |
< |
&ConfigFileEntry.disable_remote, |
302 |
> |
&ConfigServerHide.disable_remote_commands, |
303 |
|
"Prevent users issuing commands on remote servers" |
304 |
|
}, |
305 |
|
{ |
318 |
|
"failed_oper_notice", |
319 |
|
OUTPUT_BOOLEAN, |
320 |
|
&ConfigFileEntry.failed_oper_notice, |
321 |
< |
"Inform opers if someone /oper's with the wrong password" |
321 |
> |
"Inform opers if someone tries to /oper with the wrong password" |
322 |
|
}, |
323 |
|
{ |
324 |
|
"dots_in_ident", |
381 |
|
"Maximum permitted TS delta from another server" |
382 |
|
}, |
383 |
|
{ |
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 |
– |
{ |
384 |
|
"warn_no_nline", |
385 |
|
OUTPUT_BOOLEAN, |
386 |
|
&ConfigFileEntry.warn_no_nline, |
387 |
|
"Display warning if connecting server lacks N-line" |
388 |
|
}, |
389 |
|
{ |
390 |
+ |
"stats_e_disabled", |
391 |
+ |
OUTPUT_BOOLEAN_YN, |
392 |
+ |
&ConfigFileEntry.stats_e_disabled, |
393 |
+ |
"Whether or not STATS e is disabled" |
394 |
+ |
}, |
395 |
+ |
{ |
396 |
|
"stats_o_oper_only", |
397 |
|
OUTPUT_BOOLEAN_YN, |
398 |
|
&ConfigFileEntry.stats_o_oper_only, |
405 |
|
"STATS P is only shown to operators" |
406 |
|
}, |
407 |
|
{ |
408 |
+ |
"stats_u_oper_only", |
409 |
+ |
OUTPUT_BOOLEAN_YN, |
410 |
+ |
&ConfigFileEntry.stats_u_oper_only, |
411 |
+ |
"STATS u is only shown to operators" |
412 |
+ |
}, |
413 |
+ |
{ |
414 |
|
"stats_i_oper_only", |
415 |
|
OUTPUT_BOOLEAN2, |
416 |
|
&ConfigFileEntry.stats_i_oper_only, |
483 |
|
"The maximum number of PRIVMSG/NOTICE targets" |
484 |
|
}, |
485 |
|
{ |
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 |
– |
{ |
486 |
|
"throttle_time", |
487 |
|
OUTPUT_DECIMAL, |
488 |
|
&ConfigFileEntry.throttle_time, |
495 |
|
"G-line (network-wide K-line) support" |
496 |
|
}, |
497 |
|
{ |
498 |
< |
"duration", |
498 |
> |
"gline_duration", |
499 |
|
OUTPUT_DECIMAL, |
500 |
|
&ConfigFileEntry.gline_time, |
501 |
|
"Expiry time for G-lines" |
502 |
|
}, |
503 |
+ |
{ |
504 |
+ |
"gline_request_duration", |
505 |
+ |
OUTPUT_DECIMAL, |
506 |
+ |
&ConfigFileEntry.gline_request_time, |
507 |
+ |
"Expiry time for pending G-lines" |
508 |
+ |
}, |
509 |
+ |
|
510 |
|
/* --[ END OF TABLE ]---------------------------------------------- */ |
511 |
|
{ |
512 |
|
NULL, |
516 |
|
} |
517 |
|
}; |
518 |
|
|
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 |
– |
|
519 |
|
/* send_birthdate_online_time() |
520 |
|
* |
521 |
|
* inputs - client pointer to send to |
526 |
|
send_birthdate_online_time(struct Client *source_p) |
527 |
|
{ |
528 |
|
if (!MyClient(source_p) && IsCapable(source_p->from, CAP_TS6) && HasID(source_p)) |
670 |
– |
{ |
529 |
|
sendto_one(source_p, ":%s %d %s :On-line since %s", |
530 |
|
me.id, RPL_INFO, source_p->id, |
531 |
< |
myctime(me.firsttime)); |
674 |
< |
} |
531 |
> |
myctime(me.localClient->firsttime)); |
532 |
|
else |
676 |
– |
{ |
533 |
|
sendto_one(source_p, ":%s %d %s :On-line since %s", |
534 |
|
me.name, RPL_INFO, source_p->name, |
535 |
< |
myctime(me.firsttime)); |
680 |
< |
} |
535 |
> |
myctime(me.localClient->firsttime)); |
536 |
|
} |
537 |
|
|
538 |
|
/* send_conf_options() |
544 |
|
static void |
545 |
|
send_conf_options(struct Client *source_p) |
546 |
|
{ |
692 |
– |
Info *infoptr; |
547 |
|
const char *from, *to; |
548 |
|
const struct InfoStruct *iptr = NULL; |
549 |
|
|
561 |
|
to = source_p->name; |
562 |
|
} |
563 |
|
|
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 |
– |
|
564 |
|
/* |
565 |
|
* Parse the info_table[] and do the magic. |
566 |
|
*/ |
619 |
|
/* Output info_table[i].option as "YES" or "NO" */ |
620 |
|
case OUTPUT_BOOLEAN_YN: |
621 |
|
{ |
622 |
< |
int option = *((int *)iptr->option); |
622 |
> |
const int option = *((int *)iptr->option); |
623 |
|
|
624 |
|
sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]", |
625 |
|
from, RPL_INFO, to, |
630 |
|
|
631 |
|
case OUTPUT_BOOLEAN2: |
632 |
|
{ |
633 |
< |
int option = *((int *)iptr->option); |
633 |
> |
const int option = *((int *)iptr->option); |
634 |
|
|
635 |
|
sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]", |
636 |
|
from, RPL_INFO, to, |
641 |
|
} |
642 |
|
} |
643 |
|
|
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 |
644 |
|
sendto_one(source_p, form_str(RPL_INFO), |
645 |
|
from, to, ""); |
646 |
|
} |
647 |
+ |
|
648 |
+ |
/* send_info_text() |
649 |
+ |
* |
650 |
+ |
* inputs - client pointer to send info text to |
651 |
+ |
* output - NONE |
652 |
+ |
* side effects - info text is sent to client |
653 |
+ |
*/ |
654 |
+ |
static int |
655 |
+ |
send_info_text(struct Client *source_p) |
656 |
+ |
{ |
657 |
+ |
const char **text = infotext; |
658 |
+ |
char *source, *target; |
659 |
+ |
|
660 |
+ |
sendto_realops_flags(UMODE_SPY, L_ALL, SEND_NOTICE, |
661 |
+ |
"INFO requested by %s (%s@%s) [%s]", |
662 |
+ |
source_p->name, source_p->username, |
663 |
+ |
source_p->host, source_p->servptr->name); |
664 |
+ |
|
665 |
+ |
if (!MyClient(source_p) && IsCapable(source_p->from, CAP_TS6) && |
666 |
+ |
HasID(source_p)) |
667 |
+ |
source = me.id, target = source_p->id; |
668 |
+ |
else |
669 |
+ |
source = me.name, target = source_p->name; |
670 |
+ |
|
671 |
+ |
while (*text) |
672 |
+ |
{ |
673 |
+ |
const char *line = *text++; |
674 |
+ |
|
675 |
+ |
if (*line == '\0') |
676 |
+ |
line = " "; |
677 |
+ |
|
678 |
+ |
sendto_one(source_p, form_str(RPL_INFO), |
679 |
+ |
source, target, line); |
680 |
+ |
} |
681 |
+ |
|
682 |
+ |
if (HasUMode(source_p, UMODE_OPER)) |
683 |
+ |
send_conf_options(source_p); |
684 |
+ |
|
685 |
+ |
send_birthdate_online_time(source_p); |
686 |
+ |
|
687 |
+ |
sendto_one(source_p, form_str(RPL_ENDOFINFO), |
688 |
+ |
me.name, source_p->name); |
689 |
+ |
return 0; |
690 |
+ |
} |
691 |
+ |
|
692 |
+ |
/* |
693 |
+ |
** m_info() |
694 |
+ |
** parv[0] = sender prefix |
695 |
+ |
** parv[1] = servername |
696 |
+ |
*/ |
697 |
+ |
static int |
698 |
+ |
m_info(struct Client *client_p, struct Client *source_p, |
699 |
+ |
int parc, char *parv[]) |
700 |
+ |
{ |
701 |
+ |
static time_t last_used = 0; |
702 |
+ |
|
703 |
+ |
if ((last_used + ConfigFileEntry.pace_wait) > CurrentTime) |
704 |
+ |
{ |
705 |
+ |
/* safe enough to give this on a local connect only */ |
706 |
+ |
sendto_one(source_p, form_str(RPL_LOAD2HI), |
707 |
+ |
me.name, source_p->name); |
708 |
+ |
return 0; |
709 |
+ |
} |
710 |
+ |
|
711 |
+ |
last_used = CurrentTime; |
712 |
+ |
|
713 |
+ |
if (!ConfigServerHide.disable_remote_commands) |
714 |
+ |
if (hunt_server(client_p,source_p, ":%s INFO :%s", 1, |
715 |
+ |
parc, parv) != HUNTED_ISME) |
716 |
+ |
return 0; |
717 |
+ |
|
718 |
+ |
return send_info_text(source_p); |
719 |
+ |
} |
720 |
+ |
|
721 |
+ |
/* |
722 |
+ |
** ms_info() |
723 |
+ |
** parv[0] = sender prefix |
724 |
+ |
** parv[1] = servername |
725 |
+ |
*/ |
726 |
+ |
static int |
727 |
+ |
ms_info(struct Client *client_p, struct Client *source_p, |
728 |
+ |
int parc, char *parv[]) |
729 |
+ |
{ |
730 |
+ |
if (hunt_server(client_p, source_p, ":%s INFO :%s", 1, |
731 |
+ |
parc, parv) != HUNTED_ISME) |
732 |
+ |
return 0; |
733 |
+ |
|
734 |
+ |
return send_info_text(source_p); |
735 |
+ |
} |
736 |
+ |
|
737 |
+ |
static struct Message info_msgtab = |
738 |
+ |
{ |
739 |
+ |
"INFO", 0, 0, 0, MAXPARA, MFLG_SLOW, 0, |
740 |
+ |
{ m_unregistered, m_info, ms_info, m_ignore, ms_info, m_ignore } |
741 |
+ |
}; |
742 |
+ |
|
743 |
+ |
static void |
744 |
+ |
module_init(void) |
745 |
+ |
{ |
746 |
+ |
mod_add_cmd(&info_msgtab); |
747 |
+ |
} |
748 |
+ |
|
749 |
+ |
static void |
750 |
+ |
module_exit(void) |
751 |
+ |
{ |
752 |
+ |
mod_del_cmd(&info_msgtab); |
753 |
+ |
} |
754 |
+ |
|
755 |
+ |
struct module module_entry = |
756 |
+ |
{ |
757 |
+ |
.node = { NULL, NULL, NULL }, |
758 |
+ |
.name = NULL, |
759 |
+ |
.version = "$Revision$", |
760 |
+ |
.handle = NULL, |
761 |
+ |
.modinit = module_init, |
762 |
+ |
.modexit = module_exit, |
763 |
+ |
.flags = 0 |
764 |
+ |
}; |