diff options
Diffstat (limited to 'modules/database/db_sql.cpp')
-rw-r--r-- | modules/database/db_sql.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/modules/database/db_sql.cpp b/modules/database/db_sql.cpp index 78b05a52d..bb4d5277b 100644 --- a/modules/database/db_sql.cpp +++ b/modules/database/db_sql.cpp @@ -9,7 +9,7 @@ */ #include "module.h" -#include "../extra/sql.h" +#include "modules/sql.h" using namespace SQL; @@ -89,15 +89,12 @@ class DBSQL : public Module, public Pipe } public: - DBSQL(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, DATABASE), sql("", ""), sqlinterface(this), shutting_down(false), loading_databases(false), loaded(false), imported(false) + DBSQL(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, DATABASE | VENDOR), sql("", ""), sqlinterface(this), shutting_down(false), loading_databases(false), loaded(false), imported(false) { - this->SetAuthor("Anope"); Implementation i[] = { I_OnReload, I_OnShutdown, I_OnRestart, I_OnLoadDatabase, I_OnSerializableConstruct, I_OnSerializableDestruct, I_OnSerializableUpdate, I_OnSerializeTypeCreate }; ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation)); - this->OnReload(); - if (ModuleManager::FindModule("db_sql_live") != NULL) throw ModuleException("db_sql can not be loaded after db_sql_live"); } @@ -149,13 +146,12 @@ class DBSQL : public Module, public Pipe this->imported = true; } - void OnReload() anope_override + void OnReload(Configuration::Conf *conf) anope_override { - ConfigReader config; - Anope::string engine = config.ReadValue("db_sql", "engine", "", 0); - this->sql = ServiceReference<Provider>("SQL::Provider", engine); - this->prefix = config.ReadValue("db_sql", "prefix", "anope_db_", 0); - this->import = config.ReadFlag("db_sql", "import", "false", 0); + Configuration::Block *block = conf->GetModule(this); + this->sql = ServiceReference<Provider>("SQL::Provider", block->Get<const Anope::string>("engine")); + this->prefix = block->Get<const Anope::string>("prefix", "anope_db_"); + this->import = block->Get<bool>("import"); } void OnShutdown() anope_override |