diff options
author | Adam <Adam@anope.org> | 2013-05-05 01:55:04 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-05-05 01:55:04 -0400 |
commit | 1d0bb9b26b7ad58ab0bf979ac046f4511b3bf12b (patch) | |
tree | 4486f0784bdf050fd7eb225c0cb9df352ce1f45a /modules/extra/m_sqlite.cpp | |
parent | 781defb7076ddfddf723ca08cd0a518b6657b64f (diff) |
Rework the config file reader to be much more flexible and move many configuration directives to the actual modules they are used in.
Diffstat (limited to 'modules/extra/m_sqlite.cpp')
-rw-r--r-- | modules/extra/m_sqlite.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/modules/extra/m_sqlite.cpp b/modules/extra/m_sqlite.cpp index 9626741a0..b0f947985 100644 --- a/modules/extra/m_sqlite.cpp +++ b/modules/extra/m_sqlite.cpp @@ -77,18 +77,19 @@ class ModuleSQLite : public Module SQLiteServices.clear(); } - void OnReload(ServerConfig *conf, ConfigReader &reader) anope_override + void OnReload(Configuration::Conf *conf) anope_override { - int i, num; + Configuration::Block *config = conf->GetModule(this); for (std::map<Anope::string, SQLiteService *>::iterator it = this->SQLiteServices.begin(); it != this->SQLiteServices.end();) { const Anope::string &cname = it->first; SQLiteService *s = it->second; + int i, num; ++it; - for (i = 0, num = reader.Enumerate("sqlite"); i < num; ++i) - if (reader.ReadValue("sqlite", "name", "sqlite/main", i) == cname) + for (i = 0, num = config->CountBlock("sqlite"); i < num; ++i) + if (config->GetBlock("sqlite", i)->Get<const Anope::string &>("name", "sqlite/main") == cname) break; if (i == num) @@ -100,13 +101,14 @@ class ModuleSQLite : public Module } } - for (i = 0, num = reader.Enumerate("sqlite"); i < num; ++i) + for (int i = 0; i < config->CountBlock("sqlite"); ++i) { - Anope::string connname = reader.ReadValue("sqlite", "name", "sqlite/main", i); + Configuration::Block *block = config->GetBlock("sqlite", i); + Anope::string connname = block->Get<const Anope::string &>("name", "sqlite/main"); if (this->SQLiteServices.find(connname) == this->SQLiteServices.end()) { - Anope::string database = Anope::DataDir + "/" + reader.ReadValue("sqlite", "database", "anope", i); + Anope::string database = Anope::DataDir + "/" + block->Get<const Anope::string &>("database", "anope"); try { |