]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_httpd_stats.cpp
Blah
[user/henk/code/inspircd.git] / src / modules / m_httpd_stats.cpp
index a52089a93e77de7e863a2453e7b12f3a6f71b616..eb9933ecc9fcef4888734bfce16aac6f7e7b551b 100644 (file)
@@ -2,34 +2,26 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
- *                    E-mail:
- *             <brain@chatspike.net>
- *               <Craig@chatspike.net>
- *     
- * Written by Craig Edwards, Craig McLure, and others.
+ *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ * See: http://www.inspircd.org/wiki/index.php/Credits
+ *
  * This program is free but copyrighted software; see
- *         the file COPYING for details.
+ *            the file COPYING for details.
  *
  * ---------------------------------------------------
  */
 
-using namespace std;
-
 #include <stdio.h>
 #include "users.h"
 #include "channels.h"
 #include "configreader.h"
 #include "modules.h"
 #include "inspsocket.h"
-#include "helperfuncs.h"
 #include "httpd.h"
 #include "inspircd.h"
 
 /* $ModDesc: Provides statistics over HTTP via m_httpd.so */
 
-
-
 typedef std::map<irc::string,int> StatsHash;
 typedef StatsHash::iterator StatsIter;
 
@@ -49,7 +41,7 @@ class ModuleHttpStats : public Module
 
        void ReadConfig()
        {
-               ConfigReader c;
+               ConfigReader c(ServerInstance);
                this->stylesheet = c.ReadValue("httpstats", "stylesheet", 0);
        }
 
@@ -110,8 +102,8 @@ class ModuleHttpStats : public Module
                                data << "<div class='totals'>";
                                data << "<h2>Totals</h2>";
                                data << "<table>";
-                               data << "<tr><td>Users</td><td>" << ServerInstance->clientlist.size() << "</td></tr>";
-                               data << "<tr><td>Channels</td><td>" << ServerInstance->chanlist.size() << "</td></tr>";
+                               data << "<tr><td>Users</td><td>" << ServerInstance->clientlist->size() << "</td></tr>";
+                               data << "<tr><td>Channels</td><td>" << ServerInstance->chanlist->size() << "</td></tr>";
                                data << "<tr><td>Opers</td><td>" << ServerInstance->all_opers.size() << "</td></tr>";
                                data << "<tr><td>Sockets</td><td>" << (ServerInstance->SE->GetMaxFds() - ServerInstance->SE->GetRemainingFds()) << " (Max: " << ServerInstance->SE->GetMaxFds() << " via socket engine '" << ServerInstance->SE->GetName() << "')</td></tr>";
                                data << "</table>";
@@ -173,7 +165,7 @@ class ModuleHttpStats : public Module
                                Request req((char*)&response, (Module*)this, event->GetSource());
                                req.Send();
 
-                               log(DEBUG,"Sent");
+                               ServerInstance->Log(DEBUG,"Sent");
                        }
                }
        }
@@ -215,16 +207,13 @@ class ModuleHttpStats : public Module
 
        void OnUserQuit(userrec* user, const std::string &message)
        {
-               for (std::vector<ucrec*>::const_iterator v = user->chans.begin(); v != user->chans.end(); v++)
+               for (UCListIter v = user->chans.begin(); v != user->chans.end(); v++)
                {
-                       if (((ucrec*)(*v))->channel)
+                       chanrec* c = v->first;
+                       StatsIter a = sh->find(c->name);
+                       if (a != sh->end())
                        {
-                               chanrec* c = ((ucrec*)(*v))->channel;
-                               StatsIter a = sh->find(c->name);
-                               if (a != sh->end())
-                               {
-                                       a->second--;
-                               }
+                               a->second--;
                        }
                }
                this->changed = true;
@@ -243,11 +232,12 @@ class ModuleHttpStats : public Module
        virtual ~ModuleHttpStats()
        {
                delete sh;
+               delete so;
        }
 
        virtual Version GetVersion()
        {
-               return Version(1,0,0,0,VF_STATIC|VF_VENDOR);
+               return Version(1, 1, 0, 0, VF_VENDOR, API_VERSION);
        }
 };