diff options
| author | 2006-12-28 22:42:38 +0000 | |
|---|---|---|
| committer | 2006-12-28 22:42:38 +0000 | |
| commit | 59bd18f2a0b43b71ee32124add9d40d1d3a54919 (patch) | |
| tree | 2e498ff5e90f890c10a73a38e6d1d3901eb4cc4a /src/modules/extra/m_sqloper.cpp | |
| parent | Copyright header added. (diff) | |
Change the SQLutils and SQL providers to also use interfaces for proper unload order, taking away the need for a static m_sqlutils. Depend order: m_sqlutils -> sql providers (m_mysql m_pgsql) -> sql modules (m_sqlauth m_sqloper).
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6149 e03df62e-2008-0410-955e-edbf42e46eb7
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); |
