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/database/db_plain.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/database/db_plain.cpp')
-rw-r--r-- | modules/database/db_plain.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/modules/database/db_plain.cpp b/modules/database/db_plain.cpp index 11274c593..76a2aa455 100644 --- a/modules/database/db_plain.cpp +++ b/modules/database/db_plain.cpp @@ -136,7 +136,7 @@ EventReturn OnDatabaseReadMetadata(ChannelInfo *ci, const Anope::string &key, co try { if (key.equals_ci("BANTYPE")) - ci->bantype = params[0].is_pos_number_only() ? convertTo<int16_t>(params[0]) : Config->CSDefBantype; + ci->bantype = params[0].is_pos_number_only() ? convertTo<int16_t>(params[0]) : 2; else if (key.equals_ci("MEMOMAX")) ci->memos.memomax = params[0].is_pos_number_only() ? convertTo<int16_t>(params[0]) : -1; else if (key.equals_ci("FOUNDER")) @@ -618,7 +618,7 @@ class DBPlain : public Module { Log() << "Unable to back up database!"; - if (!Config->NoBackupOkay) + if (!Config->GetModule(this)->Get<bool>("nobackupok")) Anope::Quitting = true; return; @@ -626,7 +626,7 @@ class DBPlain : public Module Backups.push_back(newname); - unsigned KeepBackups = Config->KeepBackups; + unsigned KeepBackups = Config->GetModule(this)->Get<unsigned>("keepbackups"); if (KeepBackups && Backups.size() > KeepBackups) { unlink(Backups.front().c_str()); @@ -635,10 +635,12 @@ class DBPlain : public Module } } - void OnReload(ServerConfig *conf, ConfigReader &reader) anope_override + void OnReload(Configuration::Conf *conf) anope_override { - DatabaseFile = Anope::DataDir + "/" + reader.ReadValue("db_plain", "database", "anope.db", 0); - BackupFile = Anope::DataDir + "/backups/" + reader.ReadValue("db_plain", "database", "anope.db", 0); + DatabaseFile = Anope::DataDir + "/" + conf->GetModule(this)->Get<const Anope::string &>("database"); + if (DatabaseFile.empty()) + DatabaseFile = "anope.db"; + BackupFile = Anope::DataDir + "/backups/" + DatabaseFile; } EventReturn OnLoadDatabase() anope_override |