*/
#include "inspircd.h"
-#include "users.h"
-#include "channels.h"
-#include "configreader.h"
-#include "modules.h"
-#include "inspsocket.h"
#include "httpd.h"
/* $ModDesc: Provides statistics over HTTP via m_httpd.so */
+/* $ModDep: httpd.h */
typedef std::map<irc::string,int> StatsHash;
typedef StatsHash::iterator StatsIter;
data << "</general>";
data << "<modulelist>";
- for (int i = 0; i <= ServerInstance->GetModuleCount(); i++)
+ for (int i = 0; i <= ServerInstance->Modules->GetCount(); i++)
{
if (!ServerInstance->Config->module_names[i].empty())
{
- Version v = ServerInstance->modules[i]->GetVersion();
+ Version v = ServerInstance->Modules->modules[i]->GetVersion();
data << "<module><name>" << ServerInstance->Config->module_names[i] << "</name><version>" <<
v.Major << "." << v.Minor << "." << v.Revision << "." << v.Build << "</version></module>";
}
for (SortedIter a = so->begin(); a != so->end(); a++)
{
- chanrec* c = ServerInstance->FindChan(a->second.c_str());
+ Channel* c = ServerInstance->FindChan(a->second.c_str());
if (c && !c->IsModeSet('s') && !c->IsModeSet('p'))
{
data << "<channel>";
data << "</inspircdstats>";
/* Send the document back to m_httpd */
- HTTPDocument response(http->sock, &data, 200, "X-Powered-By: m_http_stats.so\r\nContent-Type: text/xml\r\n");
+ HTTPDocument response(http->sock, &data, 200);
+ response.headers.SetHeader("X-Powered-By", "m_httpd_stats.so");
+ response.headers.SetHeader("Content-Type", "text/xml");
Request req((char*)&response, (Module*)this, event->GetSource());
req.Send();
}
}
}
- void OnChannelDelete(chanrec* chan)
+ void OnChannelDelete(Channel* chan)
{
StatsIter a = sh->find(chan->name);
if (a != sh->end())
this->changed = true;
}
- void OnUserJoin(userrec* user, chanrec* channel, bool &silent)
+ void OnUserJoin(User* user, Channel* channel, bool &silent)
{
StatsIter a = sh->find(channel->name);
if (a != sh->end())
this->changed = true;
}
- void OnUserPart(userrec* user, chanrec* channel, const std::string &partmessage, bool &silent)
+ void OnUserPart(User* user, Channel* channel, const std::string &partmessage, bool &silent)
{
StatsIter a = sh->find(channel->name);
if (a != sh->end())
this->changed = true;
}
- void OnUserQuit(userrec* user, const std::string &message, const std::string &oper_message)
+ void OnUserQuit(User* user, const std::string &message, const std::string &oper_message)
{
for (UCListIter v = user->chans.begin(); v != user->chans.end(); v++)
{
- chanrec* c = v->first;
+ Channel* c = v->first;
StatsIter a = sh->find(c->name);
if (a != sh->end())
{