From fbc5d6b616ec9738579ce8800eca78716512515a Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 21 Jun 2006 12:31:54 +0000 Subject: Added Server::PublishFeature(), Server::UnpublishFeature(), Server::FindFeature(). See comments in modules.h for usage git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4041 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/modules.cpp') diff --git a/src/modules.cpp b/src/modules.cpp index 24b3e1945..b2fdc512d 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -60,6 +60,7 @@ extern command_table cmdlist; class Server; ExtModeList EMode; +featurelist Features; // returns true if an extended mode character is in use bool ModeDefined(char modechar, int type) @@ -350,6 +351,36 @@ long Server::PriorityBefore(const std::string &modulename) return PRIORITY_DONTCARE; } +bool Server::PublishFeature(std::string FeatureName, Module* Mod) +{ + if (Features.find(FeatureName) == Features.end()) + { + Features[FeatureName] = Mod; + return true; + } + return false; +} + +bool Server::UnpublishFeature(std::string FeatureName) +{ + featurelist::iterator iter = Features.find(FeatureName); + + if (iter == Features.end()) + return false; + + Features.erase(iter); +} + +Module* Server::FindFeature(std::string FeatureName) +{ + featurelist::iterator iter = Features.find(FeatureName); + + if (iter == Features.end()) + return NULL; + + return iter->second; +} + void Server::RehashServer() { WriteOpers("*** Rehashing config file"); -- cgit v1.2.3