From 0388139f5d9dd88d0d26997307b1fda05c5ac016 Mon Sep 17 00:00:00 2001 From: danieldg Date: Sat, 17 Oct 2009 04:42:01 +0000 Subject: Improve m_httpd_stats; fix incorect parameter order in reloadmodule git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11885 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_httpd_stats.cpp | 55 ++++++++++++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 14 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index 5e30c90ca..cfe8f9782 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -16,7 +16,6 @@ #include "protocol.h" /* $ModDesc: Provides statistics over HTTP via m_httpd.so */ -/* $ModDep: httpd.h */ class ModuleHttpStats : public Module { @@ -67,6 +66,21 @@ class ModuleHttpStats : public Module return ret; } + void DumpMeta(std::stringstream& data, Extensible* ext) + { + data << ""; + for(ExtensibleStore::const_iterator i = ext->GetExtList().begin(); i != ext->GetExtList().end(); i++) + { + ExtensionItem* item = i->first; + std::string value = item->serialize(FORMAT_USER, ext, i->second); + if (value.empty()) + data << "key << "\"/>"; + else + data << "key << "\">" << Sanitize(value) << ""; + } + data << ""; + } + void OnEvent(Event& event) { std::stringstream data(""); @@ -80,7 +94,10 @@ class ModuleHttpStats : public Module { data << ""; - data << "" << ServerInstance->Config->ServerName << "" << Sanitize(ServerInstance->Config->ServerDesc) << ""; + data << "" << ServerInstance->Config->ServerName << "" + << Sanitize(ServerInstance->Config->ServerDesc) << "" + << Sanitize(ServerInstance->GetVersionString()) << "" + << Sanitize(ServerInstance->GetRevision()) << ""; data << ""; data << "" << ServerInstance->Users->clientlist->size() << ""; @@ -95,8 +112,7 @@ class ModuleHttpStats : public Module stime = gmtime(&server_uptime); data << "" << stime->tm_yday << "" << stime->tm_hour << "" << stime->tm_min << "" << stime->tm_sec << "" << ServerInstance->startup_time << ""; - - data << ""; + data << "" << Sanitize(ServerInstance->Config->data005) << ""; data << ""; std::vector module_names = ServerInstance->Modules->GetAllModuleNames(0); @@ -104,7 +120,7 @@ class ModuleHttpStats : public Module { Module* m = ServerInstance->Modules->Find(i->c_str()); Version v = m->GetVersion(); - data << "" << *i << "" << v.version << ""; + data << "" << *i << "" << v.version << "" << Sanitize(v.description) << ""; } data << ""; data << ""; @@ -125,9 +141,14 @@ class ModuleHttpStats : public Module for (UserMembCIter x = ulist->begin(); x != ulist->end(); ++x) { - data << "" << x->first->uuid << "" << Sanitize(c->GetAllPrefixChars(x->first)) << ""; + Membership* memb = x->second; + data << "" << memb->user->uuid << "" + << Sanitize(c->GetAllPrefixChars(x->first)) << "" + << memb->modes << ""; } + DumpMeta(data, c); + data << ""; } @@ -138,14 +159,20 @@ class ModuleHttpStats : public Module User* u = a->second; data << ""; - data << "" << u->nick << "" << u->uuid << "" << u->host << "" << u->dhost << ""; - data << "" << Sanitize(u->fullname) << "" << u->server << "" << Sanitize(u->awaymsg) << "" << Sanitize(u->oper) << ""; - std::string modes; - for (unsigned char n = 'A'; n <= 'z'; ++n) - if (u->IsModeSet(n)) - modes += n; - - data << modes << "" << Sanitize(u->ident) << "" << u->GetServerPort() << "" << u->GetIPString() << ""; + data << "" << u->nick << "" << u->uuid << "" + << u->host << "" << u->dhost << "" + << Sanitize(u->fullname) << "" << u->server << ""; + if (IS_AWAY(u)) + data << "" << Sanitize(u->awaymsg) << "" << u->awaytime << ""; + if (IS_OPER(u)) + data << "" << Sanitize(u->oper) << ""; + data << "" << u->FormatModes() << "" << Sanitize(u->ident) << ""; + if (IS_LOCAL(u)) + data << "" << u->GetServerPort() << "" << irc::sockets::satouser(&u->server_sa) << ""; + data << "" << u->GetIPString() << ""; + + DumpMeta(data, u); + data << ""; } -- cgit v1.2.3