From 59bd18f2a0b43b71ee32124add9d40d1d3a54919 Mon Sep 17 00:00:00 2001 From: peavey Date: Thu, 28 Dec 2006 22:42:38 +0000 Subject: 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 --- src/modules/extra/m_pgsql.cpp | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'src/modules/extra/m_pgsql.cpp') diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index 7e782c277..dedb6a2c3 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -518,15 +518,30 @@ public: ModulePgSQL(InspIRCd* Me) : Module::Module(Me), currid(0) { - ServerInstance->Log(DEBUG, "%s 'SQL' feature", ServerInstance->PublishFeature("SQL", this) ? "Published" : "Couldn't publish"); - + ServerInstance->UseInterface("SQLutils"); + sqlsuccess = new char[strlen(SQLSUCCESS)+1]; strlcpy(sqlsuccess, SQLSUCCESS, strlen(SQLSUCCESS)+1); + if (!ServerInstance->PublishFeature("SQL", this)) + { + throw ModuleException("m_pgsql: Unable to publish feature 'SQL'"); + } + OnRehash(""); + + ServerInstance->PublishInterface("SQL", this); } + virtual ~ModulePgSQL() + { + DELETE(sqlsuccess); + ServerInstance->UnpublishInterface("SQL", this); + ServerInstance->DoneWithInterface("SQLutils"); + } + + void Implements(char* List) { List[I_OnUnloadModule] = List[I_OnRequest] = List[I_OnRehash] = List[I_OnUserRegister] = List[I_OnCheckReady] = List[I_OnUserDisconnect] = 1; @@ -658,11 +673,7 @@ public: { return Version(1, 1, 0, 0, VF_VENDOR|VF_SERVICEPROVIDER, API_VERSION); } - - virtual ~ModulePgSQL() - { - DELETE(sqlsuccess); - } + }; SQLConn::SQLConn(InspIRCd* SI, ModulePgSQL* self, const SQLhost& hi) -- cgit v1.2.3