From 1d0bb9b26b7ad58ab0bf979ac046f4511b3bf12b Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 5 May 2013 01:55:04 -0400 Subject: Rework the config file reader to be much more flexible and move many configuration directives to the actual modules they are used in. --- modules/database/db_sql_live.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'modules/database/db_sql_live.cpp') diff --git a/modules/database/db_sql_live.cpp b/modules/database/db_sql_live.cpp index 239c543c2..a7116892d 100644 --- a/modules/database/db_sql_live.cpp +++ b/modules/database/db_sql_live.cpp @@ -7,7 +7,6 @@ using namespace SQL; class DBMySQL : public Module, public Pipe { private: - Anope::string engine; Anope::string prefix; ServiceReference SQL; time_t lastwarn; @@ -29,7 +28,7 @@ class DBMySQL : public Module, public Pipe } else { - if (Anope::CurTime - Config->UpdateTimeout > lastwarn) + if (Anope::CurTime - Config->GetBlock("options")->Get("updatetimeout") > lastwarn) { Log() << "Unable to locate SQL reference, going to readonly..."; Anope::ReadOnly = this->ro = true; @@ -130,11 +129,11 @@ class DBMySQL : public Module, public Pipe init = false; } - void OnReload(ServerConfig *conf, ConfigReader &reader) anope_override + void OnReload(Configuration::Conf *conf) anope_override { - this->engine = reader.ReadValue("db_sql", "engine", "", 0); - this->SQL = ServiceReference("SQL::Provider", this->engine); - this->prefix = reader.ReadValue("db_sql", "prefix", "anope_db_", 0); + Configuration::Block *block = conf->GetModule(this); + this->SQL = ServiceReference("SQL::Provider", block->Get("engine")); + this->prefix = block->Get("prefix", "anope_db_"); } void OnSerializableConstruct(Serializable *obj) anope_override -- cgit