#include "UserNode.h"
#include "ChanNode.h"
#include "ChanUser.h"
+#include "BanNode.h"
#include "ClientSocket.h"
#include "mysqlConn.h"
#include "lang.h"
{"NS_NETINFO_UPTIME", "Uptime:"},
{"NS_NETINFO_TRAFFIC", "Traffic:"},
{"NS_NETINFO_CACHE", "Cache:"},
+ {"NS_NETINFO_DATABASE", "Database:"},
{"NS_NETINFO_CHANNEL", " Channel:"},
+ {"NS_NETINFO_CHANNEL_BAN", " Bans:"},
{"NS_NETINFO_USER", " User:"},
{"NS_NETINFO_CHANUSER", " Channel-User:"},
+ {"NS_NETINFO_OTHER", " Other:"},
{"NS_NETINFO_VERSION", "Version:"},
{"NS_NETINFO_CODE", "Code:"},
{"NS_NETINFO_CODE_VALUE", "%s lines c code (view it at http://git.pk910.de/?p=NeonServV5.git;a=summary)"},
reply(getTextBot(), user, "NS_NETINFO_HEADER");
char tmp[MAXLEN];
struct Table *table;
- table = table_init(2, 10, 0);
+ table = table_init(2, 18, 0);
char *content[2];
content[0] = get_language_string(user, "NS_NETINFO_UPTIME");
int channel_count = getChannelCount();
float channel_memory = channel_count * sizeof(struct ChanNode);
+ int channel_ban_count = getChanBanCount();
+ float channel_ban_memory = channel_ban_count * sizeof(struct BanNode);
int user_count = getUserCount();
float user_memory = user_count * sizeof(struct UserNode);
int chanuser_count = getChanUserCount();
float chanuser_memory = chanuser_count * sizeof(struct ChanUser);
- float total_memory = channel_memory + user_memory + chanuser_memory;
+ float total_memory = channel_memory + channel_ban_memory + user_memory + chanuser_memory;
content[0] = get_language_string(user, "NS_NETINFO_CACHE");
sprintf(tmp, "%.2f kB (%.2f MB)", total_memory / 1024, total_memory / 1024 / 1024);
content[1] = tmp;
table_add(table, content);
+ content[0] = get_language_string(user, "NS_NETINFO_CHANNEL_BAN");
+ sprintf(tmp, "%d %.2f kB (%d * %lu B = %.2f kB)", channel_ban_count, channel_ban_memory / 1024, channel_ban_count, sizeof(struct BanNode), channel_ban_memory / 1024);
+ content[1] = tmp;
+ table_add(table, content);
+
content[0] = get_language_string(user, "NS_NETINFO_USER");
sprintf(tmp, "%d %.2f kB (%d * %lu B = %.2f kB)", user_count, user_memory / 1024, user_count, sizeof(struct UserNode), user_memory / 1024);
content[1] = tmp;
content[1] = tmp;
table_add(table, content);
+ MYSQL_RES *res;
+ MYSQL_ROW row;
+ check_mysql();
+ printf_mysql_query("SHOW TABLE STATUS");
+ res = mysql_use();
+ int mysql_entrys[4];
+ float mysql_length[5];
+ total_memory = 0;
+ mysql_entrys[0] = 0; mysql_entrys[1] = 0; mysql_entrys[2] = 0; mysql_entrys[3] = 0;
+ mysql_length[0] = 0; mysql_length[1] = 0; mysql_length[2] = 0; mysql_length[3] = 0; mysql_length[4] = 0;
+ while ((row = mysql_fetch_row(res)) != NULL) {
+ if(!stricmp(row[0], "channels")) {
+ mysql_entrys[0] = atoi(row[4]);
+ mysql_length[0] = atof(row[6]);
+ total_memory += atof(row[6]);
+ } else if(!stricmp(row[0], "bans")) {
+ mysql_entrys[1] = atoi(row[4]);
+ mysql_length[1] = atof(row[6]);
+ total_memory += atof(row[6]);
+ } else if(!stricmp(row[0], "users")) {
+ mysql_entrys[2] = atoi(row[4]);
+ mysql_length[2] = atof(row[6]);
+ total_memory += atof(row[6]);
+ } else if(!stricmp(row[0], "chanusers")) {
+ mysql_entrys[3] = atoi(row[4]);
+ mysql_length[3] = atof(row[6]);
+ total_memory += atof(row[6]);
+ } else {
+ mysql_length[4] += atof(row[6]);
+ total_memory += atof(row[6]);
+ }
+ }
+
+ content[0] = get_language_string(user, "NS_NETINFO_DATABASE");
+ sprintf(tmp, "%.2f kB (%.2f MB)", total_memory / 1024, total_memory / 1024 / 1024);
+ content[1] = tmp;
+ table_add(table, content);
+
+ content[0] = get_language_string(user, "NS_NETINFO_CHANNEL");
+ sprintf(tmp, "%d %.2f kB", mysql_entrys[0], mysql_length[0] / 1024);
+ content[1] = tmp;
+ table_add(table, content);
+
+ content[0] = get_language_string(user, "NS_NETINFO_CHANNEL_BAN");
+ sprintf(tmp, "%d %.2f kB", mysql_entrys[1], mysql_length[1] / 1024);
+ content[1] = tmp;
+ table_add(table, content);
+
+ content[0] = get_language_string(user, "NS_NETINFO_USER");
+ sprintf(tmp, "%d %.2f kB", mysql_entrys[2], mysql_length[2] / 1024);
+ content[1] = tmp;
+ table_add(table, content);
+
+ content[0] = get_language_string(user, "NS_NETINFO_CHANUSER");
+ sprintf(tmp, "%d %.2f kB", mysql_entrys[3], mysql_length[3] / 1024);
+ content[1] = tmp;
+ table_add(table, content);
+
+ content[0] = get_language_string(user, "NS_NETINFO_OTHER");
+ sprintf(tmp, "* %.2f kB", mysql_length[4] / 1024);
+ content[1] = tmp;
+ table_add(table, content);
+
if(strcmp(revision, ""))
sprintf(tmp, "%s (%s)", NEONSERV_VERSION, revision);
else