]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_httpd_stats.cpp
Replace hardcoded mode letters passed to IsModeSet() and GetModeParameter() with...
[user/henk/code/inspircd.git] / src / modules / m_httpd_stats.cpp
index 2eb9f7cb75b87719b0ea22347fb380fdeb6a807a..faf42d071e5793d7f0c94aab7f936b154f08221c 100644 (file)
@@ -22,7 +22,7 @@
 
 
 #include "inspircd.h"
-#include "httpd.h"
+#include "modules/httpd.h"
 #include "xline.h"
 #include "protocol.h"
 
 class ModuleHttpStats : public Module
 {
        static std::map<char, char const*> const &entities;
+       HTTPdAPI API;
 
  public:
+       ModuleHttpStats()
+               : API(this)
+       {
+       }
 
-       void init()
+       void init() CXX11_OVERRIDE
        {
                Implementation eventlist[] = { I_OnEvent };
                ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
@@ -91,13 +96,13 @@ class ModuleHttpStats : public Module
                data << "</metadata>";
        }
 
-       void OnEvent(Event& event)
+       void OnEvent(Event& event) CXX11_OVERRIDE
        {
                std::stringstream data("");
 
                if (event.id == "httpd_url")
                {
-                       ServerInstance->Logs->Log("m_http_stats", LOG_DEBUG,"Handling httpd event");
+                       ServerInstance->Logs->Log("m_http_stats", LOG_DEBUG, "Handling httpd event");
                        HTTPRequest* http = (HTTPRequest*)&event;
 
                        if ((http->GetURI() == "/stats") || (http->GetURI() == "/stats/"))
@@ -196,7 +201,7 @@ class ModuleHttpStats : public Module
                                        if (u->IsAway())
                                                data << "<away>" << Sanitize(u->awaymsg) << "</away><awaytime>" << u->awaytime << "</awaytime>";
                                        if (u->IsOper())
-                                               data << "<opertype>" << Sanitize(u->oper->NameStr()) << "</opertype>";
+                                               data << "<opertype>" << Sanitize(u->oper->name) << "</opertype>";
                                        data << "<modes>" << u->FormatModes() << "</modes><ident>" << Sanitize(u->ident) << "</ident>";
                                        LocalUser* lu = IS_LOCAL(u);
                                        if (lu)
@@ -233,12 +238,12 @@ class ModuleHttpStats : public Module
                                HTTPDocumentResponse response(this, *http, &data, 200);
                                response.headers.SetHeader("X-Powered-By", "m_httpd_stats.so");
                                response.headers.SetHeader("Content-Type", "text/xml");
-                               response.Send();
+                               API->SendResponse(response);
                        }
                }
        }
 
-       virtual Version GetVersion()
+       Version GetVersion() CXX11_OVERRIDE
        {
                return Version("Provides statistics over HTTP via m_httpd.so", VF_VENDOR);
        }