summaryrefslogtreecommitdiff
path: root/src/modules/extra/m_pgsql.cpp
diff options
context:
space:
mode:
authorpeavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7>2006-12-28 22:42:38 +0000
committerpeavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7>2006-12-28 22:42:38 +0000
commit59bd18f2a0b43b71ee32124add9d40d1d3a54919 (patch)
tree2e498ff5e90f890c10a73a38e6d1d3901eb4cc4a /src/modules/extra/m_pgsql.cpp
parent5dce8782ebea6cfa0525a46819641737214d47d9 (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_pgsql.cpp')
-rw-r--r--src/modules/extra/m_pgsql.cpp25
1 files changed, 18 insertions, 7 deletions
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)