projects
/
NeonServV5.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6edd18d
)
fixed cmd_netinfo
author
pk910
<philipp@zoelle1.de>
Fri, 9 Sep 2011 05:14:03 +0000
(07:14 +0200)
committer
pk910
<philipp@zoelle1.de>
Fri, 9 Sep 2011 05:36:21 +0000
(07:36 +0200)
bot_NeonServ.c
patch
|
blob
|
history
cmd_neonserv_netinfo.c
patch
|
blob
|
history
diff --git
a/bot_NeonServ.c
b/bot_NeonServ.c
index 1bbc95688ae811c026d4304374aed39cf35ee3f4..c2aed7842234b7c4929d6aff61eb1024ba4808b2 100644
(file)
--- a/
bot_NeonServ.c
+++ b/
bot_NeonServ.c
@@
-131,6
+131,7
@@
static const struct default_language_entry msgtab[] = {
{"NS_DELBAN_FAIL", "Sorry, no ban found for \002%s\002."},
{"NS_DELBAN_DONE", "Removed \002%s\002 from the %s ban list."},
{"NS_NETINFO_HEADER", "\002Network information\002"},
{"NS_DELBAN_FAIL", "Sorry, no ban found for \002%s\002."},
{"NS_DELBAN_DONE", "Removed \002%s\002 from the %s ban list."},
{"NS_NETINFO_HEADER", "\002Network information\002"},
+ {"NS_NETINFO_BOTS", "Bots:"},
{"NS_NETINFO_UPTIME", "Uptime:"},
{"NS_NETINFO_TRAFFIC", "Traffic:"},
{"NS_NETINFO_CACHE", "Cache:"},
{"NS_NETINFO_UPTIME", "Uptime:"},
{"NS_NETINFO_TRAFFIC", "Traffic:"},
{"NS_NETINFO_CACHE", "Cache:"},
diff --git
a/cmd_neonserv_netinfo.c
b/cmd_neonserv_netinfo.c
index baf926e176b163b2329e5268830d3b7ee9c08e7c..a8aece74f697091490a63391fedb7f673486d75b 100644
(file)
--- a/
cmd_neonserv_netinfo.c
+++ b/
cmd_neonserv_netinfo.c
@@
-2,11
+2,12
@@
/*
* no args
*/
/*
* no args
*/
+
static CMD_BIND(neonserv_cmd_netinfo) {
reply(getTextBot(), user, "NS_NETINFO_HEADER");
char tmp[MAXLEN];
struct Table *table;
static CMD_BIND(neonserv_cmd_netinfo) {
reply(getTextBot(), user, "NS_NETINFO_HEADER");
char tmp[MAXLEN];
struct Table *table;
- table = table_init(2,
5
, 0);
+ table = table_init(2,
7
, 0);
char *content[2];
content[0] = get_language_string(user, "NS_NETINFO_UPTIME");
char *content[2];
content[0] = get_language_string(user, "NS_NETINFO_UPTIME");
@@
-16,7
+17,7
@@
static CMD_BIND(neonserv_cmd_netinfo) {
content[0] = get_language_string(user, "NS_NETINFO_BOTS");
struct ClientSocket *cclient;
int bot_count = 0, connected_bot_count = 0;
content[0] = get_language_string(user, "NS_NETINFO_BOTS");
struct ClientSocket *cclient;
int bot_count = 0, connected_bot_count = 0;
-
unsigned long
traffic_in = 0, traffic_out = 0;
+
float
traffic_in = 0, traffic_out = 0;
for(cclient = getBots(0, NULL); cclient; cclient = getBots(0, cclient)) {
bot_count++;
if(cclient->flags & SOCKET_FLAG_READY)
for(cclient = getBots(0, NULL); cclient; cclient = getBots(0, cclient)) {
bot_count++;
if(cclient->flags & SOCKET_FLAG_READY)
@@
-29,7
+30,7
@@
static CMD_BIND(neonserv_cmd_netinfo) {
table_add(table, content);
content[0] = get_language_string(user, "NS_NETINFO_TRAFFIC");
table_add(table, content);
content[0] = get_language_string(user, "NS_NETINFO_TRAFFIC");
- sprintf(tmp, "in: %
lu kb out: %lu
kb", traffic_in / 1024, traffic_out / 1024);
+ sprintf(tmp, "in: %
.2f kb out: %.2f
kb", traffic_in / 1024, traffic_out / 1024);
content[1] = tmp;
table_add(table, content);
content[1] = tmp;
table_add(table, content);
@@
-42,22
+43,22
@@
static CMD_BIND(neonserv_cmd_netinfo) {
float total_memory = channel_memory + user_memory + chanuser_memory;
content[0] = get_language_string(user, "NS_NETINFO_CACHE");
float total_memory = channel_memory + user_memory + chanuser_memory;
content[0] = get_language_string(user, "NS_NETINFO_CACHE");
- sprintf(tmp, "%
f kB (%
f MB)", total_memory / 1024, total_memory / 1024 / 1024);
+ sprintf(tmp, "%
.2f kB (%.2
f MB)", total_memory / 1024, total_memory / 1024 / 1024);
content[1] = tmp;
table_add(table, content);
content[0] = get_language_string(user, "NS_NETINFO_CHANNEL");
content[1] = tmp;
table_add(table, content);
content[0] = get_language_string(user, "NS_NETINFO_CHANNEL");
- sprintf(tmp, "%d %
f kB (%d * %lu B = %
f kB)", channel_count, channel_memory / 1024, channel_count, sizeof(struct ChanNode), channel_memory / 1024);
+ sprintf(tmp, "%d %
.2f kB (%d * %lu B = %.2
f kB)", channel_count, channel_memory / 1024, channel_count, sizeof(struct ChanNode), channel_memory / 1024);
content[1] = tmp;
table_add(table, content);
content[0] = get_language_string(user, "NS_NETINFO_USER");
content[1] = tmp;
table_add(table, content);
content[0] = get_language_string(user, "NS_NETINFO_USER");
- sprintf(tmp, "%d %
f kB (%d * %lu B = %
f kB)", user_count, user_memory / 1024, user_count, sizeof(struct UserNode), user_memory / 1024);
+ sprintf(tmp, "%d %
.2f kB (%d * %lu B = %.2
f kB)", user_count, user_memory / 1024, user_count, sizeof(struct UserNode), user_memory / 1024);
content[1] = tmp;
table_add(table, content);
content[0] = get_language_string(user, "NS_NETINFO_CHANUSER");
content[1] = tmp;
table_add(table, content);
content[0] = get_language_string(user, "NS_NETINFO_CHANUSER");
- sprintf(tmp, "%d %
f kB (%d * %lu B = %
f kB)", chanuser_count, chanuser_memory / 1024, chanuser_count, sizeof(struct ChanUser), chanuser_memory / 1024);
+ sprintf(tmp, "%d %
.2f kB (%d * %lu B = %.2
f kB)", chanuser_count, chanuser_memory / 1024, chanuser_count, sizeof(struct ChanUser), chanuser_memory / 1024);
content[1] = tmp;
table_add(table, content);
content[1] = tmp;
table_add(table, content);
@@
-68,3
+69,4
@@
static CMD_BIND(neonserv_cmd_netinfo) {
}
table_free(table);
}
}
table_free(table);
}
+