summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-17 04:42:01 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-17 04:42:01 +0000
commit0388139f5d9dd88d0d26997307b1fda05c5ac016 (patch)
treea7e16a83435634e42bc201ac86464277019e437b
parent0c71b5c584fbbe1f8488f443fced8b04ca95f160 (diff)
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
-rw-r--r--src/commands/cmd_reloadmodule.cpp2
-rw-r--r--src/modules/m_httpd_stats.cpp55
2 files changed, 42 insertions, 15 deletions
diff --git a/src/commands/cmd_reloadmodule.cpp b/src/commands/cmd_reloadmodule.cpp
index ca972fd18..76920b758 100644
--- a/src/commands/cmd_reloadmodule.cpp
+++ b/src/commands/cmd_reloadmodule.cpp
@@ -58,7 +58,7 @@ CmdResult CommandReloadmodule::Handle (const std::vector<std::string>& parameter
Module* m = ServerInstance->Modules->Find(parameters[0]);
if (m)
{
- ServerInstance->Modules->Reload(m, new ReloadModuleWorker(parameters[0], user->uuid));
+ ServerInstance->Modules->Reload(m, new ReloadModuleWorker(user->uuid, parameters[0]));
return CMD_SUCCESS;
}
else
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 << "<metadata>";
+ 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 << "<meta name=\"" << item->key << "\"/>";
+ else
+ data << "<meta name=\"" << item->key << "\">" << Sanitize(value) << "</meta>";
+ }
+ data << "</metadata>";
+ }
+
void OnEvent(Event& event)
{
std::stringstream data("");
@@ -80,7 +94,10 @@ class ModuleHttpStats : public Module
{
data << "<inspircdstats>";
- data << "<server><name>" << ServerInstance->Config->ServerName << "</name><gecos>" << Sanitize(ServerInstance->Config->ServerDesc) << "</gecos></server>";
+ data << "<server><name>" << ServerInstance->Config->ServerName << "</name><gecos>"
+ << Sanitize(ServerInstance->Config->ServerDesc) << "</gecos><version>"
+ << Sanitize(ServerInstance->GetVersionString()) << "</version><revision>"
+ << Sanitize(ServerInstance->GetRevision()) << "</revision></server>";
data << "<general>";
data << "<usercount>" << ServerInstance->Users->clientlist->size() << "</usercount>";
@@ -95,8 +112,7 @@ class ModuleHttpStats : public Module
stime = gmtime(&server_uptime);
data << "<uptime><days>" << stime->tm_yday << "</days><hours>" << stime->tm_hour << "</hours><mins>" << stime->tm_min << "</mins><secs>" << stime->tm_sec << "</secs><boot_time_t>" << ServerInstance->startup_time << "</boot_time_t></uptime>";
-
- data << "</general>";
+ data << "<isupport>" << Sanitize(ServerInstance->Config->data005) << "</isupport></general>";
data << "<modulelist>";
std::vector<std::string> 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 << "<module><name>" << *i << "</name><version>" << v.version << "</version></module>";
+ data << "<module><name>" << *i << "</name><version>" << v.version << "</version><description>" << Sanitize(v.description) << "</description></module>";
}
data << "</modulelist>";
data << "<channellist>";
@@ -125,9 +141,14 @@ class ModuleHttpStats : public Module
for (UserMembCIter x = ulist->begin(); x != ulist->end(); ++x)
{
- data << "<channelmember><uid>" << x->first->uuid << "</uid><privs>" << Sanitize(c->GetAllPrefixChars(x->first)) << "</privs></channelmember>";
+ Membership* memb = x->second;
+ data << "<channelmember><uid>" << memb->user->uuid << "</uid><privs>"
+ << Sanitize(c->GetAllPrefixChars(x->first)) << "</privs><modes>"
+ << memb->modes << "</modes></channelmember>";
}
+ DumpMeta(data, c);
+
data << "</channel>";
}
@@ -138,14 +159,20 @@ class ModuleHttpStats : public Module
User* u = a->second;
data << "<user>";
- data << "<nickname>" << u->nick << "</nickname><uuid>" << u->uuid << "</uuid><realhost>" << u->host << "</realhost><displayhost>" << u->dhost << "</displayhost>";
- data << "<gecos>" << Sanitize(u->fullname) << "</gecos><server>" << u->server << "</server><away>" << Sanitize(u->awaymsg) << "</away><opertype>" << Sanitize(u->oper) << "</opertype><modes>";
- std::string modes;
- for (unsigned char n = 'A'; n <= 'z'; ++n)
- if (u->IsModeSet(n))
- modes += n;
-
- data << modes << "</modes><ident>" << Sanitize(u->ident) << "</ident><port>" << u->GetServerPort() << "</port><ipaddress>" << u->GetIPString() << "</ipaddress>";
+ data << "<nickname>" << u->nick << "</nickname><uuid>" << u->uuid << "</uuid><realhost>"
+ << u->host << "</realhost><displayhost>" << u->dhost << "</displayhost><gecos>"
+ << Sanitize(u->fullname) << "</gecos><server>" << u->server << "</server>";
+ if (IS_AWAY(u))
+ data << "<away>" << Sanitize(u->awaymsg) << "</away><awaytime>" << u->awaytime << "</awaytime>";
+ if (IS_OPER(u))
+ data << "<opertype>" << Sanitize(u->oper) << "</opertype>";
+ data << "<modes>" << u->FormatModes() << "</modes><ident>" << Sanitize(u->ident) << "</ident>";
+ if (IS_LOCAL(u))
+ data << "<port>" << u->GetServerPort() << "</port><servaddr>" << irc::sockets::satouser(&u->server_sa) << "</servaddr>";
+ data << "<ipaddress>" << u->GetIPString() << "</ipaddress>";
+
+ DumpMeta(data, u);
+
data << "</user>";
}