mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-06-30 05:16:39 +02:00
Added a new stats system
This commit is contained in:
@@ -2306,3 +2306,9 @@ seen. gmtime warning still there
|
||||
- minor m_kick tweak.
|
||||
- Fixed bug in /silence regarding cloaked hosts, reported by kuwatog (#0001157).
|
||||
- Fixed a problem with a Sleep call on win32
|
||||
- Rewrote the /stats system. The new system allows for long flags for example
|
||||
/stats gline to list glines rather than just /stats G (old flags are still
|
||||
supported). Additionally, for glines an extended syntax is now supported allowing
|
||||
more refined searches. /stats G +m *@*.aol.com lists only glines that match that
|
||||
mask. For more info do /stats ?.
|
||||
- Added stats flags for except throttle and ban version blocks
|
||||
|
||||
+49
-33
@@ -21,7 +21,7 @@
|
||||
<font size="4"><a href="http://www.unrealircd.com">http://www.unrealircd.com</a></font><br>
|
||||
<font size="4">Version: 3.2</font><br>
|
||||
<b>Current Version:</b> 3.2 Beta17<br>
|
||||
<b>Last doc update:</b> 2003-07-28</div>
|
||||
<b>Last doc update:</b> 2003-08-01</div>
|
||||
<b>Head Coders:</b> Stskeeps / codemastr / Luke / McSkaf / Syzop<br>
|
||||
<b>Contributors:</b> Zogg / NiQuiL / assyrian / chasm / DrBin / llthangel / Griever / nighthawk<br>
|
||||
<b>Documentation:</b> CKnight^ / Syzop<br>
|
||||
@@ -1647,7 +1647,11 @@ set {
|
||||
<p><font class="set">set::oper-only-stats <stats-list>;</font><br>
|
||||
Specifies a list of stats flags with no seperators that defines stats flags
|
||||
only opers can use. Leave this value out to allow users to use all flags, or
|
||||
specify * for users to be able to use no flags.</p>
|
||||
specify * for users to be able to use no flags. Only short operflags may be specifed
|
||||
here.</p>
|
||||
<p><font class="set">set::oper-only-stats {<stats-flag>; <stats-flag>;};</font><br>
|
||||
Specifies a list of stats flags that can only be used by opers. This only works with long
|
||||
stats flags.</p>
|
||||
<p><font class="set">set::maxchannelsperuser <amount-of-channels>;</font><br>
|
||||
Specifies the number of channels a single user may be in at any one time.</p>
|
||||
<p><font class="set">set::channel-command-prefix <command-prefixes>;</font><br>
|
||||
@@ -2053,7 +2057,7 @@ set {
|
||||
<p>NOTE: the /helpop documentation is more up to date, use <i>/helpop command</i> (or <i>/helpop ?command</i> if you are oper)
|
||||
to get more information on a command.</p>
|
||||
|
||||
<table width="75%" border="1">
|
||||
<table width="90%" border="1">
|
||||
<tr>
|
||||
<td width="33%"><div align="center"><b>Command</b></div></td>
|
||||
<td width="57%"><div align="center"><b>Description</b></div></td>
|
||||
@@ -2528,36 +2532,48 @@ to get more information on a command.</p>
|
||||
</tr>
|
||||
<tr>
|
||||
<td height="36">stats <option><br></td>
|
||||
<td>b - Send the badwords list<br>
|
||||
C - Send the link block list<br>
|
||||
d - Send the deny link (auto) block list<br>
|
||||
D - Send the deny link (all) block list<br>
|
||||
e - Send the except socks block list<br>
|
||||
E - Send the except ban block list<br>
|
||||
F - Send the deny dcc block list<br>
|
||||
G - Report TKL information (G:lines/Shuns)<br>
|
||||
H - Send the link block list<br>
|
||||
I - Send the allow block list<br>
|
||||
K - Send the ban user/ban ip/except ban block list (Includes AKILLs)<br>
|
||||
L - Send Link information<br>
|
||||
m - Send the events list<br>
|
||||
M - Send list of how many times each command was used<br>
|
||||
n - Send the ban realname block list<br>
|
||||
N - Send network configuration list<br>
|
||||
O - Send the oper block list<br>
|
||||
q - Send the SQLINE list<br>
|
||||
Q - Send the ban nick block list<br>
|
||||
r - Send the channel deny/allow block list<br>
|
||||
s - Send the SCache and NS list<br>
|
||||
S - Send the dynamic configuration list<br>
|
||||
t - Send the tld block list<br>
|
||||
T - Send connection information<br>
|
||||
u - Send server uptime and connection count<br>
|
||||
U - Send the ulines block list<br>
|
||||
v - Send the deny version block list<br>
|
||||
V - Send the vhost block list<br>
|
||||
y - Send the class block list<br>
|
||||
Z - Send memory usage information</td>
|
||||
<td>
|
||||
B - banversion - Send the ban version list<br>
|
||||
b - badword - Send the badwords list<br>
|
||||
C - link - Send the link block list<br>
|
||||
d - denylinkauto - Send the deny link (auto) block list<br>
|
||||
D - denylinkall - Send the deny link (all) block list<br>
|
||||
e - excepthrottle - Send the except trottle block list<br>
|
||||
E - exceptban - Send the except ban block list<br>
|
||||
F - denydcc - Send the deny dcc block list<br>
|
||||
G - gline - Send the gline list<br>
|
||||
Extended flags: [+/-mrs] [mask] [reason] [setby]<br>
|
||||
m Return glines matching/not matching the specified mask<br>
|
||||
r Return glines with a reason matching/not matching the specified reason<br>
|
||||
s Return glines set by/not set by clients matching the specified name<br>
|
||||
I - allow - Send the allow block list<br>
|
||||
K - kline - Send the ban user/ban ip/except ban block list<br>
|
||||
l - linkinfo - Send link information<br>
|
||||
L - linkinfoall - Send all link information<br>
|
||||
M - command - Send list of how many times each command was used<br>
|
||||
n - banrealname - Send the ban realname block list<br>
|
||||
O - oper - Send the oper block list<br>
|
||||
S - set - Send the set block list<br>
|
||||
s - shun - Send the shun list<br>
|
||||
S - set - Send the set block list<br>
|
||||
Extended flags: [+/-mrs] [mask] [reason] [setby]<br>
|
||||
m Return shuns matching/not matching the specified mask<br>
|
||||
r Return shuns with a reason matching/not matching the specified reason<br>
|
||||
s Return shuns set by/not set by clients matching the specified name<br>
|
||||
P - port - Send information about ports<br>
|
||||
q - sqline - Send the SQLINE list<br>
|
||||
Q - bannick - Send the ban nick block list<br>
|
||||
r - chanrestrict - Send the channel deny/allow block list<br>
|
||||
t - tld - Send the tld block list<br>
|
||||
T - traffic - Send traffic information<br>
|
||||
u - uptime - Send the server uptime and connection count<br>
|
||||
U - uline - Send the ulines block list<br>
|
||||
v - Send the deny version block list<br>
|
||||
V - Send the vhost block list<br>
|
||||
X - notlink - Send the list of servers that are not current linked<br>
|
||||
Y - class - Send the class block list<br>
|
||||
Z - mem - Send memory usage information<br>
|
||||
</td>
|
||||
<td>All</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -57,6 +57,11 @@ struct ChMode {
|
||||
unsigned char kmode;
|
||||
};
|
||||
|
||||
typedef struct _OperStat {
|
||||
struct _OperStat *prev, *next;
|
||||
char *flag;
|
||||
} OperStat;
|
||||
|
||||
typedef struct zConfiguration aConfiguration;
|
||||
struct zConfiguration {
|
||||
unsigned som:1;
|
||||
@@ -86,6 +91,7 @@ struct zConfiguration {
|
||||
char *auto_join_chans;
|
||||
char *oper_auto_join_chans;
|
||||
char *oper_only_stats;
|
||||
OperStat *oper_only_stats_ext;
|
||||
int maxchannelsperuser;
|
||||
int anti_spam_quit_message_time;
|
||||
char *egd_path;
|
||||
|
||||
+1
-1
@@ -110,7 +110,7 @@ extern EVENT(e_clean_out_throttling_buckets);
|
||||
extern void module_loadall(int module_load);
|
||||
extern long set_usermode(char *umode);
|
||||
extern char *get_modestr(long umodes);
|
||||
extern void tkl_stats(aClient *cptr);
|
||||
extern void tkl_stats(aClient *cptr, int type, char *para);
|
||||
extern void config_error(char *format, ...);
|
||||
extern int config_verbose;
|
||||
extern void config_progress(char *format, ...);
|
||||
|
||||
@@ -262,6 +262,7 @@
|
||||
#define RPL_STATSELINE 225
|
||||
#define RPL_STATSNLINE 226
|
||||
#define RPL_STATSVLINE 227
|
||||
#define RPL_STATSBANVER 228
|
||||
#define RPL_SERVICEINFO 231
|
||||
#define RPL_RULES 232
|
||||
#define RPL_SERVICE 233
|
||||
|
||||
+4
-1
@@ -35,7 +35,7 @@ OBJ_FILES=SRC/CHANNEL.OBJ SRC/SEND.OBJ SRC/SOCKET.OBJ \
|
||||
SRC/S_KLINE.OBJ SRC/S_EXTRA.OBJ SRC/IRCSPRINTF.OBJ SRC/LUSERS.OBJ \
|
||||
SRC/SCACHE.OBJ SRC/ALN.OBJ SRC/BADWORDS.OBJ SRC/WEBTV.OBJ SRC/RES.OBJ SRC/MODULES.OBJ \
|
||||
SRC/S_SVS.OBJ SRC/EVENTS.OBJ SRC/UMODES.OBJ SRC/AUTH.OBJ SRC/CIDR.OBJ SRC/SSL.OBJ \
|
||||
SRC/SERVICE.OBJ SRC/DEBUG.OBJ SRC/RANDOM.OBJ SRC/EXTCMODES.OBJ
|
||||
SRC/SERVICE.OBJ SRC/DEBUG.OBJ SRC/RANDOM.OBJ SRC/EXTCMODES.OBJ SRC/S_STATS.OBJ
|
||||
|
||||
MOD_FILES=SRC/L_COMMANDS.OBJ SRC/M_CHGHOST.OBJ SRC/M_SDESC.OBJ SRC/M_SETIDENT.OBJ \
|
||||
SRC/M_SETNAME.OBJ SRC/M_SETHOST.OBJ SRC/M_CHGIDENT.OBJ SRC/M_SVSMOTD.OBJ \
|
||||
@@ -102,6 +102,9 @@ src/ircsprintf.obj: src/ircsprintf.c $(INCLUDES)
|
||||
src/packet.obj: src/packet.c $(INCLUDES)
|
||||
$(CC) $(CFLAGS) src/packet.c
|
||||
|
||||
src/s_stats.obj: src/s_stats.c $(INCLUDES)
|
||||
$(CC) $(CFLAGS) src/s_stats.c
|
||||
|
||||
src/fdlist.obj: src/fdlist.c $(INCLUDES)
|
||||
$(CC) $(CFLAGS) src/fdlist.c
|
||||
|
||||
|
||||
+4
-1
@@ -38,7 +38,7 @@ OBJ_FILES=SRC/CHANNEL.OBJ SRC/SEND.OBJ SRC/SOCKET.OBJ \
|
||||
SRC/S_KLINE.OBJ SRC/S_EXTRA.OBJ SRC/IRCSPRINTF.OBJ SRC/LUSERS.OBJ \
|
||||
SRC/SCACHE.OBJ SRC/ALN.OBJ SRC/BADWORDS.OBJ SRC/WEBTV.OBJ SRC/RES.OBJ SRC/MODULES.OBJ \
|
||||
SRC/S_SVS.OBJ SRC/EVENTS.OBJ SRC/UMODES.OBJ SRC/AUTH.OBJ SRC/CIDR.OBJ SRC/SSL.OBJ \
|
||||
SRC/SERVICE.OBJ SRC/DEBUG.OBJ SRC/RANDOM.OBJ SRC/EXTCMODES.OBJ
|
||||
SRC/SERVICE.OBJ SRC/DEBUG.OBJ SRC/RANDOM.OBJ SRC/EXTCMODES.OBJ SRC/S_STATS.OBJ
|
||||
|
||||
MOD_FILES=SRC/L_COMMANDS.OBJ SRC/M_CHGHOST.OBJ SRC/M_SDESC.OBJ SRC/M_SETIDENT.OBJ \
|
||||
SRC/M_SETNAME.OBJ SRC/M_SETHOST.OBJ SRC/M_CHGIDENT.OBJ SRC/M_SVSMOTD.OBJ \
|
||||
@@ -105,6 +105,9 @@ src/ircsprintf.obj: src/ircsprintf.c $(INCLUDES)
|
||||
src/packet.obj: src/packet.c $(INCLUDES)
|
||||
$(CC) $(CFLAGS) src/packet.c
|
||||
|
||||
src/s_stats.obj: src/s_stats.c $(INCLUDES)
|
||||
$(CC) $(CFLAGS) src/s_stats.c
|
||||
|
||||
src/fdlist.obj: src/fdlist.c $(INCLUDES)
|
||||
$(CC) $(CFLAGS) src/fdlist.c
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ OBJ_FILES=SRC/CHANNEL.OBJ SRC/SEND.OBJ SRC/SOCKET.OBJ \
|
||||
SRC/S_KLINE.OBJ SRC/S_EXTRA.OBJ SRC/IRCSPRINTF.OBJ SRC/LUSERS.OBJ \
|
||||
SRC/SCACHE.OBJ SRC/ALN.OBJ SRC/BADWORDS.OBJ SRC/WEBTV.OBJ SRC/RES.OBJ SRC/MODULES.OBJ \
|
||||
SRC/S_SVS.OBJ SRC/EVENTS.OBJ SRC/UMODES.OBJ SRC/AUTH.OBJ SRC/CIDR.OBJ SRC/SSL.OBJ \
|
||||
SRC/SERVICE.OBJ SRC/DEBUG.OBJ SRC/RANDOM.OBJ SRC/ZIP.OBJ SRC/EXTCMODES.OBJ
|
||||
SRC/SERVICE.OBJ SRC/DEBUG.OBJ SRC/RANDOM.OBJ SRC/ZIP.OBJ SRC/EXTCMODES.OBJ SRC/S_STATS.OBJ
|
||||
|
||||
MOD_FILES=SRC/L_COMMANDS.OBJ SRC/M_CHGHOST.OBJ SRC/M_SDESC.OBJ SRC/M_SETIDENT.OBJ \
|
||||
SRC/M_SETNAME.OBJ SRC/M_SETHOST.OBJ SRC/M_CHGIDENT.OBJ SRC/M_SVSMOTD.OBJ \
|
||||
@@ -112,6 +112,9 @@ src/ircsprintf.obj: src/ircsprintf.c $(INCLUDES)
|
||||
src/packet.obj: src/packet.c $(INCLUDES)
|
||||
$(CC) $(CFLAGS) src/packet.c
|
||||
|
||||
src/s_stats.obj: src/s_stats.c $(INCLUDES)
|
||||
$(CC) $(CFLAGS) src/s_stats.c
|
||||
|
||||
src/fdlist.obj: src/fdlist.c $(INCLUDES)
|
||||
$(CC) $(CFLAGS) src/fdlist.c
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ OBJ_FILES=SRC/CHANNEL.OBJ SRC/SEND.OBJ SRC/SOCKET.OBJ \
|
||||
SRC/S_KLINE.OBJ SRC/S_EXTRA.OBJ SRC/IRCSPRINTF.OBJ SRC/LUSERS.OBJ \
|
||||
SRC/SCACHE.OBJ SRC/ALN.OBJ SRC/BADWORDS.OBJ SRC/WEBTV.OBJ SRC/RES.OBJ SRC/MODULES.OBJ \
|
||||
SRC/S_SVS.OBJ SRC/EVENTS.OBJ SRC/UMODES.OBJ SRC/AUTH.OBJ SRC/CIDR.OBJ SRC/SSL.OBJ \
|
||||
SRC/SERVICE.OBJ SRC/DEBUG.OBJ SRC/RANDOM.OBJ SRC/ZIP.OBJ SRC/EXTCMODES.OBJ
|
||||
SRC/SERVICE.OBJ SRC/DEBUG.OBJ SRC/RANDOM.OBJ SRC/ZIP.OBJ SRC/EXTCMODES.OBJ SRC/S_STATS.OBJ
|
||||
|
||||
MOD_FILES=SRC/L_COMMANDS.OBJ SRC/M_CHGHOST.OBJ SRC/M_SDESC.OBJ SRC/M_SETIDENT.OBJ \
|
||||
SRC/M_SETNAME.OBJ SRC/M_SETHOST.OBJ SRC/M_CHGIDENT.OBJ SRC/M_SVSMOTD.OBJ \
|
||||
@@ -107,6 +107,9 @@ src/ircsprintf.obj: src/ircsprintf.c $(INCLUDES)
|
||||
src/packet.obj: src/packet.c $(INCLUDES)
|
||||
$(CC) $(CFLAGS) src/packet.c
|
||||
|
||||
src/s_stats.obj: src/s_stats.c $(INCLUDES)
|
||||
$(CC) $(CFLAGS) src/s_stats.c
|
||||
|
||||
src/fdlist.obj: src/fdlist.c $(INCLUDES)
|
||||
$(CC) $(CFLAGS) src/fdlist.c
|
||||
|
||||
|
||||
+5
-2
@@ -27,8 +27,8 @@ OBJS=auth.o aln.o badwords.o channel.o cloak.o crule.o dbuf.o \
|
||||
res_init.o res_comp.o res_mkquery.o res_skipname.o s_auth.o \
|
||||
s_bsd.o s_conf.o s_debug.o s_err.o s_extra.o s_kline.o \
|
||||
s_misc.o s_numeric.o s_serv.o s_svs.o $(STRTOUL) socket.o \
|
||||
ssl.o s_user.o scache.o send.o support.o umodes.o \
|
||||
version.o webtv.o whowas.o zip.o cidr.o random.o extcmodes.o
|
||||
ssl.o s_user.o scache.o send.o support.o umodes.o s_stats.o \
|
||||
version.o webtv.o whowas.o zip.o cidr.o random.o extcmodes.o
|
||||
|
||||
SRC=$(OBJS:%.o=%.c)
|
||||
|
||||
@@ -98,6 +98,9 @@ dbuf.o: dbuf.c $(INCLUDES) ../include/dbuf.h
|
||||
packet.o: packet.c $(INCLUDES)
|
||||
$(CC) $(CFLAGS) -c packet.c
|
||||
|
||||
s_stats.o: s_stats.c $(INCLUDES)
|
||||
$(CC) $(CFLAGS) -c s_stats.c
|
||||
|
||||
badwords.o: badwords.c $(INCLUDES)
|
||||
$(CC) $(CFLAGS) -c badwords.c
|
||||
|
||||
|
||||
+6
-6
@@ -137,7 +137,7 @@ DLLFUNC int m_gline(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
|
||||
if (parc == 1)
|
||||
{
|
||||
tkl_stats(sptr);
|
||||
tkl_stats(sptr, TKL_KILL|TKL_GLOBAL, NULL);
|
||||
sendto_one(sptr, rpl_str(RPL_ENDOFSTATS), me.name, sptr->name, 'g');
|
||||
return 0;
|
||||
}
|
||||
@@ -160,7 +160,7 @@ DLLFUNC int m_gzline(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
|
||||
if (parc == 1)
|
||||
{
|
||||
tkl_stats(sptr);
|
||||
tkl_stats(sptr, TKL_GLOBAL|TKL_ZAP, NULL);
|
||||
sendto_one(sptr, rpl_str(RPL_ENDOFSTATS), me.name, sptr->name, 'g');
|
||||
return 0;
|
||||
}
|
||||
@@ -183,7 +183,7 @@ DLLFUNC int m_shun(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
|
||||
if (parc == 1)
|
||||
{
|
||||
tkl_stats(sptr);
|
||||
tkl_stats(sptr, TKL_GLOBAL|TKL_SHUN, NULL);
|
||||
sendto_one(sptr, rpl_str(RPL_ENDOFSTATS), me.name, sptr->name, 'g');
|
||||
return 0;
|
||||
}
|
||||
@@ -206,7 +206,7 @@ DLLFUNC int m_tkline(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
|
||||
if (parc == 1)
|
||||
{
|
||||
tkl_stats(sptr);
|
||||
tkl_stats(sptr, TKL_KILL, NULL);
|
||||
sendto_one(sptr, rpl_str(RPL_ENDOFSTATS), me.name, sptr->name, 'g');
|
||||
return 0;
|
||||
}
|
||||
@@ -233,7 +233,7 @@ DLLFUNC int m_tzline(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
|
||||
if (parc == 1)
|
||||
{
|
||||
tkl_stats(sptr);
|
||||
tkl_stats(sptr, TKL_ZAP, NULL);
|
||||
sendto_one(sptr, rpl_str(RPL_ENDOFSTATS), me.name, sptr->name, 'g');
|
||||
return 0;
|
||||
}
|
||||
@@ -276,7 +276,7 @@ DLLFUNC int m_tkl_line(aClient *cptr, aClient *sptr, int parc, char *parv[], ch
|
||||
|
||||
if (parc == 1)
|
||||
{
|
||||
tkl_stats(sptr);
|
||||
tkl_stats(sptr, 0, NULL);
|
||||
sendto_one(sptr, rpl_str(RPL_ENDOFSTATS), me.name, sptr->name, 'g');
|
||||
return 0;
|
||||
}
|
||||
|
||||
+1
-1
@@ -244,7 +244,7 @@ void init_CommandHash(void)
|
||||
add_Command(MSG_TIME, TOK_TIME, m_time, MAXPARA);
|
||||
add_Command(MSG_CONNECT, TOK_CONNECT, m_connect, MAXPARA);
|
||||
add_CommandX(MSG_VERSION, TOK_VERSION, m_version, MAXPARA, M_UNREGISTERED|M_USER|M_SERVER);
|
||||
add_Command(MSG_STATS, TOK_STATS, m_stats, MAXPARA);
|
||||
add_Command(MSG_STATS, TOK_STATS, m_stats, 3);
|
||||
add_Command(MSG_LINKS, TOK_LINKS, m_links, MAXPARA);
|
||||
add_CommandX(MSG_ADMIN, TOK_ADMIN, m_admin, MAXPARA, M_UNREGISTERED|M_USER|M_SHUN);
|
||||
add_Command(MSG_SUMMON, NULL, m_summon, 1);
|
||||
|
||||
+34
-154
@@ -1347,6 +1347,7 @@ void config_rehash()
|
||||
ConfigItem_log *log_ptr;
|
||||
ConfigItem_alias *alias_ptr;
|
||||
ConfigItem_help *help_ptr;
|
||||
OperStat *os_ptr;
|
||||
ListStruct *next, *next2;
|
||||
|
||||
USE_BAN_VERSION = 0;
|
||||
@@ -1625,7 +1626,12 @@ void config_rehash()
|
||||
DelListItem(help_ptr, conf_help);
|
||||
MyFree(help_ptr);
|
||||
}
|
||||
|
||||
for (os_ptr = iConf.oper_only_stats_ext; os_ptr; os_ptr = (OperStat *)next)
|
||||
{
|
||||
next = (ListStruct *)os_ptr->next;
|
||||
ircfree(os_ptr->flag);
|
||||
MyFree(os_ptr);
|
||||
}
|
||||
}
|
||||
|
||||
int config_post_test()
|
||||
@@ -2200,157 +2206,6 @@ char *pretty_time_val(long timeval)
|
||||
return buf;
|
||||
}
|
||||
|
||||
/* Report the unrealircd.conf info -codemastr*/
|
||||
void report_dynconf(aClient *sptr)
|
||||
{
|
||||
char *uhallow;
|
||||
sendto_one(sptr, ":%s %i %s :*** Dynamic Configuration Report ***",
|
||||
me.name, RPL_TEXT, sptr->name);
|
||||
sendto_one(sptr, ":%s %i %s :kline-address: %s", me.name, RPL_TEXT,
|
||||
sptr->name, KLINE_ADDRESS);
|
||||
sendto_one(sptr, ":%s %i %s :modes-on-connect: %s", me.name, RPL_TEXT,
|
||||
sptr->name, get_modestr(CONN_MODES));
|
||||
sendto_one(sptr, ":%s %i %s :modes-on-oper: %s", me.name, RPL_TEXT,
|
||||
sptr->name, get_modestr(OPER_MODES));
|
||||
*modebuf = *parabuf = 0;
|
||||
chmode_str(iConf.modes_on_join, modebuf, parabuf);
|
||||
sendto_one(sptr, ":%s %i %s :modes-on-join: %s %s", me.name, RPL_TEXT,
|
||||
sptr->name, modebuf, parabuf);
|
||||
sendto_one(sptr, ":%s %i %s :snomask-on-oper: %s", me.name, RPL_TEXT,
|
||||
sptr->name, OPER_SNOMASK);
|
||||
sendto_one(sptr, ":%s %i %s :snomask-on-connect: %s", me.name, RPL_TEXT,
|
||||
sptr->name, CONNECT_SNOMASK ? CONNECT_SNOMASK : "+");
|
||||
if (OPER_ONLY_STATS)
|
||||
sendto_one(sptr, ":%s %i %s :oper-only-stats: %s", me.name, RPL_TEXT,
|
||||
sptr->name, OPER_ONLY_STATS);
|
||||
if (RESTRICT_USERMODES)
|
||||
sendto_one(sptr, ":%s %i %s :restrict-usermodes: %s", me.name, RPL_TEXT,
|
||||
sptr->name, RESTRICT_USERMODES);
|
||||
if (RESTRICT_CHANNELMODES)
|
||||
sendto_one(sptr, ":%s %i %s :restrict-channelmodes: %s", me.name, RPL_TEXT,
|
||||
sptr->name, RESTRICT_CHANNELMODES);
|
||||
switch (UHOST_ALLOWED)
|
||||
{
|
||||
case UHALLOW_ALWAYS:
|
||||
uhallow = "always";
|
||||
break;
|
||||
case UHALLOW_NEVER:
|
||||
uhallow = "never";
|
||||
break;
|
||||
case UHALLOW_NOCHANS:
|
||||
uhallow = "not-on-channels";
|
||||
break;
|
||||
case UHALLOW_REJOIN:
|
||||
uhallow = "force-rejoin";
|
||||
break;
|
||||
}
|
||||
sendto_one(sptr, ":%s %i %s :anti-spam-quit-message-time: %s", me.name, RPL_TEXT,
|
||||
sptr->name, pretty_time_val(ANTI_SPAM_QUIT_MSG_TIME));
|
||||
sendto_one(sptr, ":%s %i %s :channel-command-prefix: %s", me.name, RPL_TEXT, sptr->name, CHANCMDPFX ? CHANCMDPFX : "`");
|
||||
#ifdef USE_SSL
|
||||
sendto_one(sptr, ":%s %i %s :ssl::egd: %s", me.name, RPL_TEXT,
|
||||
sptr->name, EGD_PATH ? EGD_PATH : (USE_EGD ? "1" : "0"));
|
||||
sendto_one(sptr, ":%s %i %s :ssl::certificate: %s", me.name, RPL_TEXT,
|
||||
sptr->name, SSL_SERVER_CERT_PEM);
|
||||
sendto_one(sptr, ":%s %i %s :ssl::key: %s", me.name, RPL_TEXT,
|
||||
sptr->name, SSL_SERVER_KEY_PEM);
|
||||
sendto_one(sptr, ":%s %i %s :ssl::trusted-ca-file: %s", me.name, RPL_TEXT, sptr->name,
|
||||
iConf.trusted_ca_file ? iConf.trusted_ca_file : "<none>");
|
||||
sendto_one(sptr, ":%s %i %s :ssl::options: %s %s %s", me.name, RPL_TEXT, sptr->name,
|
||||
iConf.ssl_options & SSLFLAG_FAILIFNOCERT ? "FAILIFNOCERT" : "",
|
||||
iConf.ssl_options & SSLFLAG_VERIFYCERT ? "VERIFYCERT" : "",
|
||||
iConf.ssl_options & SSLFLAG_DONOTACCEPTSELFSIGNED ? "DONOTACCEPTSELFSIGNED" : "");
|
||||
#endif
|
||||
|
||||
sendto_one(sptr, ":%s %i %s :options::show-opermotd: %d", me.name, RPL_TEXT,
|
||||
sptr->name, SHOWOPERMOTD);
|
||||
sendto_one(sptr, ":%s %i %s :options::hide-ulines: %d", me.name, RPL_TEXT,
|
||||
sptr->name, HIDE_ULINES);
|
||||
sendto_one(sptr, ":%s %i %s :options::webtv-support: %d", me.name, RPL_TEXT,
|
||||
sptr->name, WEBTV_SUPPORT);
|
||||
sendto_one(sptr, ":%s %i %s :options::identd-check: %d", me.name, RPL_TEXT,
|
||||
sptr->name, IDENT_CHECK);
|
||||
sendto_one(sptr, ":%s %i %s :options::fail-oper-warn: %d", me.name, RPL_TEXT,
|
||||
sptr->name, FAILOPER_WARN);
|
||||
sendto_one(sptr, ":%s %i %s :options::show-connect-info: %d", me.name, RPL_TEXT,
|
||||
sptr->name, SHOWCONNECTINFO);
|
||||
sendto_one(sptr, ":%s %i %s :maxchannelsperuser: %i", me.name, RPL_TEXT,
|
||||
sptr->name, MAXCHANNELSPERUSER);
|
||||
sendto_one(sptr, ":%s %i %s :auto-join: %s", me.name, RPL_TEXT,
|
||||
sptr->name, AUTO_JOIN_CHANS ? AUTO_JOIN_CHANS : "0");
|
||||
sendto_one(sptr, ":%s %i %s :oper-auto-join: %s", me.name,
|
||||
RPL_TEXT, sptr->name, OPER_AUTO_JOIN_CHANS ? OPER_AUTO_JOIN_CHANS : "0");
|
||||
sendto_one(sptr, ":%s %i %s :static-quit: %s", me.name,
|
||||
RPL_TEXT, sptr->name, STATIC_QUIT ? STATIC_QUIT : "<none>");
|
||||
sendto_one(sptr, ":%s %i %s :dns::timeout: %s", me.name, RPL_TEXT,
|
||||
sptr->name, pretty_time_val(HOST_TIMEOUT));
|
||||
sendto_one(sptr, ":%s %i %s :dns::retries: %d", me.name, RPL_TEXT,
|
||||
sptr->name, HOST_RETRIES);
|
||||
sendto_one(sptr, ":%s %i %s :dns::nameserver: %s", me.name, RPL_TEXT,
|
||||
sptr->name, NAME_SERVER);
|
||||
#ifdef THROTTLING
|
||||
sendto_one(sptr, ":%s %i %s :throttle::period: %s", me.name, RPL_TEXT,
|
||||
sptr->name, THROTTLING_PERIOD ? pretty_time_val(THROTTLING_PERIOD) : "disabled");
|
||||
sendto_one(sptr, ":%s %i %s :throttle::connections: %d", me.name, RPL_TEXT,
|
||||
sptr->name, THROTTLING_COUNT ? THROTTLING_COUNT : -1);
|
||||
#endif
|
||||
sendto_one(sptr, ":%s %i %s :anti-flood::unknown-flood-bantime: %s", me.name, RPL_TEXT,
|
||||
sptr->name, pretty_time_val(UNKNOWN_FLOOD_BANTIME));
|
||||
sendto_one(sptr, ":%s %i %s :anti-flood::unknown-flood-amount: %dKB", me.name, RPL_TEXT,
|
||||
sptr->name, UNKNOWN_FLOOD_AMOUNT);
|
||||
#ifdef NO_FLOOD_AWAY
|
||||
if (AWAY_PERIOD)
|
||||
{
|
||||
sendto_one(sptr, ":%s %i %s :anti-flood::away-count: %d", me.name, RPL_TEXT,
|
||||
sptr->name, AWAY_COUNT);
|
||||
sendto_one(sptr, ":%s %i %s :anti-flood::away-period: %s", me.name, RPL_TEXT,
|
||||
sptr->name, pretty_time_val(AWAY_PERIOD));
|
||||
}
|
||||
#endif
|
||||
sendto_one(sptr, ":%s %i %s :ident::connect-timeout: %s", me.name, RPL_TEXT,
|
||||
sptr->name, pretty_time_val(IDENT_CONNECT_TIMEOUT));
|
||||
sendto_one(sptr, ":%s %i %s :ident::read-timeout: %s", me.name, RPL_TEXT,
|
||||
sptr->name, pretty_time_val(IDENT_READ_TIMEOUT));
|
||||
|
||||
}
|
||||
|
||||
/* Report the network file info -codemastr */
|
||||
void report_network(aClient *sptr)
|
||||
{
|
||||
sendto_one(sptr, ":%s %i %s :*** Network Configuration Report ***",
|
||||
me.name, RPL_TEXT, sptr->name);
|
||||
sendto_one(sptr, ":%s %i %s :network-name: %s", me.name, RPL_TEXT,
|
||||
sptr->name, ircnetwork);
|
||||
sendto_one(sptr, ":%s %i %s :default-server: %s", me.name, RPL_TEXT,
|
||||
sptr->name, defserv);
|
||||
sendto_one(sptr, ":%s %i %s :services-server: %s", me.name, RPL_TEXT,
|
||||
sptr->name, SERVICES_NAME);
|
||||
sendto_one(sptr, ":%s %i %s :stats-server: %s", me.name, RPL_TEXT,
|
||||
sptr->name, STATS_SERVER);
|
||||
sendto_one(sptr, ":%s %i %s :hosts::global: %s", me.name, RPL_TEXT,
|
||||
sptr->name, oper_host);
|
||||
sendto_one(sptr, ":%s %i %s :hosts::admin: %s", me.name, RPL_TEXT,
|
||||
sptr->name, admin_host);
|
||||
sendto_one(sptr, ":%s %i %s :hosts::local: %s", me.name, RPL_TEXT,
|
||||
sptr->name, locop_host);
|
||||
sendto_one(sptr, ":%s %i %s :hosts::servicesadmin: %s", me.name, RPL_TEXT,
|
||||
sptr->name, sadmin_host);
|
||||
sendto_one(sptr, ":%s %i %s :hosts::netadmin: %s", me.name, RPL_TEXT,
|
||||
sptr->name, netadmin_host);
|
||||
sendto_one(sptr, ":%s %i %s :hosts::coadmin: %s", me.name, RPL_TEXT,
|
||||
sptr->name, coadmin_host);
|
||||
sendto_one(sptr, ":%s %i %s :hiddenhost-prefix: %s", me.name, RPL_TEXT,
|
||||
sptr->name, hidden_host);
|
||||
sendto_one(sptr, ":%s %i %s :help-channel: %s", me.name, RPL_TEXT,
|
||||
sptr->name, helpchan);
|
||||
sendto_one(sptr, ":%s %i %s :hosts::host-on-oper-up: %i", me.name, RPL_TEXT, sptr->name,
|
||||
iNAH);
|
||||
sendto_one(sptr, ":%s %i %s :cloak-keys: %X", me.name, RPL_TEXT, sptr->name,
|
||||
CLOAK_KEYCRC);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actual config parser funcs
|
||||
*/
|
||||
@@ -5099,7 +4954,19 @@ int _conf_set(ConfigFile *conf, ConfigEntry *ce)
|
||||
tempiConf.anti_spam_quit_message_time = config_checkval(cep->ce_vardata,CFG_TIME);
|
||||
}
|
||||
else if (!strcmp(cep->ce_varname, "oper-only-stats")) {
|
||||
ircstrdup(tempiConf.oper_only_stats, cep->ce_vardata);
|
||||
if (!cep->ce_entries)
|
||||
{
|
||||
ircstrdup(tempiConf.oper_only_stats, cep->ce_vardata);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
|
||||
{
|
||||
OperStat *os = MyMalloc(sizeof(OperStat));
|
||||
ircstrdup(os->flag, cepp->ce_varname);
|
||||
AddListItem(os, tempiConf.oper_only_stats_ext);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!strcmp(cep->ce_varname, "maxchannelsperuser")) {
|
||||
tempiConf.maxchannelsperuser = atoi(cep->ce_vardata);
|
||||
@@ -5444,7 +5311,20 @@ int _test_set(ConfigFile *conf, ConfigEntry *ce)
|
||||
CheckNull(cep);
|
||||
}
|
||||
else if (!strcmp(cep->ce_varname, "oper-only-stats")) {
|
||||
CheckNull(cep);
|
||||
if (!cep->ce_entries)
|
||||
{
|
||||
CheckNull(cep);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
|
||||
{
|
||||
if (!cepp->ce_varname)
|
||||
config_error("%s:%i: blank set::oper-only-stats item",
|
||||
cepp->ce_fileptr->cf_filename,
|
||||
cepp->ce_varlinenum);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!strcmp(cep->ce_varname, "maxchannelsperuser")) {
|
||||
CheckNull(cep);
|
||||
|
||||
-192
@@ -348,196 +348,4 @@ void send_usage(aClient *cptr, char *nick)
|
||||
}
|
||||
#endif
|
||||
|
||||
void count_memory(aClient *cptr, char *nick)
|
||||
{
|
||||
extern aChannel *channel;
|
||||
extern int flinks;
|
||||
extern Link *freelink;
|
||||
extern MemoryInfo StatsZ;
|
||||
|
||||
aClient *acptr;
|
||||
Ban *ban;
|
||||
Link *link;
|
||||
aChannel *chptr;
|
||||
|
||||
int lc = 0, /* local clients */
|
||||
ch = 0, /* channels */
|
||||
lcc = 0, /* local client conf links */
|
||||
rc = 0, /* remote clients */
|
||||
us = 0, /* user structs */
|
||||
chu = 0, /* channel users */
|
||||
chi = 0, /* channel invites */
|
||||
chb = 0, /* channel bans */
|
||||
wwu = 0, /* whowas users */
|
||||
fl = 0, /* free links */
|
||||
cl = 0, /* classes */
|
||||
co = 0; /* conf lines */
|
||||
|
||||
int usi = 0, /* users invited */
|
||||
usc = 0, /* users in channels */
|
||||
aw = 0, /* aways set */
|
||||
wwa = 0, /* whowas aways */
|
||||
wlh = 0, /* watchlist headers */
|
||||
wle = 0; /* watchlist entries */
|
||||
|
||||
u_long chm = 0, /* memory used by channels */
|
||||
chbm = 0, /* memory used by channel bans */
|
||||
lcm = 0, /* memory used by local clients */
|
||||
rcm = 0, /* memory used by remote clients */
|
||||
awm = 0, /* memory used by aways */
|
||||
wwam = 0, /* whowas away memory used */
|
||||
wwm = 0, /* whowas array memory used */
|
||||
com = 0, /* memory used by conf lines */
|
||||
wlhm = 0, /* watchlist memory used */
|
||||
db = 0, /* memory used by dbufs */
|
||||
rm = 0, /* res memory used */
|
||||
totcl = 0, totch = 0, totww = 0, tot = 0;
|
||||
|
||||
count_whowas_memory(&wwu, &wwam);
|
||||
count_watch_memory(&wlh, &wlhm);
|
||||
wwm = sizeof(aName) * NICKNAMEHISTORYLENGTH;
|
||||
|
||||
for (acptr = client; acptr; acptr = acptr->next)
|
||||
{
|
||||
if (MyConnect(acptr))
|
||||
{
|
||||
lc++;
|
||||
/*for (link = acptr->confs; link; link = link->next)
|
||||
lcc++;
|
||||
wle += acptr->notifies;*/
|
||||
|
||||
}
|
||||
else
|
||||
rc++;
|
||||
if (acptr->user)
|
||||
{
|
||||
Membership *mb;
|
||||
us++;
|
||||
for (link = acptr->user->invited; link;
|
||||
link = link->next)
|
||||
usi++;
|
||||
for (mb = acptr->user->channel; mb;
|
||||
mb = mb->next)
|
||||
usc++;
|
||||
if (acptr->user->away)
|
||||
{
|
||||
aw++;
|
||||
awm += (strlen(acptr->user->away) + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
lcm = lc * CLIENT_LOCAL_SIZE;
|
||||
rcm = rc * CLIENT_REMOTE_SIZE;
|
||||
|
||||
for (chptr = channel; chptr; chptr = chptr->nextch)
|
||||
{
|
||||
Member *member;
|
||||
|
||||
ch++;
|
||||
chm += (strlen(chptr->chname) + sizeof(aChannel));
|
||||
for (member = chptr->members; member; member = member->next)
|
||||
chu++;
|
||||
for (link = chptr->invites; link; link = link->next)
|
||||
chi++;
|
||||
for (ban = chptr->banlist; ban; ban = ban->next)
|
||||
{
|
||||
chb++;
|
||||
chbm += (strlen(ban->banstr) + 1 +
|
||||
strlen(ban->who) + 1 + sizeof(Ban));
|
||||
}
|
||||
}
|
||||
|
||||
/* for (aconf = conf; aconf; aconf = aconf->next)
|
||||
{
|
||||
co++;
|
||||
com += aconf->host ? strlen(aconf->host) + 1 : 0;
|
||||
com += aconf->passwd ? strlen(aconf->passwd) + 1 : 0;
|
||||
com += aconf->name ? strlen(aconf->name) + 1 : 0;
|
||||
com += sizeof(aConfItem);
|
||||
}
|
||||
|
||||
for (cltmp = classes; cltmp; cltmp = cltmp->next)
|
||||
cl++;
|
||||
*/
|
||||
sendto_one(cptr, ":%s %d %s :Client Local %d(%d) Remote %d(%d)",
|
||||
me.name, RPL_STATSDEBUG, nick, lc, lcm, rc, rcm);
|
||||
sendto_one(cptr, ":%s %d %s :Users %d(%d) Invites %d(%d)",
|
||||
me.name, RPL_STATSDEBUG, nick, us, us * sizeof(anUser), usi,
|
||||
usi * sizeof(Link));
|
||||
sendto_one(cptr, ":%s %d %s :User channels %d(%d) Aways %d(%d)",
|
||||
me.name, RPL_STATSDEBUG, nick, usc, usc * sizeof(Link), aw, awm);
|
||||
sendto_one(cptr, ":%s %d %s :WATCH headers %d(%d) entries %d(%d)",
|
||||
me.name, RPL_STATSDEBUG, nick, wlh, wlhm, wle, wle * sizeof(Link));
|
||||
sendto_one(cptr, ":%s %d %s :Attached confs %d(%d)",
|
||||
me.name, RPL_STATSDEBUG, nick, lcc, lcc * sizeof(Link));
|
||||
|
||||
totcl = lcm + rcm + us * sizeof(anUser) + usc * sizeof(Link) + awm;
|
||||
totcl += lcc * sizeof(Link) + usi * sizeof(Link) + wlhm;
|
||||
totcl += wle * sizeof(Link);
|
||||
|
||||
sendto_one(cptr, ":%s %d %s :Conflines %d(%d)",
|
||||
me.name, RPL_STATSDEBUG, nick, co, com);
|
||||
|
||||
sendto_one(cptr, ":%s %d %s :Classes %d(%d)",
|
||||
me.name, RPL_STATSDEBUG, nick, StatsZ.classes, StatsZ.classesmem);
|
||||
|
||||
sendto_one(cptr, ":%s %d %s :Channels %d(%d) Bans %d(%d)",
|
||||
me.name, RPL_STATSDEBUG, nick, ch, chm, chb, chbm);
|
||||
sendto_one(cptr, ":%s %d %s :Channel members %d(%d) invite %d(%d)",
|
||||
me.name, RPL_STATSDEBUG, nick, chu, chu * sizeof(Link),
|
||||
chi, chi * sizeof(Link));
|
||||
|
||||
totch = chm + chbm + chu * sizeof(Link) + chi * sizeof(Link);
|
||||
|
||||
sendto_one(cptr, ":%s %d %s :Whowas users %d(%d) away %d(%d)",
|
||||
me.name, RPL_STATSDEBUG, nick, wwu, wwu * sizeof(anUser),
|
||||
wwa, wwam);
|
||||
sendto_one(cptr, ":%s %d %s :Whowas array %d(%d)",
|
||||
me.name, RPL_STATSDEBUG, nick, NICKNAMEHISTORYLENGTH, wwm);
|
||||
|
||||
totww = wwu * sizeof(anUser) + wwam + wwm;
|
||||
|
||||
sendto_one(cptr,
|
||||
":%s %d %s :Hash: client %d(%d) chan %d(%d) watch %d(%d)", me.name,
|
||||
RPL_STATSDEBUG, nick, U_MAX, sizeof(aHashEntry) * U_MAX, CH_MAX,
|
||||
sizeof(aHashEntry) * CH_MAX, WATCHHASHSIZE,
|
||||
sizeof(aWatch *) * WATCHHASHSIZE);
|
||||
db = dbufblocks * sizeof(dbufbuf);
|
||||
sendto_one(cptr, ":%s %d %s :Dbuf blocks %d(%d)",
|
||||
me.name, RPL_STATSDEBUG, nick, dbufblocks, db);
|
||||
|
||||
link = freelink;
|
||||
while ((link = link->next))
|
||||
fl++;
|
||||
fl++;
|
||||
sendto_one(cptr, ":%s %d %s :Link blocks free %d(%d) total %d(%d)",
|
||||
me.name, RPL_STATSDEBUG, nick, fl, fl * sizeof(Link),
|
||||
flinks, flinks * sizeof(Link));
|
||||
|
||||
rm = cres_mem(cptr,cptr->name);
|
||||
|
||||
tot = totww + totch + totcl + com + cl * sizeof(aClass) + db + rm;
|
||||
tot += fl * sizeof(Link);
|
||||
tot += sizeof(aHashEntry) * U_MAX;
|
||||
tot += sizeof(aHashEntry) * CH_MAX;
|
||||
tot += sizeof(aWatch *) * WATCHHASHSIZE;
|
||||
|
||||
sendto_one(cptr, ":%s %d %s :Total: ww %d ch %d cl %d co %d db %d",
|
||||
me.name, RPL_STATSDEBUG, nick, totww, totch, totcl, com, db);
|
||||
#if !defined(_WIN32) && !defined(_AMIGA)
|
||||
#ifdef __alpha
|
||||
sendto_one(cptr, ":%s %d %s :TOTAL: %d sbrk(0)-etext: %u",
|
||||
me.name, RPL_STATSDEBUG, nick, tot,
|
||||
(u_int)sbrk((size_t)0) - (u_int)sbrk0);
|
||||
#else
|
||||
sendto_one(cptr, ":%s %d %s :TOTAL: %d sbrk(0)-etext: %ul",
|
||||
me.name, RPL_STATSDEBUG, nick, tot,
|
||||
(u_long)sbrk((size_t)0) - (u_long)sbrk0);
|
||||
|
||||
#endif
|
||||
#else
|
||||
sendto_one(cptr, ":%s %d %s :TOTAL: %d",
|
||||
me.name, RPL_STATSDEBUG, nick, tot);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
+1
-1
@@ -261,7 +261,7 @@ static char *replies[] = {
|
||||
/* 225 RPL_STATSELINE */ ":%s 225 %s e %s",
|
||||
/* 226 RPL_STATSNLINE */ ":%s 226 %s n %s %s",
|
||||
/* 227 RPL_STATSVLINE */ ":%s 227 %s V %s %s %s",
|
||||
/* 228 */ NULL,
|
||||
/* 228 RPL_STATSBANVER */ ":%s 228 %s %s %s",
|
||||
/* 229 */ NULL,
|
||||
/* 230 */ NULL,
|
||||
/* 231 */ NULL,
|
||||
|
||||
@@ -92,28 +92,6 @@ void dcc_sync(aClient *sptr)
|
||||
}
|
||||
}
|
||||
|
||||
void report_flines(aClient *sptr)
|
||||
{
|
||||
ConfigItem_deny_dcc *tmp;
|
||||
char *filemask, *reason;
|
||||
char a = 0;
|
||||
|
||||
for (tmp = conf_deny_dcc; tmp; tmp = (ConfigItem_deny_dcc *) tmp->next)
|
||||
{
|
||||
filemask = BadPtr(tmp->filename) ? "<NULL>" : tmp->filename;
|
||||
reason = BadPtr(tmp->reason) ? "<NULL>" : tmp->reason;
|
||||
if (tmp->flag.type2 == CONF_BAN_TYPE_CONF)
|
||||
a = 'c';
|
||||
if (tmp->flag.type2 == CONF_BAN_TYPE_AKILL)
|
||||
a = 's';
|
||||
if (tmp->flag.type2 == CONF_BAN_TYPE_TEMPORARY)
|
||||
a = 'o';
|
||||
sendto_one(sptr, ":%s %i %s :%c %s %s", me.name, RPL_TEXT,
|
||||
sptr->name, a, filemask, reason);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void DCCdeny_add(char *filename, char *reason, int type)
|
||||
{
|
||||
ConfigItem_deny_dcc *deny = NULL;
|
||||
|
||||
+92
-7
@@ -433,26 +433,111 @@ int find_tkline_match_zap(aClient *cptr)
|
||||
return -1;
|
||||
}
|
||||
|
||||
#define BY_MASK 0x1
|
||||
#define BY_REASON 0x2
|
||||
#define NOT_BY_MASK 0x4
|
||||
#define NOT_BY_REASON 0x8
|
||||
#define BY_SETBY 0x10
|
||||
#define NOT_BY_SETBY 0x20
|
||||
|
||||
void tkl_stats(aClient *cptr)
|
||||
typedef struct {
|
||||
int flags;
|
||||
char *mask;
|
||||
char *reason;
|
||||
char *setby;
|
||||
} TKLFlag;
|
||||
|
||||
void parse_tkl_para(char *para, TKLFlag *flag)
|
||||
{
|
||||
char *flags = strtok(para, " ");
|
||||
char *tmp;
|
||||
char what = '+';
|
||||
|
||||
bzero(flag, sizeof(TKLFlag));
|
||||
for (; *flags; flags++)
|
||||
{
|
||||
switch (*flags)
|
||||
{
|
||||
case '+':
|
||||
what = '+';
|
||||
break;
|
||||
case '-':
|
||||
what = '-';
|
||||
break;
|
||||
case 'm':
|
||||
if (flag->mask || !(tmp = strtok(NULL, " ")))
|
||||
continue;
|
||||
if (what == '+')
|
||||
flag->flags |= BY_MASK;
|
||||
else
|
||||
flag->flags |= NOT_BY_MASK;
|
||||
flag->mask = tmp;
|
||||
break;
|
||||
case 'r':
|
||||
if (flag->reason || !(tmp = strtok(NULL, " ")))
|
||||
continue;
|
||||
if (what == '+')
|
||||
flag->flags |= BY_REASON;
|
||||
else
|
||||
flag->flags |= NOT_BY_REASON;
|
||||
flag->reason = tmp;
|
||||
break;
|
||||
case 's':
|
||||
if (flag->setby || !(tmp = strtok(NULL, " ")))
|
||||
continue;
|
||||
if (what == '+')
|
||||
flag->flags |= BY_SETBY;
|
||||
else
|
||||
flag->flags |= NOT_BY_SETBY;
|
||||
flag->setby = tmp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void tkl_stats(aClient *cptr, int type, char *para)
|
||||
{
|
||||
aTKline *tk;
|
||||
TS curtime;
|
||||
|
||||
TKLFlag tklflags;
|
||||
/*
|
||||
We output in this row:
|
||||
Glines,GZlines,KLine, ZLIne
|
||||
Character:
|
||||
G, Z, K, z
|
||||
*/
|
||||
if (!IsAnOper(cptr) && OPER_ONLY_STATS && (strchr(OPER_ONLY_STATS, 'G') || strchr(OPER_ONLY_STATS, 'g'))) {
|
||||
sendto_one(cptr, err_str(ERR_NOPRIVILEGES), me.name, cptr->name);
|
||||
return;
|
||||
}
|
||||
|
||||
if (para)
|
||||
parse_tkl_para(para, &tklflags);
|
||||
tkl_check_expire(NULL);
|
||||
curtime = TStime();
|
||||
for (tk = tklines; tk; tk = tk->next)
|
||||
{
|
||||
if (type && tk->type != type)
|
||||
continue;
|
||||
if (para)
|
||||
{
|
||||
if (tklflags.flags & BY_MASK)
|
||||
if (match(tklflags.mask, make_user_host(tk->usermask,
|
||||
tk->hostmask)))
|
||||
continue;
|
||||
if (tklflags.flags & NOT_BY_MASK)
|
||||
if (!match(tklflags.mask, make_user_host(tk->usermask,
|
||||
tk->hostmask)))
|
||||
continue;
|
||||
if (tklflags.flags & BY_REASON)
|
||||
if (match(tklflags.reason, tk->reason))
|
||||
continue;
|
||||
if (tklflags.flags & NOT_BY_REASON)
|
||||
if (!match(tklflags.reason, tk->reason))
|
||||
continue;
|
||||
if (tklflags.flags & BY_SETBY)
|
||||
if (match(tklflags.setby, tk->setby))
|
||||
continue;
|
||||
if (tklflags.flags & NOT_BY_SETBY)
|
||||
if (!match(tklflags.setby, tk->setby))
|
||||
continue;
|
||||
}
|
||||
if (tk->type == (TKL_KILL | TKL_GLOBAL))
|
||||
{
|
||||
sendto_one(cptr, rpl_str(RPL_STATSGLINE), me.name,
|
||||
@@ -727,7 +812,7 @@ int m_tkl(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
|
||||
case '?':
|
||||
if (IsAnOper(sptr))
|
||||
tkl_stats(sptr);
|
||||
tkl_stats(sptr,0,NULL);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -703,91 +703,3 @@ void initstats(void)
|
||||
bzero((char *)&ircst, sizeof(ircst));
|
||||
}
|
||||
|
||||
void tstats(aClient *cptr, char *name)
|
||||
{
|
||||
aClient *acptr;
|
||||
int i;
|
||||
struct stats *sp;
|
||||
struct stats tmp;
|
||||
time_t now = TStime();
|
||||
|
||||
sp = &tmp;
|
||||
bcopy((char *)ircstp, (char *)sp, sizeof(*sp));
|
||||
for (i = 0; i <= LastSlot; i++)
|
||||
{
|
||||
if (!(acptr = local[i]))
|
||||
continue;
|
||||
if (IsServer(acptr))
|
||||
{
|
||||
sp->is_sbs += acptr->sendB;
|
||||
sp->is_sbr += acptr->receiveB;
|
||||
sp->is_sks += acptr->sendK;
|
||||
sp->is_skr += acptr->receiveK;
|
||||
sp->is_sti += now - acptr->firsttime;
|
||||
sp->is_sv++;
|
||||
if (sp->is_sbs > 1023)
|
||||
{
|
||||
sp->is_sks += (sp->is_sbs >> 10);
|
||||
sp->is_sbs &= 0x3ff;
|
||||
}
|
||||
if (sp->is_sbr > 1023)
|
||||
{
|
||||
sp->is_skr += (sp->is_sbr >> 10);
|
||||
sp->is_sbr &= 0x3ff;
|
||||
}
|
||||
}
|
||||
else if (IsClient(acptr))
|
||||
{
|
||||
sp->is_cbs += acptr->sendB;
|
||||
sp->is_cbr += acptr->receiveB;
|
||||
sp->is_cks += acptr->sendK;
|
||||
sp->is_ckr += acptr->receiveK;
|
||||
sp->is_cti += now - acptr->firsttime;
|
||||
sp->is_cl++;
|
||||
if (sp->is_cbs > 1023)
|
||||
{
|
||||
sp->is_cks += (sp->is_cbs >> 10);
|
||||
sp->is_cbs &= 0x3ff;
|
||||
}
|
||||
if (sp->is_cbr > 1023)
|
||||
{
|
||||
sp->is_ckr += (sp->is_cbr >> 10);
|
||||
sp->is_cbr &= 0x3ff;
|
||||
}
|
||||
}
|
||||
else if (IsUnknown(acptr))
|
||||
sp->is_ni++;
|
||||
}
|
||||
|
||||
sendto_one(cptr, ":%s %d %s :accepts %u refused %u",
|
||||
me.name, RPL_STATSDEBUG, name, sp->is_ac, sp->is_ref);
|
||||
sendto_one(cptr, ":%s %d %s :unknown commands %u prefixes %u",
|
||||
me.name, RPL_STATSDEBUG, name, sp->is_unco, sp->is_unpf);
|
||||
sendto_one(cptr, ":%s %d %s :nick collisions %u unknown closes %u",
|
||||
me.name, RPL_STATSDEBUG, name, sp->is_kill, sp->is_ni);
|
||||
sendto_one(cptr, ":%s %d %s :wrong direction %u empty %u",
|
||||
me.name, RPL_STATSDEBUG, name, sp->is_wrdi, sp->is_empt);
|
||||
sendto_one(cptr, ":%s %d %s :numerics seen %u mode fakes %u",
|
||||
me.name, RPL_STATSDEBUG, name, sp->is_num, sp->is_fake);
|
||||
sendto_one(cptr, ":%s %d %s :auth successes %u fails %u",
|
||||
me.name, RPL_STATSDEBUG, name, sp->is_asuc, sp->is_abad);
|
||||
sendto_one(cptr, ":%s %d %s :local connections %u udp packets %u",
|
||||
me.name, RPL_STATSDEBUG, name, sp->is_loc, sp->is_udp);
|
||||
sendto_one(cptr, ":%s %d %s :Client Server",
|
||||
me.name, RPL_STATSDEBUG, name);
|
||||
sendto_one(cptr, ":%s %d %s :connected %u %u",
|
||||
me.name, RPL_STATSDEBUG, name, sp->is_cl, sp->is_sv);
|
||||
sendto_one(cptr, ":%s %d %s :bytes sent %u.%uK %u.%uK",
|
||||
me.name, RPL_STATSDEBUG, name,
|
||||
sp->is_cks, sp->is_cbs, sp->is_sks, sp->is_sbs);
|
||||
sendto_one(cptr, ":%s %d %s :bytes recv %u.%uK %u.%uK",
|
||||
me.name, RPL_STATSDEBUG, name,
|
||||
sp->is_ckr, sp->is_cbr, sp->is_skr, sp->is_sbr);
|
||||
sendto_one(cptr, ":%s %d %s :time connected %u %u",
|
||||
me.name, RPL_STATSDEBUG, name, sp->is_cti, sp->is_sti);
|
||||
#ifndef NO_FDLIST
|
||||
sendto_one(cptr,
|
||||
":%s %d %s :incoming rate %0.2f kb/s - outgoing rate %0.2f kb/s",
|
||||
me.name, RPL_STATSDEBUG, name, currentrate, currentrate2);
|
||||
#endif
|
||||
}
|
||||
|
||||
-704
@@ -2026,710 +2026,6 @@ char *get_client_name2(aClient *acptr, int showports)
|
||||
return pointer;
|
||||
}
|
||||
|
||||
/*
|
||||
** m_stats
|
||||
** parv[0] = sender prefix
|
||||
** parv[1] = statistics selector (defaults to Message frequency)
|
||||
** parv[2] = server name (current server defaulted, if omitted)
|
||||
**
|
||||
*/
|
||||
/*
|
||||
** Note: The info is reported in the order the server uses
|
||||
** it--not reversed as in unrealircd.conf!
|
||||
*/
|
||||
|
||||
CMD_FUNC(m_stats)
|
||||
{
|
||||
#ifndef DEBUGMODE
|
||||
static char Sformat[] =
|
||||
":%s %d %s SendQ SendM SendBytes RcveM RcveBytes Open_since :Idle";
|
||||
static char Lformat[] = ":%s %d %s %s%s %u %u %u %u %u %u :%u";
|
||||
#else
|
||||
static char Sformat[] =
|
||||
":%s %d %s SendQ SendM SendBytes RcveM RcveBytes Open_since CPU :Idle";
|
||||
static char Lformat[] = ":%s %d %s %s%s %u %u %u %u %u %u %s";
|
||||
char pbuf[96]; /* Should be enough for to ints */
|
||||
#endif
|
||||
ConfigItem_link *link_p;
|
||||
ConfigItem_oper *oper_p;
|
||||
ConfigItem_oper_from *oper_p_from;
|
||||
aCommand *mptr;
|
||||
aClient *acptr;
|
||||
char stat = parc > 1 ? parv[1][0] : '\0';
|
||||
char stat2;
|
||||
int i;
|
||||
int doall = 0, wilds = 0, showports = IsAnOper(sptr), remote = 0;
|
||||
char *name;
|
||||
|
||||
if (IsServer(sptr))
|
||||
return 0;
|
||||
if (hunt_server_token(cptr, sptr, MSG_STATS, TOK_STATS, "%s :%s", 2, parc,
|
||||
parv) != HUNTED_ISME)
|
||||
return 0;
|
||||
if (OPER_ONLY_STATS) {
|
||||
if (!IsAnOper(sptr) && strchr(OPER_ONLY_STATS, '*'))
|
||||
{
|
||||
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]);
|
||||
return 0;
|
||||
}
|
||||
stat2 = tolower(stat);
|
||||
if (!IsAnOper(sptr) && (stat2 == 'c' || stat2 == 'f' || stat2 == 'i' || stat2 == 'h' ||
|
||||
stat2 == 'y' || stat2 == 'x' || stat2 == 'g' || stat2 == 'k' || stat2 == 'o' ||
|
||||
stat2 == 'z' || stat2 == 'l')) {
|
||||
if (strchr(OPER_ONLY_STATS, toupper(stat)) || strchr(OPER_ONLY_STATS, stat2)) {
|
||||
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]);
|
||||
return 0;
|
||||
}
|
||||
if (stat2 == 'c') {
|
||||
if (strchr(OPER_ONLY_STATS, 'h') || strchr(OPER_ONLY_STATS, 'H')) {
|
||||
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (stat2 == 'h') {
|
||||
if (strchr(OPER_ONLY_STATS, 'c') || strchr(OPER_ONLY_STATS, 'C')) {
|
||||
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!IsAnOper(sptr) && strchr(OPER_ONLY_STATS, stat))
|
||||
{
|
||||
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (parc > 2)
|
||||
{
|
||||
name = parv[2];
|
||||
if (!mycmp(name, me.name))
|
||||
doall = 2;
|
||||
else if (match(name, me.name) == 0)
|
||||
doall = 1;
|
||||
if (index(name, '*') || index(name, '?'))
|
||||
wilds = 1;
|
||||
}
|
||||
else
|
||||
name = me.name;
|
||||
|
||||
switch (stat)
|
||||
{
|
||||
#ifdef STRIPBADWORDS
|
||||
case 'b':
|
||||
{
|
||||
ConfigItem_badword *words;
|
||||
|
||||
for (words = conf_badword_channel; words; words = (ConfigItem_badword *) words->next) {
|
||||
#ifdef FAST_BADWORD_REPLACE
|
||||
sendto_one(sptr, ":%s %i %s :c %c %s%s%s %s",
|
||||
me.name, RPL_TEXT, sptr->name, words->type & BADW_TYPE_REGEX ? 'R' : 'F',
|
||||
(words->type & BADW_TYPE_FAST_L) ? "*" : "",
|
||||
words->word,
|
||||
(words->type & BADW_TYPE_FAST_R) ? "*" : "",
|
||||
words->action == BADWORD_REPLACE ?
|
||||
(words->replace ? words->replace : "<censored>") : "");
|
||||
#else
|
||||
sendto_one(sptr, ":%s %i %s :c %s %s", me.name, RPL_TEXT, sptr->name, words->word,
|
||||
words->action == BADWORD_REPLACE ?
|
||||
(words->replace ? words->replace : "<censored>") : "");
|
||||
#endif
|
||||
}
|
||||
for (words = conf_badword_message; words; words = (ConfigItem_badword *) words->next) {
|
||||
#ifdef FAST_BADWORD_REPLACE
|
||||
sendto_one(sptr, ":%s %i %s :m %c %s%s%s %s",
|
||||
me.name, RPL_TEXT, sptr->name, words->type & BADW_TYPE_REGEX ? 'R' : 'F',
|
||||
(words->type & BADW_TYPE_FAST_L) ? "*" : "",
|
||||
words->word,
|
||||
(words->type & BADW_TYPE_FAST_R) ? "*" : "",
|
||||
words->action == BADWORD_REPLACE ?
|
||||
(words->replace ? words->replace : "<censored>") : "");
|
||||
#else
|
||||
sendto_one(sptr, ":%s %i %s :m %s %s", me.name, RPL_TEXT, sptr->name, words->word,
|
||||
words->action == BADWORD_REPLACE ?
|
||||
(words->replace ? words->replace : "<censored>") : "");
|
||||
|
||||
#endif
|
||||
}
|
||||
for (words = conf_badword_quit; words; words = (ConfigItem_badword *) words->next) {
|
||||
#ifdef FAST_BADWORD_REPLACE
|
||||
sendto_one(sptr, ":%s %i %s :q %c %s%s%s %s",
|
||||
me.name, RPL_TEXT, sptr->name, words->type & BADW_TYPE_REGEX ? 'R' : 'F',
|
||||
(words->type & BADW_TYPE_FAST_L) ? "*" : "",
|
||||
words->word,
|
||||
(words->type & BADW_TYPE_FAST_R) ? "*" : "",
|
||||
words->action == BADWORD_REPLACE ?
|
||||
(words->replace ? words->replace : "<censored>") : "");
|
||||
#else
|
||||
sendto_one(sptr, ":%s %i %s :q %s %s", me.name, RPL_TEXT, sptr->name, words->word,
|
||||
words->action == BADWORD_REPLACE ?
|
||||
(words->replace ? words->replace : "<censored>") : "");
|
||||
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
case 'L':
|
||||
case 'l':
|
||||
/*
|
||||
* send info about connections which match, or all if the
|
||||
* mask matches me.name. Only restrictions are on those who
|
||||
* are invisible not being visible to 'foreigners' who use
|
||||
* a wild card based search to list it.
|
||||
*/
|
||||
sendto_one(sptr, Sformat, me.name, RPL_STATSLINKINFO,
|
||||
parv[0]);
|
||||
if (IsServer(cptr))
|
||||
{
|
||||
remote = 1;
|
||||
wilds = 0;
|
||||
}
|
||||
for (i = 0; i <= LastSlot; i++)
|
||||
{
|
||||
if (!(acptr = local[i]))
|
||||
continue;
|
||||
if (IsInvisible(acptr) && (doall || wilds) &&
|
||||
!(MyConnect(sptr) && IsOper(sptr)) &&
|
||||
!IsAnOper(acptr) && (acptr != sptr))
|
||||
continue;
|
||||
if (remote && doall && !IsServer(acptr) &&
|
||||
!IsMe(acptr))
|
||||
continue;
|
||||
if (remote && !doall && IsServer(acptr))
|
||||
continue;
|
||||
if (!doall && wilds && match(name, acptr->name))
|
||||
continue;
|
||||
if (!(parc == 2 && (IsServer(acptr)
|
||||
|| (acptr->flags & FLAGS_LISTEN))) && !(doall
|
||||
|| wilds) && mycmp(name, acptr->name))
|
||||
continue;
|
||||
|
||||
#ifdef DEBUGMODE
|
||||
ircsprintf(pbuf, "%d :%d", acptr->cputime,
|
||||
(acptr->user && MyConnect(acptr)) ?
|
||||
TStime() - acptr->last : 0);
|
||||
#endif
|
||||
if (IsOper(sptr))
|
||||
{
|
||||
sendto_one(sptr, Lformat, me.name,
|
||||
RPL_STATSLINKINFO, parv[0],
|
||||
(isupper(stat)) ?
|
||||
get_client_name2(acptr, showports) :
|
||||
get_client_name(acptr, FALSE),
|
||||
get_cptr_status(acptr),
|
||||
(int)DBufLength(&acptr->sendQ),
|
||||
(int)acptr->sendM, (int)acptr->sendK,
|
||||
(int)acptr->receiveM,
|
||||
(int)acptr->receiveK,
|
||||
TStime() - acptr->firsttime,
|
||||
#ifndef DEBUGMODE
|
||||
(acptr->user && MyConnect(acptr)) ?
|
||||
TStime() - acptr->last : 0);
|
||||
#else
|
||||
pbuf);
|
||||
#endif
|
||||
if (!IsServer(acptr) && !IsMe(acptr) && IsAnOper(acptr) && sptr != acptr)
|
||||
sendto_one(acptr,
|
||||
":%s %s %s :*** %s did a /stats L on you! IP may have been shown",
|
||||
me.name, IsWebTV(acptr) ? "PRIVMSG" : "NOTICE", acptr->name, sptr->name);
|
||||
}
|
||||
else if (!strchr(acptr->name, '.'))
|
||||
sendto_one(sptr, Lformat, me.name,
|
||||
RPL_STATSLINKINFO, parv[0],
|
||||
IsHidden(acptr) ? acptr->name :
|
||||
(isupper(stat)) ? /* Potvin - PreZ */
|
||||
get_client_name2(acptr, showports) :
|
||||
get_client_name(acptr, FALSE),
|
||||
get_cptr_status(acptr),
|
||||
(int)DBufLength(&acptr->sendQ),
|
||||
(int)acptr->sendM, (int)acptr->sendK,
|
||||
(int)acptr->receiveM,
|
||||
(int)acptr->receiveK,
|
||||
TStime() - acptr->firsttime,
|
||||
#ifndef DEBUGMODE
|
||||
(acptr->user && MyConnect(acptr)) ?
|
||||
TStime() - acptr->last : 0);
|
||||
#else
|
||||
pbuf);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case 'C':
|
||||
case 'c':
|
||||
case 'H':
|
||||
case 'h':
|
||||
for (link_p = conf_link; link_p; link_p = (ConfigItem_link *) link_p->next)
|
||||
{
|
||||
sendto_one(sptr, ":%s 213 %s C %s@%s * %s %i %s %s%s%s%s%s",
|
||||
me.name, sptr->name, IsOper(sptr) ? link_p->username : "*",
|
||||
IsOper(sptr) ? link_p->hostname : "*", link_p->servername,
|
||||
link_p->port,
|
||||
link_p->class->name,
|
||||
(link_p->options & CONNECT_AUTO) ? "a" : "",
|
||||
(link_p->options & CONNECT_SSL) ? "S" : "",
|
||||
(link_p->options & CONNECT_ZIP) ? "z" : "",
|
||||
(link_p->options & CONNECT_NODNSCACHE) ? "d" : "",
|
||||
(link_p->options & CONNECT_NOHOSTCHECK) ? "h" : "");
|
||||
if (link_p->hubmask)
|
||||
{
|
||||
sendto_one(sptr, ":%s 244 %s H %s * %s",
|
||||
me.name, sptr->name, link_p->hubmask,
|
||||
link_p->servername);
|
||||
}
|
||||
else
|
||||
if (link_p->leafmask)
|
||||
{
|
||||
sendto_one(sptr, ":%s 241 %s L %s * %s %d",
|
||||
me.name, sptr->name,
|
||||
link_p->leafmask, link_p->servername, link_p->leafdepth);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'f':
|
||||
case 'F':
|
||||
report_flines(sptr);
|
||||
break;
|
||||
|
||||
case 'G':
|
||||
case 'g':
|
||||
tkl_stats(sptr);
|
||||
break;
|
||||
case 'I':
|
||||
case 'i':
|
||||
{
|
||||
ConfigItem_allow *allows;
|
||||
for (allows = conf_allow; allows; allows = (ConfigItem_allow *) allows->next) {
|
||||
sendto_one(sptr, rpl_str(RPL_STATSILINE), me.name,
|
||||
parv[0], allows->ip, allows->hostname, allows->maxperip, allows->class->name, allows->server ? allows->server : defserv, allows->port ? allows->port : 6667);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'E':
|
||||
{
|
||||
ConfigItem_except *excepts;
|
||||
for (excepts = conf_except; excepts; excepts = (ConfigItem_except *) excepts->next) {
|
||||
if (excepts->flag.type == 1)
|
||||
sendto_one(sptr, rpl_str(RPL_STATSKLINE), me.name,
|
||||
parv[0], "E", excepts->mask, "");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'e':
|
||||
{
|
||||
ConfigItem_except *excepts;
|
||||
for (excepts = conf_except; excepts;
|
||||
excepts = (ConfigItem_except *) excepts->next)
|
||||
{
|
||||
if (excepts->flag.type == 0)
|
||||
sendto_one(sptr, rpl_str(RPL_STATSELINE),
|
||||
me.name, parv[0], excepts->mask);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'K':
|
||||
case 'k':
|
||||
{
|
||||
ConfigItem_ban *bans;
|
||||
ConfigItem_except *excepts;
|
||||
char type[2];
|
||||
for (bans = conf_ban; bans; bans = (ConfigItem_ban *)bans->next) {
|
||||
if (bans->flag.type == CONF_BAN_USER) {
|
||||
if (bans->flag.type2 == CONF_BAN_TYPE_CONF)
|
||||
type[0] = 'K';
|
||||
else if (bans->flag.type2 == CONF_BAN_TYPE_AKILL)
|
||||
type[0] = 'A';
|
||||
else if (bans->flag.type2 == CONF_BAN_TYPE_TEMPORARY)
|
||||
type[0] = 'k';
|
||||
type[1] = '\0';
|
||||
sendto_one(sptr, rpl_str(RPL_STATSKLINE),
|
||||
me.name, parv[0], type, bans->mask, bans->reason ? bans->reason : "<no reason>");
|
||||
}
|
||||
else if (bans->flag.type == CONF_BAN_IP) {
|
||||
if (bans->flag.type2 == CONF_BAN_TYPE_CONF)
|
||||
type[0] = 'Z';
|
||||
else if (bans->flag.type2 == CONF_BAN_TYPE_AKILL)
|
||||
type[0] = 'S';
|
||||
else if (bans->flag.type2 == CONF_BAN_TYPE_TEMPORARY)
|
||||
type[0] = 'z';
|
||||
type[1] = '\0';
|
||||
sendto_one(sptr, rpl_str(RPL_STATSKLINE),
|
||||
me.name, parv[0], type, bans->mask, bans->reason ? bans->reason : "<no reason>");
|
||||
}
|
||||
|
||||
}
|
||||
for (excepts = conf_except; excepts; excepts = (ConfigItem_except *)excepts->next) {
|
||||
if (excepts->flag.type == 1)
|
||||
sendto_one(sptr, rpl_str(RPL_STATSKLINE),
|
||||
me.name, parv[0], "E", excepts->mask, "");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'm':
|
||||
LockEventSystem();
|
||||
EventStatus(sptr);
|
||||
UnlockEventSystem();
|
||||
break;
|
||||
|
||||
case 'M':
|
||||
for (i = 0; i <= 255; i++)
|
||||
for (mptr = CommandHash[i]; mptr; mptr = mptr->next)
|
||||
if (mptr->count)
|
||||
#ifndef DEBUGMODE
|
||||
sendto_one(sptr, rpl_str(RPL_STATSCOMMANDS),
|
||||
me.name, parv[0], mptr->cmd,
|
||||
mptr->count, mptr->bytes);
|
||||
#else
|
||||
sendto_one(sptr, rpl_str(RPL_STATSCOMMANDS),
|
||||
me.name, parv[0], mptr->cmd,
|
||||
mptr->count, mptr->bytes,
|
||||
mptr->lticks,
|
||||
mptr->lticks / CLOCKS_PER_SEC,
|
||||
mptr->rticks,
|
||||
mptr->rticks / CLOCKS_PER_SEC);
|
||||
#endif
|
||||
break;
|
||||
case 'n':
|
||||
{
|
||||
ConfigItem_ban *bans;
|
||||
|
||||
for (bans = conf_ban; bans; bans = (ConfigItem_ban *)bans->next) {
|
||||
if (bans->flag.type == CONF_BAN_REALNAME)
|
||||
sendto_one(sptr, rpl_str(RPL_STATSNLINE),
|
||||
me.name, parv[0], bans->mask, bans->reason ? bans->reason : "<no reason>");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'N':
|
||||
if (IsOper(sptr))
|
||||
report_network(sptr);
|
||||
break;
|
||||
case 'o':
|
||||
case 'O':
|
||||
for (oper_p = conf_oper; oper_p; oper_p = (ConfigItem_oper *) oper_p->next)
|
||||
{
|
||||
if (!oper_p->from)
|
||||
sendto_one(sptr, rpl_str(RPL_STATSOLINE),
|
||||
me.name, sptr->name,
|
||||
'O', "(none)", oper_p->name,
|
||||
oflagstr(oper_p->oflags),
|
||||
oper_p->class->name ? oper_p->class->name : "");
|
||||
else
|
||||
for (oper_p_from = (ConfigItem_oper_from *) oper_p->from; oper_p_from; oper_p_from = (ConfigItem_oper_from *) oper_p_from->next)
|
||||
sendto_one(sptr, rpl_str(RPL_STATSOLINE),
|
||||
me.name, sptr->name,
|
||||
'O', oper_p_from->name, oper_p->name,
|
||||
oflagstr(oper_p->oflags),
|
||||
oper_p->class->name? oper_p->class->name : "");
|
||||
}
|
||||
break;
|
||||
case 'P':
|
||||
if (IsOper(sptr))
|
||||
{
|
||||
for (i = 0; i <= LastSlot; i++)
|
||||
{
|
||||
if (!(acptr = local[i]))
|
||||
continue;
|
||||
if (!IsListening(acptr))
|
||||
continue;
|
||||
sendto_one(sptr, ":%s %s %s :*** Listener on %s:%i, clients %i. is %s",
|
||||
me.name, IsWebTV(sptr) ? "PRIVMSG" : "NOTICE", sptr->name,
|
||||
((ConfigItem_listen *)acptr->class)->ip,
|
||||
((ConfigItem_listen *)acptr->class)->port,
|
||||
((ConfigItem_listen *)acptr->class)->clients,
|
||||
((ConfigItem_listen *)acptr->class)->flag.temporary ? "TEMPORARY" : "PERM");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'Q':
|
||||
{
|
||||
ConfigItem_ban *bans;
|
||||
|
||||
for (bans = conf_ban; bans; bans = (ConfigItem_ban *)bans->next) {
|
||||
if (bans->flag.type == CONF_BAN_NICK && (bans->flag.type2 != CONF_BAN_TYPE_AKILL))
|
||||
sendto_one(sptr, rpl_str(RPL_STATSQLINE),
|
||||
me.name, parv[0], bans->reason, bans->mask);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'q':
|
||||
{
|
||||
ConfigItem_ban *bans;
|
||||
|
||||
for (bans = conf_ban; bans; bans = (ConfigItem_ban *)bans->next) {
|
||||
if (bans->flag.type == CONF_BAN_NICK && (bans->flag.type2 == CONF_BAN_TYPE_AKILL))
|
||||
sendto_one(sptr, rpl_str(RPL_SQLINE_NICK),
|
||||
me.name, parv[0], bans->mask, bans->reason ? bans->reason : "No Reason");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'R':
|
||||
#ifdef DEBUGMODE
|
||||
send_usage(sptr, parv[0]);
|
||||
#endif
|
||||
break;
|
||||
case 's':
|
||||
if (IsOper(sptr))
|
||||
{
|
||||
sendto_one(sptr, ":%s %s %s :*** SCACHE:",
|
||||
me.name, IsWebTV(sptr) ? "PRIVMSG" : "NOTICE", sptr->name);
|
||||
list_scache(sptr);
|
||||
sendto_one(sptr, ":%s %s %s :*** NS:", me.name,
|
||||
IsWebTV(sptr) ? "PRIVMSG" : "NOTICE", sptr->name);
|
||||
ns_stats(sptr);
|
||||
}
|
||||
break;
|
||||
case 'S':
|
||||
if (IsOper(sptr)) {
|
||||
report_dynconf(sptr);
|
||||
RunHook2(HOOKTYPE_STATS, sptr, "S");
|
||||
}
|
||||
break;
|
||||
case 'D':
|
||||
{
|
||||
ConfigItem_deny_link *links;
|
||||
|
||||
for (links = conf_deny_link; links; links = (ConfigItem_deny_link *) links->next) {
|
||||
if (links->flag.type == CRULE_ALL)
|
||||
sendto_one(sptr, rpl_str(RPL_STATSDLINE), me.name, sptr->name,
|
||||
"D", links->mask, links->prettyrule);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'd':
|
||||
{
|
||||
ConfigItem_deny_link *links;
|
||||
|
||||
for (links = conf_deny_link; links; links = (ConfigItem_deny_link *) links->next) {
|
||||
if (links->flag.type == CRULE_AUTO)
|
||||
sendto_one(sptr, rpl_str(RPL_STATSDLINE), me.name, sptr->name,
|
||||
"d", links->mask, links->prettyrule);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'r': {
|
||||
ConfigItem_deny_channel *dchans;
|
||||
ConfigItem_allow_channel *achans;
|
||||
for (dchans = conf_deny_channel; dchans; dchans = (ConfigItem_deny_channel *) dchans->next) {
|
||||
sendto_one(sptr, ":%s %i %s :deny %s %s", me.name, RPL_TEXT, sptr->name,
|
||||
dchans->channel, dchans->reason);
|
||||
}
|
||||
for (achans = conf_allow_channel; achans; achans = (ConfigItem_allow_channel *) achans->next) {
|
||||
sendto_one(sptr, ":%s %i %s :allow %s", me.name, RPL_TEXT, sptr->name,
|
||||
achans->channel);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 't':
|
||||
{
|
||||
ConfigItem_tld *tld;
|
||||
for (tld = conf_tld; tld; tld = (ConfigItem_tld *) tld->next)
|
||||
{
|
||||
sendto_one(sptr, rpl_str(RPL_STATSTLINE), me.name,
|
||||
parv[0], tld->mask, tld->motd_file,
|
||||
tld->rules_file ? tld->rules_file : "none");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'T': /* /stats T not t:lines .. */
|
||||
tstats(sptr, parv[0]);
|
||||
break;
|
||||
case 'U':
|
||||
{
|
||||
ConfigItem_ulines *ulines;
|
||||
for (ulines = conf_ulines; ulines;
|
||||
ulines = (ConfigItem_ulines *) ulines->next)
|
||||
{
|
||||
sendto_one(sptr, rpl_str(RPL_STATSULINE), me.name,
|
||||
parv[0], ulines->servername);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'u':
|
||||
{
|
||||
time_t tmpnow;
|
||||
|
||||
tmpnow = TStime() - me.since;
|
||||
sendto_one(sptr, rpl_str(RPL_STATSUPTIME), me.name, parv[0],
|
||||
tmpnow / 86400, (tmpnow / 3600) % 24, (tmpnow / 60) % 60,
|
||||
tmpnow % 60);
|
||||
sendto_one(sptr, rpl_str(RPL_STATSCONN), me.name, parv[0],
|
||||
max_connection_count, IRCstats.me_max);
|
||||
break;
|
||||
}
|
||||
case 'v':
|
||||
{
|
||||
ConfigItem_deny_version *versions;
|
||||
|
||||
for (versions = conf_deny_version; versions; versions = (ConfigItem_deny_version *) versions->next) {
|
||||
sendto_one(sptr, rpl_str(RPL_STATSVLINE), me.name, sptr->name,
|
||||
versions->version, versions->flags, versions->mask);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'V': {
|
||||
ConfigItem_vhost *vhosts;
|
||||
for(vhosts = conf_vhost; vhosts; vhosts = (ConfigItem_vhost *) vhosts->next) {
|
||||
for (oper_p_from = (ConfigItem_oper_from *)vhosts->from; oper_p_from; oper_p_from = (ConfigItem_oper_from *)oper_p_from->next) {
|
||||
sendto_one(sptr, ":%s %i %s :vhost %s%s%s %s %s", me.name, RPL_TEXT, sptr->name,
|
||||
vhosts->virtuser ? vhosts->virtuser : "", vhosts->virtuser ? "@" : "",
|
||||
vhosts->virthost, vhosts->login, oper_p_from->name);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'X':
|
||||
case 'x':
|
||||
for (link_p = conf_link; link_p; link_p = (ConfigItem_link *) link_p->next)
|
||||
{
|
||||
if (!find_server_quick(link_p->servername))
|
||||
{
|
||||
sendto_one(sptr, rpl_str(RPL_STATSXLINE),
|
||||
me.name, sptr->name, link_p->servername,
|
||||
link_p->port);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'Y':
|
||||
case 'y':
|
||||
{
|
||||
ConfigItem_class *classes;
|
||||
for (classes = conf_class; classes; classes = (ConfigItem_class *) classes->next) {
|
||||
sendto_one(sptr, rpl_str(RPL_STATSYLINE),
|
||||
me.name, sptr->name, classes->name, classes->pingfreq, classes->connfreq,
|
||||
classes->maxclients, classes->sendq, classes->recvq ? classes->recvq : CLIENT_FLOOD);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'Z':
|
||||
case 'z':
|
||||
if (!strcasecmp(parv[1], "zip"))
|
||||
{
|
||||
/* Ugly, but I want a '/stats zip' -- Syzop */
|
||||
if (!IsAnOper(sptr)) {
|
||||
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]);
|
||||
return 0;
|
||||
}
|
||||
#ifndef ZIP_LINKS
|
||||
sendto_one(sptr, ":%s %i %s :Sorry this server doesn't support zip links", me.name, RPL_TEXT, parv[0]);
|
||||
#else
|
||||
for (i=0; i <= LastSlot; i++)
|
||||
{
|
||||
if (!(acptr = local[i]))
|
||||
continue;
|
||||
if (!IsServer(acptr) || !IsZipped(acptr))
|
||||
continue;
|
||||
if (acptr->zip->in->total_out && acptr->zip->out->total_in)
|
||||
{
|
||||
sendto_one(sptr,
|
||||
":%s %i %s :Zipstats for link to %s (compresslevel %d): decompressed (in): %01lu/%01lu (%3.1f%%), compressed (out): %01lu/%01lu (%3.1f%%)",
|
||||
me.name, RPL_TEXT, parv[0], get_client_name(acptr, TRUE),
|
||||
acptr->serv->conf->compression_level ? acptr->serv->conf->compression_level : ZIP_DEFAULT_LEVEL,
|
||||
acptr->zip->in->total_in, acptr->zip->in->total_out,
|
||||
(100.0*(float)acptr->zip->in->total_in) /(float)acptr->zip->in->total_out,
|
||||
acptr->zip->out->total_in, acptr->zip->out->total_out,
|
||||
(100.0*(float)acptr->zip->out->total_out) /(float)acptr->zip->out->total_in);
|
||||
} else {
|
||||
sendto_one(sptr, ":%s %i %s :Zipstats for link to %s: unavailable", me.name, RPL_TEXT, parv[0]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
sendto_snomask(SNO_EYES, "Stats 'zip' requested by %s (%s@%s)",
|
||||
sptr->name, sptr->user->username, GetHost(sptr));
|
||||
stat = '*';
|
||||
break;
|
||||
} /* 'zip' */
|
||||
if (IsAnOper(sptr))
|
||||
count_memory(sptr, parv[0]);
|
||||
break;
|
||||
default:
|
||||
/* Display a help menu */
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"/Stats flags:");
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"b - Send the badwords list");
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"C - Send the link block list");
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"d - Send the deny link (auto) block list");
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"D - Send the deny link (all) block list");
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"e - Send the except socks block list");
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"E - Send the except ban block list");
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"F - Send the deny dcc block list");
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"G - Report TKL information (G:lines/Shuns)");
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"H - Send the link block list");
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"I - Send the allow block list");
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"K - Send the ban user/ban ip/except ban block list (Includes AKILLs)");
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"L - Send Link information");
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"m - Send the events list");
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"M - Send list of how many times each command was used");
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"n - Send the ban realname block list");
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"N - Send network configuration list");
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"O - Send the oper block list");
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"P - Send information about ports");
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"q - Send the SQLINE list");
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"Q - Send the ban nick block list");
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"r - Send the channel deny/allow block list");
|
||||
#ifdef DEBUGMODE
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"R - Send the usage list");
|
||||
#endif
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"s - Send the SCache and NS list");
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"S - Send the dynamic configuration list");
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"t - Send the tld block list");
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"T - Send connection information");
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"u - Send server uptime and connection count");
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"U - Send the ulines block list");
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"v - Send the deny version block list");
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"V - Send the vhost block list");
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"X - Send a list of servers that are not currently linked");
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"Y - Send the class block list");
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"Z - Send memory usage information");
|
||||
#ifdef ZIP_LINKS
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"zip - Send compression information about ziplinked servers");
|
||||
#endif
|
||||
stat = '*';
|
||||
break;
|
||||
}
|
||||
sendto_one(sptr, rpl_str(RPL_ENDOFSTATS), me.name, parv[0], stat);
|
||||
|
||||
|
||||
if (stat != '*')
|
||||
sendto_snomask(SNO_EYES, "Stats \'%c\' requested by %s (%s@%s)",
|
||||
stat, sptr->name, sptr->user->username, GetHost(sptr));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** m_summon
|
||||
** parv[0] = sender prefix
|
||||
|
||||
Reference in New Issue
Block a user