From 2bc7de2e3fb586bf47feabe95eb56b4dc069b655 Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 30 Jul 2007 19:20:59 +0000 Subject: Add servers and server user counts, module versions git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7630 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_httpd_stats.cpp | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index 70b73e13d..d685d5c63 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -30,6 +30,8 @@ typedef SortedList::iterator SortedIter; static StatsHash* sh = new StatsHash(); static SortedList* so = new SortedList(); +static StatsHash* Servers = new StatsHash(); + class ModuleHttpStats : public Module { @@ -46,7 +48,6 @@ class ModuleHttpStats : public Module ModuleHttpStats(InspIRCd* Me) : Module(Me) { - ReadConfig(); this->changed = true; } @@ -74,6 +75,18 @@ class ModuleHttpStats : public Module so->clear(); for (StatsIter a = sh->begin(); a != sh->end(); a++) InsertOrder(a->first, a->second); + for (user_hash::iterator u = ServerInstance->clientlist->begin(); u != ServerInstance->clientlist->end(); u++) + { + StatsHash::iterator n = Servers->find(u->second->server); + if (n != Servers->end()) + { + n->second++; + } + else + { + Servers->insert(std::make_pair(u->second->server,1)); + } + } this->changed = false; } @@ -96,13 +109,17 @@ class ModuleHttpStats : public Module data << "" << ServerInstance->chanlist->size() << ""; data << "" << ServerInstance->all_opers.size() << ""; data << "" << (ServerInstance->SE->GetMaxFds() - ServerInstance->SE->GetRemainingFds()) << "" << ServerInstance->SE->GetMaxFds() << - "" << ServerInstance->SE->GetName() << "')"; + "" << ServerInstance->SE->GetName() << ""; data << ""; data << ""; for (int i = 0; i <= ServerInstance->GetModuleCount(); i++) { if (!ServerInstance->Config->module_names[i].empty()) - data << "" << ServerInstance->Config->module_names[i] << ""; + { + Version v = ServerInstance->modules[i]->GetVersion(); + data << "" << ServerInstance->Config->module_names[i] << "" << + v.Major << "." << v.Minor << "." << v.Revision << "." << v.Build << ""; + } } data << ""; @@ -113,8 +130,7 @@ class ModuleHttpStats : public Module if (this->changed) this->SortList(); - int n = 0; - for (SortedIter a = so->begin(); ((a != so->end()) && (n < 25)); a++, n++) + for (SortedIter a = so->begin(); a != so->end(); a++) { chanrec* c = ServerInstance->FindChan(a->second.c_str()); if (c && !c->IsModeSet('s') && !c->IsModeSet('p')) @@ -125,11 +141,24 @@ class ModuleHttpStats : public Module data << "" << c->GetHalfoppedUsers()->size() << ""; data << "" << c->GetVoicedUsers()->size() << ""; data << "" << c->topic << ""; + data << "" << c->ChanModes(false) << ""; data << ""; } } data << ""; + + data << ""; + + for (StatsHash::iterator b = Servers->begin(); b != Servers->end(); b++) + { + data << ""; + data << "" << b->first << ""; + data << "" << b->second << ""; + data << ""; + } + data << ""; + data << ""; /* Send the document back to m_httpd */ -- cgit v1.2.3