diff options
Diffstat (limited to 'src/modules/extra/m_sqloper.cpp')
-rw-r--r-- | src/modules/extra/m_sqloper.cpp | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/src/modules/extra/m_sqloper.cpp b/src/modules/extra/m_sqloper.cpp index f548c15ee..b7a45af45 100644 --- a/src/modules/extra/m_sqloper.cpp +++ b/src/modules/extra/m_sqloper.cpp @@ -35,26 +35,20 @@ public: ModuleSQLOper(InspIRCd* Me) : Module::Module(Me), Srv(Me) { - SQLutils = Srv->FindFeature("SQLutils"); - - if (SQLutils) - { - ServerInstance->Log(DEBUG, "Successfully got SQLutils pointer"); - } - else - { - ServerInstance->Log(DEFAULT, "ERROR: This module requires a module offering the 'SQLutils' feature (usually m_sqlutils.so). Please load it and try again."); - throw ModuleException("This module requires a module offering the 'SQLutils' feature (usually m_sqlutils.so). Please load it and try again."); - } - + ServerInstance->UseInterface("SQLutils"); + ServerInstance->UseInterface("SQL"); + + SQLutils = ServerInstance->FindModule("m_sqlutils.so"); + if (!SQLutils) + throw ModuleException("Can't find m_sqlutils.so. Please load m_sqlutils.so before m_sqloper.so."); + OnRehash(""); } - virtual void OnRehash(const std::string ¶meter) + virtual ~ModuleSQLOper() { - ConfigReader Conf(Srv); - - databaseid = Conf.ReadValue("sqloper", "dbid", 0); /* Database ID of a database configured for the service provider module */ + ServerInstance->DoneWithInterface("SQL"); + ServerInstance->DoneWithInterface("SQLutils"); } void Implements(char* List) @@ -62,6 +56,13 @@ public: List[I_OnRequest] = List[I_OnRehash] = List[I_OnPreCommand] = 1; } + virtual void OnRehash(const std::string ¶meter) + { + ConfigReader Conf(Srv); + + databaseid = Conf.ReadValue("sqloper", "dbid", 0); /* Database ID of a database configured for the service provider module */ + } + virtual int OnPreCommand(const std::string &command, const char** parameters, int pcnt, userrec *user, bool validated, const std::string &original_line) { if ((validated) && (command == "OPER")) @@ -272,10 +273,6 @@ public: return false; } - virtual ~ModuleSQLOper() - { - } - virtual Version GetVersion() { return Version(1,1,1,0,VF_VENDOR,API_VERSION); |