From d02a5866d4fdedec9219aeca0a6048828b394fd2 Mon Sep 17 00:00:00 2001 From: brain Date: Thu, 10 Aug 2006 21:19:19 +0000 Subject: Mass-tidyup of module global vars, theyre no longer global vars. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4856 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/inspircd.h | 12 ++++++++++++ include/modules.h | 26 ++++++++------------------ 2 files changed, 20 insertions(+), 18 deletions(-) (limited to 'include') diff --git a/include/inspircd.h b/include/inspircd.h index 63e8c8ce5..fd7cd3da9 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -104,6 +104,11 @@ class InspIRCd : public classbase bool AllModulesReportReady(userrec* user); + int ModCount; + char LogFileName[MAXBUF]; + + featurelist Features; + public: time_t startup_time; ModeParser* ModeGrok; @@ -120,6 +125,13 @@ class InspIRCd : public classbase DNS* Res; TimerManager* Timers; + ModuleList modules; + FactoryList factory; + + int GetModuleCount(); + + Module* FindModule(const std::string &name); + void AddServerName(const std::string &servername); const char* FindServerNamePtr(const std::string &servername); bool FindServerName(const std::string &servername); diff --git a/include/modules.h b/include/modules.h index fc68db62e..6e326e00b 100644 --- a/include/modules.h +++ b/include/modules.h @@ -90,11 +90,11 @@ typedef std::map featurelist; * 'FOREACH_MOD(I_OnXonnwxr,OnConnect(user));' */ #define FOREACH_MOD(y,x) if (ServerInstance->Config->global_implementation[y] > 0) { \ - for (int _i = 0; _i <= MODCOUNT; _i++) { \ + for (int _i = 0; _i <= ServerInstance->GetModuleCount(); _i++) { \ if (ServerInstance->Config->implement_lists[_i][y]) \ try \ { \ - modules[_i]->x ; \ + ServerInstance->modules[_i]->x ; \ } \ catch (ModuleException& modexcept) \ { \ @@ -104,11 +104,11 @@ typedef std::map featurelist; } #define FOREACH_MOD_I(z,y,x) if (z->Config->global_implementation[y] > 0) { \ - for (int _i = 0; _i <= MODCOUNT; _i++) { \ + for (int _i = 0; _i <= z->GetModuleCount(); _i++) { \ if (z->Config->implement_lists[_i][y]) \ try \ { \ - modules[_i]->x ; \ + z->modules[_i]->x ; \ } \ catch (ModuleException& modexcept) \ { \ @@ -123,11 +123,11 @@ typedef std::map featurelist; */ #define FOREACH_RESULT(y,x) { if (ServerInstance->Config->global_implementation[y] > 0) { \ MOD_RESULT = 0; \ - for (int _i = 0; _i <= MODCOUNT; _i++) { \ + for (int _i = 0; _i <= ServerInstance->GetModuleCount(); _i++) { \ if (ServerInstance->Config->implement_lists[_i][y]) { \ try \ { \ - int res = modules[_i]->x ; \ + int res = ServerInstance->modules[_i]->x ; \ if (res != 0) { \ MOD_RESULT = res; \ break; \ @@ -144,11 +144,11 @@ typedef std::map featurelist; #define FOREACH_RESULT_I(z,y,x) { if (z->Config->global_implementation[y] > 0) { \ MOD_RESULT = 0; \ - for (int _i = 0; _i <= MODCOUNT; _i++) { \ + for (int _i = 0; _i <= z->GetModuleCount(); _i++) { \ if (z->Config->implement_lists[_i][y]) { \ try \ { \ - int res = modules[_i]->x ; \ + int res = z->modules[_i]->x ; \ if (res != 0) { \ MOD_RESULT = res; \ break; \ @@ -1414,12 +1414,6 @@ class Server : public Extensible */ bool IsValidMask(const std::string &mask); - /** This function finds a module by name. - * You must provide the filename of the module. If the module cannot be found (is not loaded) - * the function will return NULL. - */ - Module* FindModule(const std::string &name); - /** Adds a class derived from InspSocket to the server's socket engine. */ void AddSocket(InspSocket* sock); @@ -1438,10 +1432,6 @@ class Server : public Extensible */ void RehashServer(); - /** This method returns the total number of channels on the network. - */ - long GetChannelCount(); - /** This method returns a channel whos index is greater than or equal to 0 and less than the number returned by Server::GetChannelCount(). * This is slower (by factors of dozens) than requesting a channel by name with Server::FindChannel(), however there are times when * you wish to safely iterate the channel list, saving your position, with large amounts of time in between, which is what this function -- cgit v1.2.3