]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_httpd_stats.cpp
Merge pull request #1168 from SaberUK/master+fix-configure-cache-parser
[user/henk/code/inspircd.git] / src / modules / m_httpd_stats.cpp
index 983566e555967ac9c89375bd6ae32ac7b054b7f0..eb8e856acde4e150e28aab4917c916ed18673a31 100644 (file)
@@ -106,19 +106,15 @@ class ModuleHttpStats : public Module, public HTTPRequestEventListener
                                data << "<channelcount>" << ServerInstance->GetChans().size() << "</channelcount>";
                                data << "<opercount>" << ServerInstance->Users->all_opers.size() << "</opercount>";
                                data << "<socketcount>" << (SocketEngine::GetUsedFds()) << "</socketcount><socketmax>" << SocketEngine::GetMaxFds() << "</socketmax><socketengine>" INSPIRCD_SOCKETENGINE_NAME "</socketengine>";
-
-                               time_t current_time = 0;
-                               current_time = ServerInstance->Time();
-                               time_t server_uptime = current_time - ServerInstance->startup_time;
-                               struct tm* stime;
-                               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 << "<uptime><boot_time_t>" << ServerInstance->startup_time << "</boot_time_t></uptime>";
 
                                data << "<isupport>";
-                               const std::vector<std::string>& isupport = ServerInstance->ISupport.GetLines();
-                               for (std::vector<std::string>::const_iterator it = isupport.begin(); it != isupport.end(); it++)
+                               const std::vector<Numeric::Numeric>& isupport = ServerInstance->ISupport.GetLines();
+                               for (std::vector<Numeric::Numeric>::const_iterator i = isupport.begin(); i != isupport.end(); ++i)
                                {
-                                       data << Sanitize(*it) << std::endl;
+                                       const Numeric::Numeric& num = *i;
+                                       for (std::vector<std::string>::const_iterator j = num.GetParams().begin(); j != num.GetParams().end()-1; ++j)
+                                               data << "<token>" << Sanitize(*j) << "</token>" << std::endl;
                                }
                                data << "</isupport></general><xlines>";
                                std::vector<std::string> xltypes = ServerInstance->XLines->GetAllTypes();
@@ -188,7 +184,7 @@ class ModuleHttpStats : public Module, public HTTPRequestEventListener
                                        data << "<user>";
                                        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>";
+                                               << Sanitize(u->fullname) << "</gecos><server>" << u->server->GetName() << "</server>";
                                        if (u->IsAway())
                                                data << "<away>" << Sanitize(u->awaymsg) << "</away><awaytime>" << u->awaytime << "</awaytime>";
                                        if (u->IsOper())
@@ -223,7 +219,15 @@ class ModuleHttpStats : public Module, public HTTPRequestEventListener
                                        data << "</server>";
                                }
 
-                               data << "</serverlist></inspircdstats>";
+                               data << "</serverlist><commandlist>";
+
+                               const CommandParser::CommandMap& commands = ServerInstance->Parser.GetCommands();
+                               for (CommandParser::CommandMap::const_iterator i = commands.begin(); i != commands.end(); ++i)
+                               {
+                                       data << "<command><name>" << i->second->name << "</name><usecount>" << i->second->use_count << "</usecount></command>";
+                               }
+
+                               data << "</commandlist></inspircdstats>";
 
                                /* Send the document back to m_httpd */
                                HTTPDocumentResponse response(this, *http, &data, 200);