]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules.cpp
Move all_opers into class InspIRCd
[user/henk/code/inspircd.git] / src / modules.cpp
index da4a7e152b8354286342ca5213f16f86ed8ec663..9321047a871797906d0c201aa3370c4247e8ce9e 100644 (file)
@@ -31,7 +31,6 @@
 #include "modules.h"
 #include "dynamic.h"
 #include "wildcard.h"
-#include "message.h"
 #include "mode.h"
 #include "xline.h"
 #include "commands.h"
 #include "inspircd.h"
 
 extern InspIRCd* ServerInstance;
-extern int MODCOUNT;
-extern ModuleList modules;
-extern FactoryList factory;
 extern time_t TIME;
 extern command_table cmdlist;
 
 class Server;
 
-featurelist Features;
-
 // version is a simple class for holding a modules version number
 
 Version::Version(int major, int minor, int revision, int build, int flags)
@@ -64,13 +58,6 @@ Version::Version(int major, int minor, int revision, int build, int flags)
 {
 }
 
-// admin is a simple class for holding a server's administrative info
-
-Admin::Admin(std::string name, std::string email, std::string nick)
-: Name(name), Email(email), Nick(nick)
-{
-}
-
 Request::Request(char* anydata, Module* src, Module* dst)
 : data(anydata), source(src), dest(dst)
 {
@@ -233,14 +220,6 @@ void               Module::OnCancelAway(userrec* user) { };
  * exports in the core
  */
 
-Server::Server()
-{
-}
-
-Server::~Server()
-{
-}
-
 void Server::AddSocket(InspSocket* sock)
 {
        ServerInstance->module_sockets.push_back(sock);
@@ -256,11 +235,11 @@ void Server::RemoveSocket(InspSocket* sock)
        }
 }
 
-long Server::PriorityAfter(const std::string &modulename)
+long InspIRCd::PriorityAfter(const std::string &modulename)
 {
-       for (unsigned int j = 0; j < ServerInstance->Config->module_names.size(); j++)
+       for (unsigned int j = 0; j < this->Config->module_names.size(); j++)
        {
-               if (ServerInstance->Config->module_names[j] == modulename)
+               if (this->Config->module_names[j] == modulename)
                {
                        return ((j << 8) | PRIORITY_AFTER);
                }
@@ -268,11 +247,11 @@ long Server::PriorityAfter(const std::string &modulename)
        return PRIORITY_DONTCARE;
 }
 
-long Server::PriorityBefore(const std::string &modulename)
+long InspIRCd::PriorityBefore(const std::string &modulename)
 {
-       for (unsigned int j = 0; j < ServerInstance->Config->module_names.size(); j++)
+       for (unsigned int j = 0; j < this->Config->module_names.size(); j++)
        {
-               if (ServerInstance->Config->module_names[j] == modulename)
+               if (this->Config->module_names[j] == modulename)
                {
                        return ((j << 8) | PRIORITY_BEFORE);
                }
@@ -280,7 +259,7 @@ long Server::PriorityBefore(const std::string &modulename)
        return PRIORITY_DONTCARE;
 }
 
-bool Server::PublishFeature(const std::string &FeatureName, Module* Mod)
+bool InspIRCd::PublishFeature(const std::string &FeatureName, Module* Mod)
 {
        if (Features.find(FeatureName) == Features.end())
        {
@@ -290,7 +269,7 @@ bool Server::PublishFeature(const std::string &FeatureName, Module* Mod)
        return false;
 }
 
-bool Server::UnpublishFeature(const std::string &FeatureName)
+bool InspIRCd::UnpublishFeature(const std::string &FeatureName)
 {
        featurelist::iterator iter = Features.find(FeatureName);
        
@@ -301,7 +280,7 @@ bool Server::UnpublishFeature(const std::string &FeatureName)
        return true;
 }
 
-Module* Server::FindFeature(const std::string &FeatureName)
+Module* InspIRCd::FindFeature(const std::string &FeatureName)
 {
        featurelist::iterator iter = Features.find(FeatureName);
 
@@ -311,14 +290,14 @@ Module* Server::FindFeature(const std::string &FeatureName)
        return iter->second;
 }
 
-const std::string& Server::GetModuleName(Module* m)
+const std::string& InspIRCd::GetModuleName(Module* m)
 {
        static std::string nothing = ""; /* Prevent compiler warning */
-       for (int i = 0; i <= MODCOUNT; i++)
+       for (int i = 0; i <= this->GetModuleCount(); i++)
        {
-               if (modules[i] == m)
+               if (this->modules[i] == m)
                {
-                       return ServerInstance->Config->module_names[i];
+                       return this->Config->module_names[i];
                }
        }
        return nothing; /* As above */
@@ -330,16 +309,6 @@ void Server::RehashServer()
        ServerInstance->Config->Read(false,NULL);
 }
 
-ServerConfig* Server::GetConfig()
-{
-       return ServerInstance->Config;
-}
-
-std::string Server::GetVersion()
-{
-       return ServerInstance->GetVersionString();
-}
-
 void Server::DelSocket(InspSocket* sock)
 {
        for (std::vector<InspSocket*>::iterator a = ServerInstance->module_sockets.begin(); a < ServerInstance->module_sockets.end(); a++)
@@ -352,11 +321,6 @@ void Server::DelSocket(InspSocket* sock)
        }
 }
 
-long Server::GetChannelCount()
-{
-       return (long)ServerInstance->chanlist.size();
-}
-
 /* This is ugly, yes, but hash_map's arent designed to be
  * addressed in this manner, and this is a bit of a kludge.
  * Luckily its a specialist function and rarely used by
@@ -395,11 +359,6 @@ bool Server::IsValidModuleCommand(const std::string &commandname, int pcnt, user
        return ServerInstance->Parser->IsValidCommand(commandname, pcnt, user);
 }
 
-void Server::Log(int level, const std::string &s)
-{
-       log(level,"%s",s.c_str());
-}
-
 void Server::AddCommand(command_t *f)
 {
        if (!ServerInstance->Parser->CreateCommand(f))
@@ -430,42 +389,11 @@ void Server::DumpText(userrec* User, const std::string &LinePrefix, stringstream
        User->WriteServ(CompleteLine);
 }
 
-bool Server::IsNick(const std::string &nick)
-{
-       return (isnick(nick.c_str()) != 0);
-}
-
 userrec* Server::FindDescriptor(int socket)
 {
        return (socket < 65536 ? ServerInstance->fd_ref_table[socket] : NULL);
 }
 
-std::string Server::ChanMode(userrec* User, chanrec* Chan)
-{
-       return cmode(User,Chan);
-}
-
-std::string Server::GetServerName()
-{
-       return ServerInstance->Config->ServerName;
-}
-
-std::string Server::GetNetworkName()
-{
-       return ServerInstance->Config->Network;
-}
-
-std::string Server::GetServerDescription()
-{
-       return ServerInstance->Config->ServerDesc;
-}
-
-Admin Server::GetAdmin()
-{
-       return Admin(ServerInstance->Config->AdminName,ServerInstance->Config->AdminEmail,ServerInstance->Config->AdminNick);
-}
-
-
 bool Server::AddMode(ModeHandler* mh, const unsigned char mode)
 {
        return ServerInstance->ModeGrok->AddMode(mh,mode);
@@ -640,13 +568,13 @@ bool Server::IsValidMask(const std::string &mask)
        return true;
 }
 
-Module* Server::FindModule(const std::string &name)
+Module* InspIRCd::FindModule(const std::string &name)
 {
-       for (int i = 0; i <= MODCOUNT; i++)
+       for (int i = 0; i <= this->GetModuleCount(); i++)
        {
-               if (ServerInstance->Config->module_names[i] == name)
+               if (this->Config->module_names[i] == name)
                {
-                       return modules[i];
+                       return this->modules[i];
                }
        }
        return NULL;
@@ -747,7 +675,7 @@ void ConfigReader::DumpErrors(bool bail, userrec* user)
        if (bail)
        {
                printf("There were errors in your configuration:\n%s", this->errorlog->str().c_str());
-               Exit(0);
+               InspIRCd::Exit(ERROR);
        }
        else
        {
@@ -868,7 +796,3 @@ int FileReader::FileSize()
 }
 
 
-std::vector<Module*> modules(255);
-std::vector<ircd_module*> factory(255);
-
-int MODCOUNT  = -1;