* | Inspire Internet Relay Chat Daemon |
* +------------------------------------+
*
- * InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ * InspIRCd: (C) 2002-2008 InspIRCd Development Team
* See: http://www.inspircd.org/wiki/index.php/Credits
*
* This program is free but copyrighted software; see
*/
#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 */
{
ReadConfig();
this->changed = true;
+ Implementation eventlist[] = { I_OnEvent, I_OnRequest, I_OnChannelDelete, I_OnUserJoin, I_OnUserPart, I_OnUserQuit };
+ ServerInstance->Modules->Attach(eventlist, this, 6);
}
void InsertOrder(irc::string channel, int count)
so->clear();
for (StatsIter a = sh->begin(); a != sh->end(); a++)
InsertOrder(a->first, a->second);
- for (user_hash::iterator u = ServerInstance->clientlist->begin(); u != ServerInstance->clientlist->end(); u++)
+ for (user_hash::iterator u = ServerInstance->Users->clientlist->begin(); u != ServerInstance->Users->clientlist->end(); u++)
{
StatsHash::iterator n = Servers->find(u->second->server);
if (n != Servers->end())
data << "<server><name>" << ServerInstance->Config->ServerName << "</name><gecos>" << ServerInstance->Config->ServerDesc << "</gecos></server>";
data << "<general>";
- data << "<usercount>" << ServerInstance->clientlist->size() << "</usercount>";
+ data << "<usercount>" << ServerInstance->Users->clientlist->size() << "</usercount>";
data << "<channelcount>" << ServerInstance->chanlist->size() << "</channelcount>";
- data << "<opercount>" << ServerInstance->all_opers.size() << "</opercount>";
+ data << "<opercount>" << ServerInstance->Users->all_opers.size() << "</opercount>";
data << "<socketcount>" << (ServerInstance->SE->GetMaxFds() - ServerInstance->SE->GetRemainingFds()) << "</socketcount><socketmax>" << ServerInstance->SE->GetMaxFds() <<
"</socketmax><socketengine>" << ServerInstance->SE->GetName() << "</socketengine>";
data << "</general>";
data << "<modulelist>";
- for (int i = 0; i <= ServerInstance->GetModuleCount(); i++)
+ std::vector<std::string> module_names = ServerInstance->Modules->GetAllModuleNames(0);
+ for (std::vector<std::string>::iterator i = module_names.begin(); i != module_names.end(); ++i)
{
- if (!ServerInstance->Config->module_names[i].empty())
- {
- Version v = ServerInstance->modules[i]->GetVersion();
- data << "<module><name>" << ServerInstance->Config->module_names[i] << "</name><version>" <<
- v.Major << "." << v.Minor << "." << v.Revision << "." << v.Build << "</version></module>";
- }
+ Module* m = ServerInstance->Modules->Find(i->c_str());
+ Version v = m->GetVersion();
+ data << "<module><name>" << *i << "</name><version>" << v.Major << "." << v.Minor << "." << v.Revision << "." << v.Build << "</version></module>";
}
data << "</modulelist>";
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>";
}
}
- 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 sync, 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())
{
this->changed = true;
}
- char* OnRequest(Request* request)
+ const char* OnRequest(Request* request)
{
return NULL;
}
- void Implements(char* List)
- {
- List[I_OnEvent] = List[I_OnRequest] = List[I_OnChannelDelete] = List[I_OnUserJoin] = List[I_OnUserPart] = List[I_OnUserQuit] = 1;
- }
virtual ~ModuleHttpStats()
{
virtual Version GetVersion()
{
- return Version(1, 1, 0, 0, VF_VENDOR, API_VERSION);
+ return Version(1, 2, 0, 0, VF_VENDOR, API_VERSION);
}
};