From f9911dde529adf3dc03f4f14bbd70756ac2f665c Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sun, 2 Mar 2025 14:51:02 +0000 Subject: [PATCH] Return references instead of pointers from the config system. We used to return NULL from these methods but now we return an empty block so this can never actually be null now. --- include/config.h | 8 +- include/modules.h | 2 +- include/modules/sasl.h | 2 +- modules/botserv/botserv.cpp | 30 ++-- modules/botserv/bs_autoassign.cpp | 2 +- modules/botserv/bs_badwords.cpp | 4 +- modules/botserv/bs_kick.cpp | 10 +- modules/botserv/bs_set.cpp | 4 +- modules/chanserv/chanserv.cpp | 32 ++-- modules/chanserv/cs_access.cpp | 20 +-- modules/chanserv/cs_akick.cpp | 8 +- modules/chanserv/cs_ban.cpp | 12 +- modules/chanserv/cs_clone.cpp | 2 +- modules/chanserv/cs_entrymsg.cpp | 2 +- modules/chanserv/cs_fantasy_stats.cpp | 6 +- modules/chanserv/cs_fantasy_top.cpp | 6 +- modules/chanserv/cs_flags.cpp | 16 +- modules/chanserv/cs_kick.cpp | 4 +- modules/chanserv/cs_list.cpp | 6 +- modules/chanserv/cs_log.cpp | 14 +- modules/chanserv/cs_mode.cpp | 18 +- modules/chanserv/cs_register.cpp | 2 +- modules/chanserv/cs_seen.cpp | 6 +- modules/chanserv/cs_set.cpp | 18 +- modules/chanserv/cs_set_misc.cpp | 14 +- modules/chanserv/cs_suspend.cpp | 6 +- modules/chanserv/cs_xop.cpp | 24 +-- modules/chanstats.cpp | 18 +- modules/database/db_atheme.cpp | 18 +- modules/database/db_flatfile.cpp | 18 +- modules/database/db_old.cpp | 2 +- modules/database/db_redis.cpp | 6 +- modules/database/db_sql.cpp | 10 +- modules/database/db_sql_live.cpp | 10 +- modules/dns.cpp | 26 +-- modules/dnsbl.cpp | 38 ++--- modules/encryption/enc_bcrypt.cpp | 6 +- modules/encryption/enc_sha2.cpp | 4 +- modules/extra/enc_argon2.cpp | 16 +- modules/extra/ldap.cpp | 22 +-- modules/extra/mysql.cpp | 28 ++-- modules/extra/sqlite.cpp | 16 +- modules/extra/ssl_gnutls.cpp | 14 +- modules/extra/ssl_openssl.cpp | 18 +- modules/extra/xmlrpc.cpp | 4 +- modules/fantasy.cpp | 4 +- modules/global/gl_queue.cpp | 2 +- modules/global/global.cpp | 12 +- modules/help.cpp | 4 +- modules/helpchan.cpp | 2 +- modules/hostserv/hostserv.cpp | 10 +- modules/hostserv/hs_group.cpp | 8 +- modules/hostserv/hs_list.cpp | 2 +- modules/hostserv/hs_request.cpp | 16 +- modules/httpd.cpp | 22 +-- modules/irc2sql/irc2sql.cpp | 16 +- modules/irc2sql/irc2sql.h | 2 +- modules/ldap_authentication.cpp | 22 +-- modules/ldap_oper.cpp | 14 +- modules/memoserv/memoserv.cpp | 18 +- modules/memoserv/ms_ignore.cpp | 2 +- modules/memoserv/ms_rsend.cpp | 4 +- modules/memoserv/ms_send.cpp | 2 +- modules/memoserv/ms_set.cpp | 4 +- modules/nickserv/nickserv.cpp | 56 +++---- modules/nickserv/ns_ajoin.cpp | 4 +- modules/nickserv/ns_cert.cpp | 10 +- modules/nickserv/ns_drop.cpp | 4 +- modules/nickserv/ns_group.cpp | 14 +- modules/nickserv/ns_identify.cpp | 2 +- modules/nickserv/ns_list.cpp | 4 +- modules/nickserv/ns_maxemail.cpp | 6 +- modules/nickserv/ns_recover.cpp | 8 +- modules/nickserv/ns_register.cpp | 48 +++--- modules/nickserv/ns_resetpass.cpp | 10 +- modules/nickserv/ns_set.cpp | 32 ++-- modules/nickserv/ns_set_keepmodes.cpp | 2 +- modules/nickserv/ns_set_kill.cpp | 4 +- modules/nickserv/ns_set_misc.cpp | 12 +- modules/nickserv/ns_suspend.cpp | 8 +- modules/operserv/operserv.cpp | 6 +- modules/operserv/os_akill.cpp | 14 +- modules/operserv/os_chankill.cpp | 4 +- modules/operserv/os_config.cpp | 14 +- modules/operserv/os_defcon.cpp | 45 ++--- modules/operserv/os_dns.cpp | 16 +- modules/operserv/os_forbid.cpp | 8 +- modules/operserv/os_ignore.cpp | 2 +- modules/operserv/os_info.cpp | 2 +- modules/operserv/os_kill.cpp | 2 +- modules/operserv/os_list.cpp | 4 +- modules/operserv/os_logsearch.cpp | 2 +- modules/operserv/os_news.cpp | 16 +- modules/operserv/os_session.cpp | 22 +-- modules/operserv/os_set.cpp | 2 +- modules/operserv/os_shutdown.cpp | 18 +- modules/operserv/os_stats.cpp | 6 +- modules/operserv/os_sxline.cpp | 26 +-- modules/protocol/hybrid.cpp | 2 +- modules/protocol/inspircd.cpp | 6 +- modules/proxyscan.cpp | 34 ++-- modules/redis.cpp | 16 +- modules/regex_stdlib.cpp | 6 +- modules/rewrite.cpp | 16 +- modules/rpc/jsonrpc.cpp | 4 +- modules/sasl.cpp | 8 +- modules/sql_authentication.cpp | 12 +- modules/sql_log.cpp | 6 +- modules/sql_oper.cpp | 8 +- modules/webcpanel/pages/register.cpp | 2 +- modules/webcpanel/webcpanel.cpp | 8 +- src/command.cpp | 2 +- src/config.cpp | 227 +++++++++++++------------- src/init.cpp | 36 ++-- src/language.cpp | 2 +- src/mail.cpp | 26 +-- src/main.cpp | 4 +- src/messages.cpp | 6 +- src/misc.cpp | 2 +- src/modulemanager.cpp | 2 +- src/protocol.cpp | 18 +- src/uplink.cpp | 6 +- src/users.cpp | 6 +- src/xline.cpp | 4 +- 124 files changed, 811 insertions(+), 809 deletions(-) diff --git a/include/config.h b/include/config.h index 2f4f1b953..d705fd422 100644 --- a/include/config.h +++ b/include/config.h @@ -41,7 +41,7 @@ namespace Configuration Block(const Anope::string &); const Anope::string &GetName() const; int CountBlock(const Anope::string &name) const; - const Block *GetBlock(const Anope::string &name, int num = 0) const; + const Block &GetBlock(const Anope::string &name, int num = 0) const; Block *GetMutableBlock(const Anope::string &name, int num = 0); template T Get(const Anope::string &tag, const Anope::string &def = "") const @@ -126,12 +126,12 @@ namespace Configuration void LoadConf(File &file); void Post(Conf *old); - Block *GetModule(const Module *); - Block *GetModule(const Anope::string &name); + Block &GetModule(const Module *); + Block &GetModule(const Anope::string &name); BotInfo *GetClient(const Anope::string &name); - const Block *GetCommand(CommandSource &); + const Block &GetCommand(CommandSource &); }; struct Uplink final diff --git a/include/modules.h b/include/modules.h index 12637b1b4..8a7702ac7 100644 --- a/include/modules.h +++ b/include/modules.h @@ -305,7 +305,7 @@ public: * @param conf The config that is being built now and will replace the global Config object * @throws A ConfigException to abort the config (re)loading process. */ - virtual void OnReload(Configuration::Conf *conf) ATTR_NOT_NULL(2) { throw NotImplementedException(); } + virtual void OnReload(Configuration::Conf &conf) { throw NotImplementedException(); } /** Called before a bot is assigned to a channel. * @param sender The user assigning the bot diff --git a/include/modules/sasl.h b/include/modules/sasl.h index d051e2e61..5f8d0e9c3 100644 --- a/include/modules/sasl.h +++ b/include/modules/sasl.h @@ -121,7 +121,7 @@ namespace SASL if (!na || na->nc->HasExt("NS_SUSPENDED") || na->nc->HasExt("UNCONFIRMED")) return OnFail(); - unsigned int maxlogins = Config->GetModule("ns_identify")->Get("maxlogins"); + unsigned int maxlogins = Config->GetModule("ns_identify").Get("maxlogins"); if (maxlogins && na->nc->users.size() >= maxlogins) return OnFail(); diff --git a/modules/botserv/botserv.cpp b/modules/botserv/botserv.cpp index 0646668be..e77ffe46c 100644 --- a/modules/botserv/botserv.cpp +++ b/modules/botserv/botserv.cpp @@ -23,9 +23,9 @@ public: { } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - const Anope::string &bsnick = conf->GetModule(this)->Get("client"); + const Anope::string &bsnick = conf.GetModule(this).Get("client"); BotServ = BotInfo::Find(bsnick, true); } @@ -34,7 +34,7 @@ public: /* Do not allow removing bot modes on our service bots */ if (chan->ci && chan->ci->bi == user) { - const Anope::string &botmodes = Config->GetModule(this)->Get("botmodes"); + const Anope::string &botmodes = Config->GetModule(this).Get("botmodes"); for (auto botmode : botmodes) chan->SetMode(chan->ci->bi, ModeManager::FindChannelModeByChar(botmode), chan->ci->bi->GetUID()); } @@ -42,9 +42,9 @@ public: void OnBotAssign(User *sender, ChannelInfo *ci, BotInfo *bi) override { - if (ci->c && ci->c->users.size() >= Config->GetModule(this)->Get("minusers")) + if (ci->c && ci->c->users.size() >= Config->GetModule(this).Get("minusers")) { - ChannelStatus status(Config->GetModule(this)->Get("botmodes")); + ChannelStatus status(Config->GetModule(this).Get("botmodes")); bi->Join(ci->c, &status); } } @@ -55,7 +55,7 @@ public: return; BotInfo *bi = user->server == Me ? dynamic_cast(user) : NULL; - if (bi && Config->GetModule(this)->Get("smartjoin")) + if (bi && Config->GetModule(this).Get("smartjoin")) { if (IRCD->CanClearBans) { @@ -99,9 +99,9 @@ public: * legit users - Rob **/ /* This is before the user has joined the channel, so check usercount + 1 */ - if (c->users.size() + 1 >= Config->GetModule(this)->Get("minusers") && !c->FindUser(c->ci->bi)) + if (c->users.size() + 1 >= Config->GetModule(this).Get("minusers") && !c->FindUser(c->ci->bi)) { - ChannelStatus status(Config->GetModule(this)->Get("botmodes")); + ChannelStatus status(Config->GetModule(this).Get("botmodes")); c->ci->bi->Join(c, &status); } } @@ -124,7 +124,7 @@ public: return; /* This is called prior to removing the user from the channel, so c->users.size() - 1 should be safe */ - if (c->ci && c->ci->bi && u != *c->ci->bi && c->users.size() - 1 <= Config->GetModule(this)->Get("minusers") && c->FindUser(c->ci->bi)) + if (c->ci && c->ci->bi && u != *c->ci->bi && c->users.size() - 1 <= Config->GetModule(this).Get("minusers") && c->FindUser(c->ci->bi)) c->ci->bi->Part(c->ci->c); } @@ -140,7 +140,7 @@ public: "channel, and provide a more convenient way to execute commands. Commands that\n" "require a channel as a parameter will automatically have that parameter\n" "given.\n"), source.service->nick.c_str()); - const Anope::string &fantasycharacters = Config->GetModule("fantasy")->Get("fantasycharacter", "!"); + const Anope::string &fantasycharacters = Config->GetModule("fantasy").Get("fantasycharacter", "!"); if (!fantasycharacters.empty()) source.Reply(_(" \n" "Fantasy commands may be prefixed with one of the following characters: %s\n"), fantasycharacters.c_str()); @@ -170,8 +170,8 @@ public: source.Reply(_(" \n" "Bot will join a channel whenever there is at least\n" - "\002%d\002 user(s) on it."), Config->GetModule(this)->Get("minusers")); - const Anope::string &fantasycharacters = Config->GetModule("fantasy")->Get("fantasycharacter", "!"); + "\002%d\002 user(s) on it."), Config->GetModule(this).Get("minusers")); + const Anope::string &fantasycharacters = Config->GetModule("fantasy").Get("fantasycharacter", "!"); if (!fantasycharacters.empty()) source.Reply(_("Additionally, if fantasy is enabled fantasy commands\n" "can be executed by prefixing the command name with\n" @@ -180,7 +180,7 @@ public: EventReturn OnChannelModeSet(Channel *c, MessageSource &source, ChannelMode *mode, const Anope::string ¶m) override { - if (source.GetUser() && !source.GetBot() && Config->GetModule(this)->Get("smartjoin") && mode->name == "BAN" && c->ci && c->ci->bi && c->FindUser(c->ci->bi)) + if (source.GetUser() && !source.GetBot() && Config->GetModule(this).Get("smartjoin") && mode->name == "BAN" && c->ci && c->ci->bi && c->FindUser(c->ci->bi)) { BotInfo *bi = c->ci->bi; @@ -195,7 +195,7 @@ public: void OnCreateChan(ChannelInfo *ci) override { /* Set default bot flags */ - spacesepstream sep(Config->GetModule(this)->Get("defaults", "greet fantasy")); + spacesepstream sep(Config->GetModule(this).Get("defaults", "greet fantasy")); for (Anope::string token; sep.GetToken(token);) ci->Extend("BS_" + token.upper()); } @@ -211,7 +211,7 @@ public: void OnCreateBot(BotInfo *bi) override { if (bi->botmodes.empty()) - bi->botmodes = Config->GetModule(this)->Get("botumodes"); + bi->botmodes = Config->GetModule(this).Get("botumodes"); } }; diff --git a/modules/botserv/bs_autoassign.cpp b/modules/botserv/bs_autoassign.cpp index e988540fe..5292f8642 100644 --- a/modules/botserv/bs_autoassign.cpp +++ b/modules/botserv/bs_autoassign.cpp @@ -19,7 +19,7 @@ public: void OnChanRegistered(ChannelInfo *ci) override { - const Anope::string &bot = Config->GetModule(this)->Get("bot"); + const Anope::string &bot = Config->GetModule(this).Get("bot"); if (bot.empty()) return; diff --git a/modules/botserv/bs_badwords.cpp b/modules/botserv/bs_badwords.cpp index 5301fd042..95f749488 100644 --- a/modules/botserv/bs_badwords.cpp +++ b/modules/botserv/bs_badwords.cpp @@ -286,14 +286,14 @@ private: realword = word.substr(0, pos); } - unsigned badwordsmax = Config->GetModule(this->module)->Get("badwordsmax"); + unsigned badwordsmax = Config->GetModule(this->module).Get("badwordsmax"); if (badwords->GetBadWordCount() >= badwordsmax) { source.Reply(_("Sorry, you can only have %d bad words entries on a channel."), badwordsmax); return; } - bool casesensitive = Config->GetModule(this->module)->Get("casesensitive"); + bool casesensitive = Config->GetModule(this->module).Get("casesensitive"); for (unsigned i = 0, end = badwords->GetBadWordCount(); i < end; ++i) { diff --git a/modules/botserv/bs_kick.cpp b/modules/botserv/bs_kick.cpp index caaa51b01..eba2868a6 100644 --- a/modules/botserv/bs_kick.cpp +++ b/modules/botserv/bs_kick.cpp @@ -515,8 +515,8 @@ public: if (kd->floodsecs < 1) kd->floodsecs = 10; - if (kd->floodsecs > Config->GetModule(me)->Get("keepdata")) - kd->floodsecs = Config->GetModule(me)->Get("keepdata"); + if (kd->floodsecs > Config->GetModule(me).Get("keepdata")) + kd->floodsecs = Config->GetModule(me).Get("keepdata"); kd->flood = true; if (kd->ttb[TTB_FLOOD]) @@ -913,7 +913,7 @@ public: void purge() { - time_t keepdata = Config->GetModule(me)->Get("keepdata"); + time_t keepdata = Config->GetModule(me).Get("keepdata"); for (data_type::iterator it = data_map.begin(), it_end = data_map.end(); it != it_end;) { const Anope::string &user = it->first; @@ -1299,7 +1299,7 @@ public: /* Normalize the buffer */ Anope::string nbuf = Anope::NormalizeBuffer(realbuf); - bool casesensitive = Config->GetModule("botserv")->Get("casesensitive"); + bool casesensitive = Config->GetModule("botserv").Get("casesensitive"); /* Normalize can return an empty string if this only contains control codes etc */ if (badwords && !nbuf.empty()) @@ -1368,7 +1368,7 @@ public: if (mustkick) { check_ban(ci, u, kd, TTB_BADWORDS); - if (Config->GetModule(me)->Get("gentlebadwordreason")) + if (Config->GetModule(me).Get("gentlebadwordreason")) bot_kick(ci, u, _("Watch your language!")); else bot_kick(ci, u, _("Don't use the word \"%s\" on this channel!"), bw->word.c_str()); diff --git a/modules/botserv/bs_set.cpp b/modules/botserv/bs_set.cpp index 1ab00205d..9b536e19a 100644 --- a/modules/botserv/bs_set.cpp +++ b/modules/botserv/bs_set.cpp @@ -33,8 +33,8 @@ public: source.Reply(_("Configures bot options.\n" " \n" "Available options:")); - bool hide_privileged_commands = Config->GetBlock("options")->Get("hideprivilegedcommands"), - hide_registered_commands = Config->GetBlock("options")->Get("hideregisteredcommands"); + bool hide_privileged_commands = Config->GetBlock("options").Get("hideprivilegedcommands"), + hide_registered_commands = Config->GetBlock("options").Get("hideregisteredcommands"); Anope::string this_name = source.command; for (const auto &[c_name, info] : source.service->commands) { diff --git a/modules/chanserv/chanserv.cpp b/modules/chanserv/chanserv.cpp index f4ba4c007..cca234812 100644 --- a/modules/chanserv/chanserv.cpp +++ b/modules/chanserv/chanserv.cpp @@ -14,8 +14,8 @@ inline static Anope::string BotModes() { - return Config->GetModule("botserv")->Get("botmodes", - Config->GetModule("chanserv")->Get("botmodes", "o") + return Config->GetModule("botserv").Get("botmodes", + Config->GetModule("chanserv").Get("botmodes", "o") ); } @@ -52,7 +52,7 @@ public: * @param chan The channel */ ChanServTimer(Reference &cs, ExtensibleItem &i, Module *m, Channel *chan) - : Timer(m, Config->GetModule(m)->Get("inhabit", "1m")) + : Timer(m, Config->GetModule(m).Get("inhabit", "1m")) , ChanServ(cs) , inhabit(i) , c(chan) @@ -103,9 +103,9 @@ public: new ChanServTimer(ChanServ, inhabit, this->owner, c); } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - const Anope::string &channick = conf->GetModule(this)->Get("client"); + const Anope::string &channick = conf.GetModule(this).Get("client"); if (channick.empty()) throw ConfigException(Module::name + ": must be defined"); @@ -116,7 +116,7 @@ public: ChanServ = bi; - spacesepstream(conf->GetModule(this)->Get("defaults", "keeptopic peace securefounder signkick")).GetTokens(defaults); + spacesepstream(conf.GetModule(this).Get("defaults", "keeptopic peace securefounder signkick")).GetTokens(defaults); if (defaults.empty()) { defaults.emplace_back("KEEPTOPIC"); @@ -127,7 +127,7 @@ public: else if (defaults[0].equals_ci("none")) defaults.clear(); - always_lower = conf->GetModule(this)->Get("always_lower_ts"); + always_lower = conf.GetModule(this).Get("always_lower_ts"); } void OnBotDelete(BotInfo *bi) override @@ -138,7 +138,7 @@ public: EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message, const Anope::map &tags) override { - if (bi == ChanServ && Config->GetModule(this)->Get("opersonly") && !u->HasMode("OPER")) + if (bi == ChanServ && Config->GetModule(this).Get("opersonly") && !u->HasMode("OPER")) { u->SendMessage(bi, ACCESS_DENIED); return EVENT_STOP; @@ -151,7 +151,7 @@ public: { std::deque chans; nc->GetChannelReferences(chans); - int max_reg = Config->GetModule(this)->Get("maxregistered"); + int max_reg = Config->GetModule(this).Get("maxregistered"); for (auto *ci : chans) { @@ -247,7 +247,7 @@ public: { ci->c->RemoveMode(ci->WhoSends(), "REGISTERED", "", false); - const Anope::string &require = Config->GetModule(this)->Get("require"); + const Anope::string &require = Config->GetModule(this).Get("require"); if (!require.empty()) ci->c->SetModes(ci->WhoSends(), false, "-%s", require.c_str()); } @@ -272,7 +272,7 @@ public: { if (!params.empty() || source.c || source.service != *ChanServ) return; - time_t chanserv_expire = Config->GetModule(this)->Get("expire", "30d"); + time_t chanserv_expire = Config->GetModule(this).Get("expire", "30d"); if (chanserv_expire >= 86400) source.Reply(_(" \n" "Note that any channel which is not used for %lu days\n" @@ -295,7 +295,7 @@ public: else c->RemoveMode(c->WhoSends(), "REGISTERED", "", false); - const Anope::string &require = Config->GetModule(this)->Get("require"); + const Anope::string &require = Config->GetModule(this).Get("require"); if (!require.empty()) { if (c->ci) @@ -314,8 +314,8 @@ public: EventReturn OnCanSet(User *u, const ChannelMode *cm) override { - if (Config->GetModule(this)->Get("nomlock").find(cm->mchar) != Anope::string::npos - || Config->GetModule(this)->Get("require").find(cm->mchar) != Anope::string::npos) + if (Config->GetModule(this).Get("nomlock").find(cm->mchar) != Anope::string::npos + || Config->GetModule(this).Get("require").find(cm->mchar) != Anope::string::npos) return EVENT_STOP; return EVENT_CONTINUE; } @@ -337,7 +337,7 @@ public: void OnExpireTick() override { - time_t chanserv_expire = Config->GetModule(this)->Get("expire", "30d"); + time_t chanserv_expire = Config->GetModule(this).Get("expire", "30d"); if (!chanserv_expire || Anope::NoExpire || Anope::ReadOnly) return; @@ -467,7 +467,7 @@ public: if (!show_all) return; - time_t chanserv_expire = Config->GetModule(this)->Get("expire", "30d"); + time_t chanserv_expire = Config->GetModule(this).Get("expire", "30d"); if (!ci->HasExt("CS_NO_EXPIRE") && chanserv_expire && !Anope::NoExpire && ci->last_used != Anope::CurTime) info[_("Expires")] = Anope::strftime(ci->last_used + chanserv_expire, source.GetAccount()); } diff --git a/modules/chanserv/cs_access.cpp b/modules/chanserv/cs_access.cpp index dcae83ae7..5f13f56df 100644 --- a/modules/chanserv/cs_access.cpp +++ b/modules/chanserv/cs_access.cpp @@ -134,7 +134,7 @@ class CommandCSAccess final if (IRCD->IsChannelValid(mask)) { - if (Config->GetModule("chanserv")->Get("disallow_channel_access")) + if (Config->GetModule("chanserv").Get("disallow_channel_access")) { source.Reply(_("Channels may not be on access lists.")); return; @@ -158,7 +158,7 @@ class CommandCSAccess final { na = NickAlias::Find(mask); - if (!na && Config->GetModule("chanserv")->Get("disallow_hostmask_access")) + if (!na && Config->GetModule("chanserv").Get("disallow_hostmask_access")) { source.Reply(_("Masks and unregistered users may not be on access lists.")); return; @@ -205,7 +205,7 @@ class CommandCSAccess final } } - unsigned access_max = Config->GetModule("chanserv")->Get("accessmax", "1000"); + unsigned access_max = Config->GetModule("chanserv").Get("accessmax", "1000"); if (access_max && ci->GetDeepAccessCount() >= access_max) { source.Reply(_("Sorry, you can only have %d access entries on a channel, including access entries from other channels."), access_max); @@ -601,7 +601,7 @@ public: "may be a numerical level or the name of a privilege (eg AUTOOP).\n" "When a user joins the channel the access they receive is from the\n" "highest level entry in the access list.")); - if (!Config->GetModule("chanserv")->Get("disallow_channel_access")) + if (!Config->GetModule("chanserv").Get("disallow_channel_access")) source.Reply(_("The given mask may also be a channel, which will use the\n" "access list from the other channel up to the given \037level\037.")); source.Reply(" "); @@ -878,21 +878,21 @@ public: } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { defaultLevels.clear(); - for (int i = 0; i < conf->CountBlock("privilege"); ++i) + for (int i = 0; i < conf.CountBlock("privilege"); ++i) { - Configuration::Block *priv = conf->GetBlock("privilege", i); + Configuration::Block &priv = conf.GetBlock("privilege", i); - const Anope::string &pname = priv->Get("name"); + const Anope::string &pname = priv.Get("name"); Privilege *p = PrivilegeManager::FindPrivilege(pname); if (p == NULL) continue; - const Anope::string &value = priv->Get("level"); + const Anope::string &value = priv.Get("level"); if (value.empty()) continue; else if (value.equals_ci("founder")) @@ -900,7 +900,7 @@ public: else if (value.equals_ci("disabled")) defaultLevels[p->name] = ACCESS_INVALID; else - defaultLevels[p->name] = priv->Get("level"); + defaultLevels[p->name] = priv.Get("level"); } } diff --git a/modules/chanserv/cs_akick.cpp b/modules/chanserv/cs_akick.cpp index 489b18772..ad58a814b 100644 --- a/modules/chanserv/cs_akick.cpp +++ b/modules/chanserv/cs_akick.cpp @@ -46,7 +46,7 @@ class CommandCSAKick final const NickAlias *na = NickAlias::Find(mask); NickCore *nc = NULL; const AutoKick *akick; - unsigned reasonmax = Config->GetModule("chanserv")->Get("reasonmax", "200"); + unsigned reasonmax = Config->GetModule("chanserv").Get("reasonmax", "200"); if (reason.length() > reasonmax) reason = reason.substr(0, reasonmax); @@ -170,9 +170,9 @@ class CommandCSAKick final } } - if (ci->GetAkickCount() >= Config->GetModule(this->owner)->Get("autokickmax")) + if (ci->GetAkickCount() >= Config->GetModule(this->owner).Get("autokickmax")) { - source.Reply(_("Sorry, you can only have %d autokick masks on a channel."), Config->GetModule(this->owner)->Get("autokickmax")); + source.Reply(_("Sorry, you can only have %d autokick masks on a channel."), Config->GetModule(this->owner).Get("autokickmax")); return; } @@ -568,7 +568,7 @@ public: reason = autokick->reason; if (reason.empty()) { - reason = Language::Translate(u, Config->GetModule(this)->Get("autokickreason").c_str()); + reason = Language::Translate(u, Config->GetModule(this).Get("autokickreason").c_str()); reason = reason.replace_all_cs("%n", u->nick) .replace_all_cs("%c", c->name); } diff --git a/modules/chanserv/cs_ban.cpp b/modules/chanserv/cs_ban.cpp index 9f2b691ef..74dc129f4 100644 --- a/modules/chanserv/cs_ban.cpp +++ b/modules/chanserv/cs_ban.cpp @@ -50,8 +50,8 @@ public: void Execute(CommandSource &source, const std::vector ¶ms) override { - Configuration::Block *block = Config->GetCommand(source); - const Anope::string &mode = block->Get("mode", "BAN"); + Configuration::Block &block = Config->GetCommand(source); + const Anope::string &mode = block.Get("mode", "BAN"); ChannelMode *cm = ModeManager::FindChannelModeByName(mode); if (cm == NULL) return; @@ -107,11 +107,11 @@ public: reason += " " + params[3]; } - unsigned reasonmax = Config->GetModule("chanserv")->Get("reasonmax", "200"); + unsigned reasonmax = Config->GetModule("chanserv").Get("reasonmax", "200"); if (reason.length() > reasonmax) reason = reason.substr(0, reasonmax); - Anope::string signkickformat = Config->GetModule("chanserv")->Get("signkickformat", "%m (%n)"); + Anope::string signkickformat = Config->GetModule("chanserv").Get("signkickformat", "%m (%n)"); signkickformat = signkickformat.replace_all_cs("%n", source.GetNick()); User *u = source.GetUser(); @@ -156,7 +156,7 @@ public: if (!c->FindUser(u2)) return; - if (block->Get("kick", "yes")) + if (block.Get("kick", "yes")) { if (ci->HasExt("SIGNKICK") || (ci->HasExt("SIGNKICK_LEVEL") && !source.AccessFor(ci).HasPriv("SIGNKICK"))) { @@ -209,7 +209,7 @@ public: else if (uc->user->IsProtected()) continue; - if (block->Get("kick", "yes")) + if (block.Get("kick", "yes")) { ++kicked; if (ci->HasExt("SIGNKICK") || (ci->HasExt("SIGNKICK_LEVEL") && !u_access.HasPriv("SIGNKICK"))) diff --git a/modules/chanserv/cs_clone.cpp b/modules/chanserv/cs_clone.cpp index 6f29a235c..5e4130532 100644 --- a/modules/chanserv/cs_clone.cpp +++ b/modules/chanserv/cs_clone.cpp @@ -24,7 +24,7 @@ class CommandCSClone final static void CopyAccess(CommandSource &source, ChannelInfo *ci, ChannelInfo *target_ci) { std::set masks; - unsigned access_max = Config->GetModule("chanserv")->Get("accessmax", "1000"); + unsigned access_max = Config->GetModule("chanserv").Get("accessmax", "1000"); unsigned count = 0; for (unsigned i = 0; i < target_ci->GetAccessCount(); ++i) diff --git a/modules/chanserv/cs_entrymsg.cpp b/modules/chanserv/cs_entrymsg.cpp index b1546428d..9f76c9d50 100644 --- a/modules/chanserv/cs_entrymsg.cpp +++ b/modules/chanserv/cs_entrymsg.cpp @@ -142,7 +142,7 @@ private: { EntryMessageList *messages = ci->Require("entrymsg"); - if ((*messages)->size() >= Config->GetModule(this->owner)->Get("maxentries")) + if ((*messages)->size() >= Config->GetModule(this->owner).Get("maxentries")) source.Reply(_("The entry message list for \002%s\002 is full."), ci->name.c_str()); else { diff --git a/modules/chanserv/cs_fantasy_stats.cpp b/modules/chanserv/cs_fantasy_stats.cpp index eae70f116..096bb6a31 100644 --- a/modules/chanserv/cs_fantasy_stats.cpp +++ b/modules/chanserv/cs_fantasy_stats.cpp @@ -77,10 +77,10 @@ public: } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - prefix = conf->GetModule("chanstats")->Get("prefix", "anope_"); - this->sql = ServiceReference("SQL::Provider", conf->GetModule("chanstats")->Get("engine")); + prefix = conf.GetModule("chanstats").Get("prefix", "anope_"); + this->sql = ServiceReference("SQL::Provider", conf.GetModule("chanstats").Get("engine")); } SQL::Result RunQuery(const SQL::Query &query) diff --git a/modules/chanserv/cs_fantasy_top.cpp b/modules/chanserv/cs_fantasy_top.cpp index 83cd6bee5..d2ebf277b 100644 --- a/modules/chanserv/cs_fantasy_top.cpp +++ b/modules/chanserv/cs_fantasy_top.cpp @@ -104,10 +104,10 @@ public: } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - prefix = conf->GetModule("chanstats")->Get("prefix", "anope_"); - this->sql = ServiceReference("SQL::Provider", conf->GetModule("chanstats")->Get("engine")); + prefix = conf.GetModule("chanstats").Get("prefix", "anope_"); + this->sql = ServiceReference("SQL::Provider", conf.GetModule("chanstats").Get("engine")); } SQL::Result RunQuery(const SQL::Query &query) diff --git a/modules/chanserv/cs_flags.cpp b/modules/chanserv/cs_flags.cpp index 691319634..876eb67e4 100644 --- a/modules/chanserv/cs_flags.cpp +++ b/modules/chanserv/cs_flags.cpp @@ -93,7 +93,7 @@ class CommandCSFlags final if (IRCD->IsChannelValid(mask)) { - if (Config->GetModule("chanserv")->Get("disallow_channel_access")) + if (Config->GetModule("chanserv").Get("disallow_channel_access")) { source.Reply(_("Channels may not be on access lists.")); return; @@ -116,7 +116,7 @@ class CommandCSFlags final else { na = NickAlias::Find(mask); - if (!na && Config->GetModule("chanserv")->Get("disallow_hostmask_access")) + if (!na && Config->GetModule("chanserv").Get("disallow_hostmask_access")) { source.Reply(_("Masks and unregistered users may not be on access lists.")); return; @@ -179,7 +179,7 @@ class CommandCSFlags final } } - unsigned access_max = Config->GetModule("chanserv")->Get("accessmax", "1000"); + unsigned access_max = Config->GetModule("chanserv").Get("accessmax", "1000"); if (access_max && ci->GetDeepAccessCount() >= access_max) { source.Reply(_("Sorry, you can only have %d access entries on a channel, including access entries from other channels."), access_max); @@ -494,21 +494,21 @@ public: } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { defaultFlags.clear(); - for (int i = 0; i < conf->CountBlock("privilege"); ++i) + for (int i = 0; i < conf.CountBlock("privilege"); ++i) { - Configuration::Block *priv = conf->GetBlock("privilege", i); + Configuration::Block &priv = conf.GetBlock("privilege", i); - const Anope::string &pname = priv->Get("name"); + const Anope::string &pname = priv.Get("name"); Privilege *p = PrivilegeManager::FindPrivilege(pname); if (p == NULL) continue; - const Anope::string &value = priv->Get("flag"); + const Anope::string &value = priv.Get("flag"); if (value.empty()) continue; diff --git a/modules/chanserv/cs_kick.cpp b/modules/chanserv/cs_kick.cpp index dfcd2995c..210a5168c 100644 --- a/modules/chanserv/cs_kick.cpp +++ b/modules/chanserv/cs_kick.cpp @@ -44,11 +44,11 @@ public: return; } - unsigned reasonmax = Config->GetModule("chanserv")->Get("reasonmax", "200"); + unsigned reasonmax = Config->GetModule("chanserv").Get("reasonmax", "200"); if (reason.length() > reasonmax) reason = reason.substr(0, reasonmax); - Anope::string signkickformat = Config->GetModule("chanserv")->Get("signkickformat", "%m (%n)"); + Anope::string signkickformat = Config->GetModule("chanserv").Get("signkickformat", "%m (%n)"); signkickformat = signkickformat.replace_all_cs("%n", source.GetNick()); AccessGroup u_access = source.AccessFor(ci); diff --git a/modules/chanserv/cs_list.cpp b/modules/chanserv/cs_list.cpp index 429b87d4d..e8feabed4 100644 --- a/modules/chanserv/cs_list.cpp +++ b/modules/chanserv/cs_list.cpp @@ -68,7 +68,7 @@ public: } Anope::string spattern = "#" + pattern; - unsigned listmax = Config->GetModule(this->owner)->Get("listmax", "50"); + unsigned listmax = Config->GetModule(this->owner).Get("listmax", "50"); source.Reply(_("List of entries matching \002%s\002:"), pattern.c_str()); @@ -160,11 +160,11 @@ public: " \002LIST #51-100\002\n" " Lists all registered channels within the given range (51-100).")); - if (!Config->GetBlock("options")->Get("regexengine").empty()) + if (!Config->GetBlock("options").Get("regexengine").empty()) { source.Reply(" "); source.Reply(_("Regex matches are also supported using the %s engine.\n" - "Enclose your pattern in // if this is desired."), Config->GetBlock("options")->Get("regexengine").c_str()); + "Enclose your pattern in // if this is desired."), Config->GetBlock("options").Get("regexengine").c_str()); } return true; diff --git a/modules/chanserv/cs_log.cpp b/modules/chanserv/cs_log.cpp index f3a32daed..e91a3f731 100644 --- a/modules/chanserv/cs_log.cpp +++ b/modules/chanserv/cs_log.cpp @@ -308,20 +308,20 @@ public: } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - Configuration::Block *block = conf->GetModule(this); + Configuration::Block &block = conf.GetModule(this); defaults.clear(); - for (int i = 0; i < block->CountBlock("default"); ++i) + for (int i = 0; i < block.CountBlock("default"); ++i) { - Configuration::Block *def = block->GetBlock("default", i); + Configuration::Block &def = block.GetBlock("default", i); LogDefault ld; - ld.service = def->Get("service"); - ld.command = def->Get("command"); - ld.method = def->Get("method"); + ld.service = def.Get("service"); + ld.command = def.Get("command"); + ld.method = def.Get("method"); defaults.push_back(ld); } diff --git a/modules/chanserv/cs_mode.cpp b/modules/chanserv/cs_mode.cpp index 47e2b84ad..cc7a526cd 100644 --- a/modules/chanserv/cs_mode.cpp +++ b/modules/chanserv/cs_mode.cpp @@ -336,7 +336,7 @@ class CommandCSMode final continue; } - if (modelocks->GetMLock().size() >= Config->GetModule(this->owner)->Get("max", "50")) + if (modelocks->GetMLock().size() >= Config->GetModule(this->owner).Get("max", "50")) { source.Reply(_("The mode lock list of \002%s\002 is full."), ci->name.c_str()); continue; @@ -946,22 +946,22 @@ public: } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { modes.clear(); - for (int i = 0; i < conf->CountBlock("command"); ++i) + for (int i = 0; i < conf.CountBlock("command"); ++i) { - Configuration::Block *block = conf->GetBlock("command", i); + Configuration::Block &block = conf.GetBlock("command", i); - const Anope::string &cname = block->Get("name"), - &cmd = block->Get("command"); + const Anope::string &cname = block.Get("name"), + &cmd = block.Get("command"); if (cname.empty() || cmd != "chanserv/modes") continue; - const Anope::string &set = block->Get("set"), - &unset = block->Get("unset"); + const Anope::string &set = block.Get("set"), + &unset = block.Get("unset"); if (set.empty() && unset.empty()) continue; @@ -1024,7 +1024,7 @@ public: { ModeLocks *ml = modelocks.Require(ci); Anope::string mlock; - spacesepstream sep(Config->GetModule(this)->Get("mlock", "+nt")); + spacesepstream sep(Config->GetModule(this).Get("mlock", "+nt")); if (sep.GetToken(mlock)) { bool add = true; diff --git a/modules/chanserv/cs_register.cpp b/modules/chanserv/cs_register.cpp index e4e9ad951..97bddf5cd 100644 --- a/modules/chanserv/cs_register.cpp +++ b/modules/chanserv/cs_register.cpp @@ -25,7 +25,7 @@ public: { const Anope::string &chan = params[0]; const Anope::string &chdesc = params.size() > 1 ? params[1] : ""; - unsigned maxregistered = Config->GetModule("chanserv")->Get("maxregistered"); + unsigned maxregistered = Config->GetModule("chanserv").Get("maxregistered"); User *u = source.GetUser(); NickCore *nc = source.nc; diff --git a/modules/chanserv/cs_seen.cpp b/modules/chanserv/cs_seen.cpp index 6197975f5..d8e4e118b 100644 --- a/modules/chanserv/cs_seen.cpp +++ b/modules/chanserv/cs_seen.cpp @@ -382,15 +382,15 @@ public: { } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - simple = conf->GetModule(this)->Get("simple"); + simple = conf.GetModule(this).Get("simple"); } void OnExpireTick() override { size_t previous_size = database.size(); - time_t purgetime = Config->GetModule(this)->Get("purgetime"); + time_t purgetime = Config->GetModule(this).Get("purgetime"); if (!purgetime) purgetime = Anope::DoTime("30d"); for (database_map::iterator it = database.begin(), it_end = database.end(); it != it_end;) diff --git a/modules/chanserv/cs_set.cpp b/modules/chanserv/cs_set.cpp index 7f9e49dd3..7b214a531 100644 --- a/modules/chanserv/cs_set.cpp +++ b/modules/chanserv/cs_set.cpp @@ -36,8 +36,8 @@ public: " \n" "Available options:")); Anope::string this_name = source.command; - bool hide_privileged_commands = Config->GetBlock("options")->Get("hideprivilegedcommands"), - hide_registered_commands = Config->GetBlock("options")->Get("hideregisteredcommands"); + bool hide_privileged_commands = Config->GetBlock("options").Get("hideprivilegedcommands"), + hide_registered_commands = Config->GetBlock("options").Get("hideregisteredcommands"); for (const auto &[c_name, info] : source.service->commands) { if (c_name.find_ci(this_name + " ") == 0) @@ -301,7 +301,7 @@ public: } NickCore *nc = na->nc; - unsigned max_reg = Config->GetModule("chanserv")->Get("maxregistered"); + unsigned max_reg = Config->GetModule("chanserv").Get("maxregistered"); if (max_reg && nc->channelcount >= max_reg && !source.HasPriv("chanserv/no-register-limit")) { source.Reply(_("\002%s\002 has too many channels registered."), na->nick.c_str()); @@ -461,8 +461,8 @@ public: inline static Anope::string BotModes() { - return Config->GetModule("botserv")->Get("botmodes", - Config->GetModule("chanserv")->Get("botmodes", "o") + return Config->GetModule("botserv").Get("botmodes", + Config->GetModule("chanserv").Get("botmodes", "o") ); } @@ -969,7 +969,7 @@ public: "access list (with the highest access, if applicable) will\n" "become the new founder, but if the access list is empty, the\n" "channel will be dropped.")); - unsigned max_reg = Config->GetModule("chanserv")->Get("maxregistered"); + unsigned max_reg = Config->GetModule("chanserv").Get("maxregistered"); if (max_reg) { source.Reply(" "); @@ -1133,14 +1133,14 @@ public: { } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - persist_lower_ts = conf->GetModule(this)->Get("persist_lower_ts"); + persist_lower_ts = conf.GetModule(this).Get("persist_lower_ts"); } void OnCreateChan(ChannelInfo *ci) override { - ci->bantype = Config->GetModule(this)->Get("defbantype", "2"); + ci->bantype = Config->GetModule(this).Get("defbantype", "2"); } void OnChannelSync(Channel *c) override diff --git a/modules/chanserv/cs_set_misc.cpp b/modules/chanserv/cs_set_misc.cpp index 7fef1e022..01a5b90b7 100644 --- a/modules/chanserv/cs_set_misc.cpp +++ b/modules/chanserv/cs_set_misc.cpp @@ -187,27 +187,27 @@ public: delete item; } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { descriptions.clear(); numerics.clear(); - for (int i = 0; i < conf->CountBlock("command"); ++i) + for (int i = 0; i < conf.CountBlock("command"); ++i) { - Configuration::Block *block = conf->GetBlock("command", i); + Configuration::Block &block = conf.GetBlock("command", i); - if (block->Get("command") != "chanserv/set/misc") + if (block.Get("command") != "chanserv/set/misc") continue; - Anope::string cname = block->Get("name"); - Anope::string desc = block->Get("misc_description"); + Anope::string cname = block.Get("name"); + Anope::string desc = block.Get("misc_description"); if (cname.empty() || desc.empty()) continue; descriptions[cname] = desc; - auto numeric = block->Get("misc_numeric"); + auto numeric = block.Get("misc_numeric"); if (numeric >= 1 && numeric <= 999) numerics["cs_set_misc:" + GetAttribute(cname)] = numeric; } diff --git a/modules/chanserv/cs_suspend.cpp b/modules/chanserv/cs_suspend.cpp index 2633bc094..b06fa195a 100644 --- a/modules/chanserv/cs_suspend.cpp +++ b/modules/chanserv/cs_suspend.cpp @@ -67,7 +67,7 @@ public: const Anope::string &chan = params[0]; Anope::string expiry = params[1]; Anope::string reason = params.size() > 2 ? params[2] : ""; - time_t expiry_secs = Config->GetModule(this->owner)->Get("suspendexpire"); + time_t expiry_secs = Config->GetModule(this->owner).Get("suspendexpire"); if (!expiry.empty() && expiry[0] != '+') { @@ -233,9 +233,9 @@ public: { } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - Anope::string s = conf->GetModule(this)->Get("show"); + Anope::string s = conf.GetModule(this).Get("show"); commasepstream(s).GetTokens(show); std::transform(show.begin(), show.end(), show.begin(), trim()); } diff --git a/modules/chanserv/cs_xop.cpp b/modules/chanserv/cs_xop.cpp index 55f8eb4bc..3ba3096ae 100644 --- a/modules/chanserv/cs_xop.cpp +++ b/modules/chanserv/cs_xop.cpp @@ -141,7 +141,7 @@ private: if (IRCD->IsChannelValid(mask)) { - if (Config->GetModule("chanserv")->Get("disallow_channel_access")) + if (Config->GetModule("chanserv").Get("disallow_channel_access")) { source.Reply(_("Channels may not be on access lists.")); return; @@ -164,7 +164,7 @@ private: else { na = NickAlias::Find(mask); - if (!na && Config->GetModule("chanserv")->Get("disallow_hostmask_access")) + if (!na && Config->GetModule("chanserv").Get("disallow_hostmask_access")) { source.Reply(_("Masks and unregistered users may not be on access lists.")); return; @@ -212,7 +212,7 @@ private: } } - unsigned access_max = Config->GetModule("chanserv")->Get("accessmax", "1000"); + unsigned access_max = Config->GetModule("chanserv").Get("accessmax", "1000"); if (access_max && ci->GetDeepAccessCount() >= access_max) { source.Reply(_("Sorry, you can only have %d access entries on a channel, including access entries from other channels."), access_max); @@ -618,32 +618,32 @@ public: } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { order.clear(); permissions.clear(); - for (int i = 0; i < conf->CountBlock("privilege"); ++i) + for (int i = 0; i < conf.CountBlock("privilege"); ++i) { - Configuration::Block *block = conf->GetBlock("privilege", i); - const Anope::string &pname = block->Get("name"); + Configuration::Block &block = conf.GetBlock("privilege", i); + const Anope::string &pname = block.Get("name"); Privilege *p = PrivilegeManager::FindPrivilege(pname); if (p == NULL) continue; - const Anope::string &xop = block->Get("xop"); + const Anope::string &xop = block.Get("xop"); if (pname.empty() || xop.empty()) continue; permissions[xop].push_back(pname); } - for (int i = 0; i < conf->CountBlock("command"); ++i) + for (int i = 0; i < conf.CountBlock("command"); ++i) { - Configuration::Block *block = conf->GetBlock("command", i); - const Anope::string &cname = block->Get("name"), - &cserv = block->Get("command"); + Configuration::Block &block = conf.GetBlock("command", i); + const Anope::string &cname = block.Get("name"), + &cserv = block.Get("command"); if (cname.empty() || cserv != "chanserv/xop") continue; diff --git a/modules/chanstats.cpp b/modules/chanstats.cpp index 05c745ff2..65678dcab 100644 --- a/modules/chanstats.cpp +++ b/modules/chanstats.cpp @@ -497,16 +497,16 @@ public: { } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - Configuration::Block *block = conf->GetModule(this); - prefix = block->Get("prefix", "anope_"); - SmileysHappy = block->Get("SmileysHappy"); - SmileysSad = block->Get("SmileysSad"); - SmileysOther = block->Get("SmileysOther"); - NSDefChanstats = block->Get("ns_def_chanstats"); - CSDefChanstats = block->Get("cs_def_chanstats"); - Anope::string engine = block->Get("engine"); + Configuration::Block &block = conf.GetModule(this); + prefix = block.Get("prefix", "anope_"); + SmileysHappy = block.Get("SmileysHappy"); + SmileysSad = block.Get("SmileysSad"); + SmileysOther = block.Get("SmileysOther"); + NSDefChanstats = block.Get("ns_def_chanstats"); + CSDefChanstats = block.Get("cs_def_chanstats"); + Anope::string engine = block.Get("engine"); this->sql = ServiceReference("SQL::Provider", engine); if (sql) this->CheckTables(); diff --git a/modules/database/db_atheme.cpp b/modules/database/db_atheme.cpp index 2e25b694e..4599a7469 100644 --- a/modules/database/db_atheme.cpp +++ b/modules/database/db_atheme.cpp @@ -500,7 +500,7 @@ private: else { // Generate a new password as we can't use the old one. - auto maxpasslen = Config->GetModule("nickserv")->Get("maxpasslen", "50"); + auto maxpasslen = Config->GetModule("nickserv").Get("maxpasslen", "50"); Anope::Encrypt(Anope::Random(maxpasslen), nc->pass); Log(this) << "Unable to convert the password for " << nc->display << " as Anope does not support the format!"; } @@ -1076,8 +1076,8 @@ private: if (!data->kill) return true; // Don't apply this. - auto kill = Config->GetModule("nickserv")->Get("kill", "60s"); - auto killquick = Config->GetModule("nickserv")->Get("killquick", "20s"); + auto kill = Config->GetModule("nickserv").Get("kill", "60s"); + auto killquick = Config->GetModule("nickserv").Get("killquick", "20s"); auto secs = Anope::Convert(value, kill); if (secs >= kill) nc->Extend("KILLPROTECT"); @@ -1295,7 +1295,7 @@ private: // If an Atheme account was awaiting confirmation but Anope is not // configured to use confirmation then autoconfirm it. - const auto &nsregister = Config->GetModule("ns_register")->Get("registration"); + const auto &nsregister = Config->GetModule("ns_register").Get("registration"); if (nsregister.equals_ci("none")) nc->Shrink("UNCONFIRMED"); @@ -1453,14 +1453,14 @@ public: { } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { flags.clear(); for (int i = 0; i < Config->CountBlock("privilege"); ++i) { - Configuration::Block *priv = Config->GetBlock("privilege", i); - const Anope::string &name = priv->Get("name"); - const Anope::string &value = priv->Get("flag"); + Configuration::Block &priv = Config->GetBlock("privilege", i); + const Anope::string &name = priv.Get("name"); + const Anope::string &value = priv.Get("flag"); if (!name.empty() && !value.empty()) flags[name] = value[0]; } @@ -1468,7 +1468,7 @@ public: EventReturn OnLoadDatabase() override { - const auto dbname = Anope::ExpandData(Config->GetModule(this)->Get("database", "atheme.db")); + const auto dbname = Anope::ExpandData(Config->GetModule(this).Get("database", "atheme.db")); std::ifstream fd(dbname.str()); if (!fd.is_open()) { diff --git a/modules/database/db_flatfile.cpp b/modules/database/db_flatfile.cpp index 9f2559c9e..4a1e8830d 100644 --- a/modules/database/db_flatfile.cpp +++ b/modules/database/db_flatfile.cpp @@ -109,7 +109,7 @@ class DBFlatFile final last_day = tm->tm_mday; std::set dbs; - dbs.insert(Config->GetModule(this)->Get("database", "anope.db")); + dbs.insert(Config->GetModule(this).Get("database", "anope.db")); for (const auto &type_order : Serialize::Type::GetTypeOrder()) { @@ -135,7 +135,7 @@ class DBFlatFile final Anope::string err = Anope::LastError(); Log(this) << "Unable to back up database " << db << " (" << err << ")!"; - if (!Config->GetModule(this)->Get("nobackupokay")) + if (!Config->GetModule(this).Get("nobackupokay")) { Anope::Quitting = true; Anope::QuitReason = "Unable to back up database " + db + " (" + err + ")"; @@ -146,7 +146,7 @@ class DBFlatFile final backups[db].push_back(newname); - unsigned keepbackups = Config->GetModule(this)->Get("keepbackups"); + unsigned keepbackups = Config->GetModule(this).Get("keepbackups"); if (keepbackups > 0 && backups[db].size() > keepbackups) { unlink(backups[db].front().c_str()); @@ -200,7 +200,7 @@ public: Log(this) << "Error saving databases: " << buf; - if (!Config->GetModule(this)->Get("nobackupokay")) + if (!Config->GetModule(this).Get("nobackupokay")) Anope::Quitting = true; } @@ -208,7 +208,7 @@ public: { std::set tried_dbs; - const auto db_name = Anope::ExpandData(Config->GetModule(this)->Get("database", "anope.db")); + const auto db_name = Anope::ExpandData(Config->GetModule(this).Get("database", "anope.db")); std::fstream fd(db_name.c_str(), std::ios_base::in | std::ios_base::binary); if (!fd.is_open()) @@ -263,7 +263,7 @@ public: int i = -1; #ifndef _WIN32 - if (!Anope::Quitting && Config->GetModule(this)->Get("fork")) + if (!Anope::Quitting && Config->GetModule(this).Get("fork")) { i = fork(); if (i > 0) @@ -290,7 +290,7 @@ public: if (s_type->GetOwner()) db_name = Anope::ExpandData("module_" + s_type->GetOwner()->name + ".db"); else - db_name = Anope::ExpandData(Config->GetModule(this)->Get("database", "anope.db")); + db_name = Anope::ExpandData(Config->GetModule(this).Get("database", "anope.db")); std::fstream *fs = databases[s_type->GetOwner()] = new std::fstream((db_name + ".tmp").c_str(), std::ios_base::out | std::ios_base::trunc | std::ios_base::binary); @@ -319,7 +319,7 @@ public: for (auto &[mod, f] : databases) { - const auto db_name = Anope::ExpandData((mod ? (mod->name + ".db") : Config->GetModule(this)->Get("database", "anope.db"))); + const auto db_name = Anope::ExpandData((mod ? (mod->name + ".db") : Config->GetModule(this).Get("database", "anope.db"))); if (!f->is_open() || !f->good()) { @@ -363,7 +363,7 @@ public: if (stype->GetOwner()) db_name = Anope::ExpandData("module_" + stype->GetOwner()->name + ".db"); else - db_name = Anope::ExpandData(Config->GetModule(this)->Get("database", "anope.db")); + db_name = Anope::ExpandData(Config->GetModule(this).Get("database", "anope.db")); std::fstream fd(db_name.c_str(), std::ios_base::in | std::ios_base::binary); if (!fd.is_open()) diff --git a/modules/database/db_old.cpp b/modules/database/db_old.cpp index 814740a23..611da4406 100644 --- a/modules/database/db_old.cpp +++ b/modules/database/db_old.cpp @@ -1296,7 +1296,7 @@ public: { - hashm = Config->GetModule(this)->Get("hash"); + hashm = Config->GetModule(this).Get("hash"); if (hashm != "md5" && hashm != "oldmd5" && hashm != "sha1" && hashm != "plain" && hashm != "sha256") throw ModuleException("Invalid hash method"); diff --git a/modules/database/db_redis.cpp b/modules/database/db_redis.cpp index a4826349b..832e22590 100644 --- a/modules/database/db_redis.cpp +++ b/modules/database/db_redis.cpp @@ -171,10 +171,10 @@ public: this->updated_items.clear(); } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - Configuration::Block *block = conf->GetModule(this); - this->redis = ServiceReference("Redis::Provider", block->Get("engine", "redis/main")); + Configuration::Block &block = conf.GetModule(this); + this->redis = ServiceReference("Redis::Provider", block.Get("engine", "redis/main")); } EventReturn OnLoadDatabase() override diff --git a/modules/database/db_sql.cpp b/modules/database/db_sql.cpp index bfcd59a3d..4b120f3b0 100644 --- a/modules/database/db_sql.cpp +++ b/modules/database/db_sql.cpp @@ -158,12 +158,12 @@ public: this->imported = true; } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - Configuration::Block *block = conf->GetModule(this); - this->sql = ServiceReference("SQL::Provider", block->Get("engine")); - this->prefix = block->Get("prefix", "anope_db_"); - this->import = block->Get("import"); + Configuration::Block &block = conf.GetModule(this); + this->sql = ServiceReference("SQL::Provider", block.Get("engine")); + this->prefix = block.Get("prefix", "anope_db_"); + this->import = block.Get("import"); } void OnPostInit() override diff --git a/modules/database/db_sql_live.cpp b/modules/database/db_sql_live.cpp index e0f3adb08..afd884913 100644 --- a/modules/database/db_sql_live.cpp +++ b/modules/database/db_sql_live.cpp @@ -37,7 +37,7 @@ private: } else { - if (Anope::CurTime - Config->GetBlock("options")->Get("updatetimeout", "2m") > lastwarn) + if (Anope::CurTime - Config->GetBlock("options").Get("updatetimeout", "2m") > lastwarn) { Log() << "Unable to locate SQL reference, going to readonly..."; Anope::ReadOnly = this->ro = true; @@ -138,11 +138,11 @@ public: init = false; } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - Configuration::Block *block = conf->GetModule(this); - this->SQL = ServiceReference("SQL::Provider", block->Get("engine")); - this->prefix = block->Get("prefix", "anope_db_"); + 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) override diff --git a/modules/dns.cpp b/modules/dns.cpp index f94854058..372c22d1e 100644 --- a/modules/dns.cpp +++ b/modules/dns.cpp @@ -1045,23 +1045,23 @@ public: } } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - Configuration::Block *block = conf->GetModule(this); + Configuration::Block &block = conf.GetModule(this); - nameserver = block->Get("nameserver", "127.0.0.1"); - timeout = block->Get("timeout", "5"); - ip = block->Get("ip", "0.0.0.0"); - port = block->Get("port", "53"); - admin = block->Get("admin", "admin@example.com"); - nameservers = block->Get("nameservers", "ns1.example.com"); - refresh = block->Get("refresh", "3600"); + nameserver = block.Get("nameserver", "127.0.0.1"); + timeout = block.Get("timeout", "5"); + ip = block.Get("ip", "0.0.0.0"); + port = block.Get("port", "53"); + admin = block.Get("admin", "admin@example.com"); + nameservers = block.Get("nameservers", "ns1.example.com"); + refresh = block.Get("refresh", "3600"); - for (int i = 0; i < block->CountBlock("notify"); ++i) + for (int i = 0; i < block.CountBlock("notify"); ++i) { - Configuration::Block *n = block->GetBlock("notify", i); - Anope::string nip = n->Get("ip"); - short nport = n->Get("port"); + Configuration::Block &n = block.GetBlock("notify", i); + Anope::string nip = n.Get("ip"); + short nport = n.Get("port"); notify.emplace_back(nip, nport); } diff --git a/modules/dnsbl.cpp b/modules/dnsbl.cpp index deedd85e2..6db41ba84 100644 --- a/modules/dnsbl.cpp +++ b/modules/dnsbl.cpp @@ -77,7 +77,7 @@ public: reason = reason.replace_all_cs("%h", user->host); reason = reason.replace_all_cs("%i", addr); reason = reason.replace_all_cs("%r", reply ? reply->reason : ""); - reason = reason.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get("networkname")); + reason = reason.replace_all_cs("%N", Config->GetBlock("networkinfo").Get("networkname")); BotInfo *OperServ = Config->GetClient("OperServ"); Log(creator, "dnsbl", OperServ) << user->GetMask() << " (" << addr << ") appears in " << this->blacklist.name; @@ -110,33 +110,33 @@ public: } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - Configuration::Block *block = conf->GetModule(this); - this->check_on_connect = block->Get("check_on_connect"); - this->check_on_netburst = block->Get("check_on_netburst"); - this->add_to_akill = block->Get("add_to_akill", "yes"); + Configuration::Block &block = conf.GetModule(this); + this->check_on_connect = block.Get("check_on_connect"); + this->check_on_netburst = block.Get("check_on_netburst"); + this->add_to_akill = block.Get("add_to_akill", "yes"); this->blacklists.clear(); - for (int i = 0; i < block->CountBlock("blacklist"); ++i) + for (int i = 0; i < block.CountBlock("blacklist"); ++i) { - Configuration::Block *bl = block->GetBlock("blacklist", i); + Configuration::Block &bl = block.GetBlock("blacklist", i); Blacklist blacklist; - blacklist.name = bl->Get("name"); + blacklist.name = bl.Get("name"); if (blacklist.name.empty()) continue; - blacklist.bantime = bl->Get("time", "4h"); - blacklist.reason = bl->Get("reason"); + blacklist.bantime = bl.Get("time", "4h"); + blacklist.reason = bl.Get("reason"); - for (int j = 0; j < bl->CountBlock("reply"); ++j) + for (int j = 0; j < bl.CountBlock("reply"); ++j) { - Configuration::Block *reply = bl->GetBlock("reply", j); + Configuration::Block &reply = bl.GetBlock("reply", j); Blacklist::Reply r; - r.code = reply->Get("code"); - r.reason = reply->Get("reason"); - r.allow_account = reply->Get("allow_account"); + r.code = reply.Get("code"); + r.reason = reply.Get("reason"); + r.allow_account = reply.Get("allow_account"); blacklist.replies.push_back(r); } @@ -145,10 +145,10 @@ public: } this->exempts.clear(); - for (int i = 0; i < block->CountBlock("exempt"); ++i) + for (int i = 0; i < block.CountBlock("exempt"); ++i) { - Configuration::Block *bl = block->GetBlock("exempt", i); - this->exempts.insert(bl->Get("ip")); + Configuration::Block &bl = block.GetBlock("exempt", i); + this->exempts.insert(bl.Get("ip")); } } diff --git a/modules/encryption/enc_bcrypt.cpp b/modules/encryption/enc_bcrypt.cpp index 648f95834..1ac37e1fe 100644 --- a/modules/encryption/enc_bcrypt.cpp +++ b/modules/encryption/enc_bcrypt.cpp @@ -165,11 +165,11 @@ public: } } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - auto *block = conf->GetModule(this); + auto &block = conf.GetModule(this); - auto rounds = block->Get("rounds", "10"); + auto rounds = block.Get("rounds", "10"); if (rounds < 10 || rounds > 32) { Log(this) << "Bcrypt rounds MUST be between 10 and 32 inclusive; using 10 instead of " << rounds << '.'; diff --git a/modules/encryption/enc_sha2.cpp b/modules/encryption/enc_sha2.cpp index 11c0e76f6..4e60d330d 100644 --- a/modules/encryption/enc_sha2.cpp +++ b/modules/encryption/enc_sha2.cpp @@ -126,9 +126,9 @@ public: }); } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - this->defaultprovider = GetAlgorithm(Config->GetModule(this)->Get("algorithm", "sha256")); + this->defaultprovider = GetAlgorithm(Config->GetModule(this).Get("algorithm", "sha256")); } EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) override diff --git a/modules/extra/enc_argon2.cpp b/modules/extra/enc_argon2.cpp index 8d6f27d9b..81d052c0c 100644 --- a/modules/extra/enc_argon2.cpp +++ b/modules/extra/enc_argon2.cpp @@ -154,15 +154,15 @@ public: }); } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - const auto *block = Config->GetModule(this); - this->defaultprovider = GetAlgorithm(block->Get("algorithm", "argon2id")); - Argon2Context::memory_cost = block->Get("memory_cost", "131072"); - Argon2Context::time_cost = block->Get("time_cost", "3"); - Argon2Context::parallelism = block->Get("parallelism", "1"); - Argon2Context::hash_length = block->Get("hash_length", "32"); - Argon2Context::salt_length = block->Get("salt_length", "32"); + const auto &block = Config->GetModule(this); + this->defaultprovider = GetAlgorithm(block.Get("algorithm", "argon2id")); + Argon2Context::memory_cost = block.Get("memory_cost", "131072"); + Argon2Context::time_cost = block.Get("time_cost", "3"); + Argon2Context::parallelism = block.Get("parallelism", "1"); + Argon2Context::hash_length = block.Get("hash_length", "32"); + Argon2Context::salt_length = block.Get("salt_length", "32"); } EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) override diff --git a/modules/extra/ldap.cpp b/modules/extra/ldap.cpp index ecc48767a..f8ef205a5 100644 --- a/modules/extra/ldap.cpp +++ b/modules/extra/ldap.cpp @@ -544,9 +544,9 @@ public: LDAPServices.clear(); } - void OnReload(Configuration::Conf *config) override + void OnReload(Configuration::Conf &config) override { - Configuration::Block *conf = config->GetModule(this); + Configuration::Block &conf = config.GetModule(this); for (std::map::iterator it = this->LDAPServices.begin(); it != this->LDAPServices.end();) { @@ -556,11 +556,11 @@ public: ++it; - for (i = 0; i < conf->CountBlock("ldap"); ++i) - if (conf->GetBlock("ldap", i)->Get("name", "ldap/main") == cname) + for (i = 0; i < conf.CountBlock("ldap"); ++i) + if (conf.GetBlock("ldap", i).Get("name", "ldap/main") == cname) break; - if (i == conf->CountBlock("ldap")) + if (i == conf.CountBlock("ldap")) { Log(LOG_NORMAL, "ldap") << "LDAP: Removing server connection " << cname; @@ -572,17 +572,17 @@ public: } } - for (int i = 0; i < conf->CountBlock("ldap"); ++i) + for (int i = 0; i < conf.CountBlock("ldap"); ++i) { - Configuration::Block *ldap = conf->GetBlock("ldap", i); + Configuration::Block &ldap = conf.GetBlock("ldap", i); - const Anope::string &connname = ldap->Get("name", "ldap/main"); + const Anope::string &connname = ldap.Get("name", "ldap/main"); if (this->LDAPServices.find(connname) == this->LDAPServices.end()) { - const Anope::string &server = ldap->Get("server", "127.0.0.1"); - const Anope::string &admin_binddn = ldap->Get("admin_binddn"); - const Anope::string &admin_password = ldap->Get("admin_password"); + const Anope::string &server = ldap.Get("server", "127.0.0.1"); + const Anope::string &admin_binddn = ldap.Get("admin_binddn"); + const Anope::string &admin_password = ldap.Get("admin_password"); try { diff --git a/modules/extra/mysql.cpp b/modules/extra/mysql.cpp index 65fe6d5c4..0d39c87a4 100644 --- a/modules/extra/mysql.cpp +++ b/modules/extra/mysql.cpp @@ -260,9 +260,9 @@ public: delete DThread; } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - Configuration::Block *config = conf->GetModule(this); + Configuration::Block &config = conf.GetModule(this); for (std::map::iterator it = this->MySQLServices.begin(); it != this->MySQLServices.end();) { @@ -272,11 +272,11 @@ public: ++it; - for (i = 0; i < config->CountBlock("mysql"); ++i) - if (config->GetBlock("mysql", i)->Get("name", "mysql/main") == cname) + for (i = 0; i < Config->CountBlock("mysql"); ++i) + if (config.GetBlock("mysql", i).Get("name", "mysql/main") == cname) break; - if (i == config->CountBlock("mysql")) + if (i == Config->CountBlock("mysql")) { Log(LOG_NORMAL, "mysql") << "MySQL: Removing server connection " << cname; @@ -285,19 +285,19 @@ public: } } - for (int i = 0; i < config->CountBlock("mysql"); ++i) + for (int i = 0; i < Config->CountBlock("mysql"); ++i) { - Configuration::Block *block = config->GetBlock("mysql", i); - const Anope::string &connname = block->Get("name", "mysql/main"); + Configuration::Block &block = config.GetBlock("mysql", i); + const Anope::string &connname = block.Get("name", "mysql/main"); if (this->MySQLServices.find(connname) == this->MySQLServices.end()) { - const Anope::string &database = block->Get("database", "anope"); - const Anope::string &server = block->Get("server", "127.0.0.1"); - const Anope::string &user = block->Get("username", "anope"); - const Anope::string &password = block->Get("password"); - unsigned int port = block->Get("port", "3306"); - const Anope::string &socket = block->Get("socket"); + const Anope::string &database = block.Get("database", "anope"); + const Anope::string &server = block.Get("server", "127.0.0.1"); + const Anope::string &user = block.Get("username", "anope"); + const Anope::string &password = block.Get("password"); + unsigned int port = block.Get("port", "3306"); + const Anope::string &socket = block.Get("socket"); try { diff --git a/modules/extra/sqlite.cpp b/modules/extra/sqlite.cpp index d234066a0..36bafae4c 100644 --- a/modules/extra/sqlite.cpp +++ b/modules/extra/sqlite.cpp @@ -113,9 +113,9 @@ public: SQLiteServices.clear(); } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - Configuration::Block *config = conf->GetModule(this); + Configuration::Block &config = conf.GetModule(this); for (std::map::iterator it = this->SQLiteServices.begin(); it != this->SQLiteServices.end();) { @@ -124,8 +124,8 @@ public: int i, num; ++it; - for (i = 0, num = config->CountBlock("sqlite"); i < num; ++i) - if (config->GetBlock("sqlite", i)->Get("name", "sqlite/main") == cname) + for (i = 0, num = Config->CountBlock("sqlite"); i < num; ++i) + if (config.GetBlock("sqlite", i).Get("name", "sqlite/main") == cname) break; if (i == num) @@ -137,14 +137,14 @@ public: } } - for (int i = 0; i < config->CountBlock("sqlite"); ++i) + for (int i = 0; i < Config->CountBlock("sqlite"); ++i) { - Configuration::Block *block = config->GetBlock("sqlite", i); - Anope::string connname = block->Get("name", "sqlite/main"); + Configuration::Block &block = config.GetBlock("sqlite", i); + Anope::string connname = block.Get("name", "sqlite/main"); if (this->SQLiteServices.find(connname) == this->SQLiteServices.end()) { - auto database = Anope::ExpandData(block->Get("database", "anope")); + auto database = Anope::ExpandData(block.Get("database", "anope")); try { auto *ss = new SQLiteService(this, connname, database); diff --git a/modules/extra/ssl_gnutls.cpp b/modules/extra/ssl_gnutls.cpp index f8ef18f16..5e9147d5c 100644 --- a/modules/extra/ssl_gnutls.cpp +++ b/modules/extra/ssl_gnutls.cpp @@ -327,13 +327,13 @@ public: } } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - Configuration::Block *config = conf->GetModule(this); + Configuration::Block &config = conf.GetModule(this); - const Anope::string certfile = Anope::ExpandConfig(config->Get("cert", "fullchain.pem")); - const Anope::string keyfile = Anope::ExpandConfig(config->Get("key", "privkey.pem")); - const Anope::string dhfile = Anope::ExpandConfig(config->Get("dh", "dhparams.pem")); + const Anope::string certfile = Anope::ExpandConfig(config.Get("cert", "fullchain.pem")); + const Anope::string keyfile = Anope::ExpandConfig(config.Get("key", "privkey.pem")); + const Anope::string dhfile = Anope::ExpandConfig(config.Get("dh", "dhparams.pem")); CheckFile(certfile); CheckFile(keyfile); @@ -365,9 +365,9 @@ public: void OnPreServerConnect() override { - Configuration::Block *config = Config->GetBlock("uplink", Anope::CurrentUplink); + Configuration::Block &config = Config->GetBlock("uplink", Anope::CurrentUplink); - if (config->Get("ssl")) + if (config.Get("ssl")) { this->service.Init(UplinkSock); } diff --git a/modules/extra/ssl_openssl.cpp b/modules/extra/ssl_openssl.cpp index 28e734e44..50ac75466 100644 --- a/modules/extra/ssl_openssl.cpp +++ b/modules/extra/ssl_openssl.cpp @@ -144,12 +144,12 @@ public: SSL_CTX_free(server_ctx); } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - Configuration::Block *config = conf->GetModule(this); + Configuration::Block &config = conf.GetModule(this); - this->certfile = Anope::ExpandConfig(config->Get("cert", "fullchain.pem")); - this->keyfile = Anope::ExpandConfig(config->Get("key", "privkey.pem")); + this->certfile = Anope::ExpandConfig(config.Get("cert", "fullchain.pem")); + this->keyfile = Anope::ExpandConfig(config.Get("key", "privkey.pem")); if (Anope::IsFile(this->certfile)) { @@ -177,7 +177,7 @@ public: } // Allow disabling old versions of TLS - if (config->Get("tlsv10", "false")) + if (config.Get("tlsv10", "false")) { SSL_CTX_clear_options(client_ctx, SSL_OP_NO_TLSv1); SSL_CTX_clear_options(server_ctx, SSL_OP_NO_TLSv1); @@ -188,7 +188,7 @@ public: SSL_CTX_set_options(server_ctx, SSL_OP_NO_TLSv1); } - if (config->Get("tlsv11", "true")) + if (config.Get("tlsv11", "true")) { SSL_CTX_clear_options(client_ctx, SSL_OP_NO_TLSv1_1); SSL_CTX_clear_options(server_ctx, SSL_OP_NO_TLSv1_1); @@ -199,7 +199,7 @@ public: SSL_CTX_set_options(server_ctx, SSL_OP_NO_TLSv1_1); } - if (config->Get("tlsv12", "true")) + if (config.Get("tlsv12", "true")) { SSL_CTX_clear_options(client_ctx, SSL_OP_NO_TLSv1_2); SSL_CTX_clear_options(server_ctx, SSL_OP_NO_TLSv1_2); @@ -213,9 +213,9 @@ public: void OnPreServerConnect() override { - Configuration::Block *config = Config->GetBlock("uplink", Anope::CurrentUplink); + Configuration::Block &config = Config->GetBlock("uplink", Anope::CurrentUplink); - if (config->Get("ssl")) + if (config.Get("ssl")) { this->service.Init(UplinkSock); } diff --git a/modules/extra/xmlrpc.cpp b/modules/extra/xmlrpc.cpp index 00b7d92ac..7652fc4d3 100644 --- a/modules/extra/xmlrpc.cpp +++ b/modules/extra/xmlrpc.cpp @@ -279,12 +279,12 @@ public: xmlrpc_term(); } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { if (httpref) httpref->UnregisterPage(&xmlrpcinterface); - this->httpref = ServiceReference("HTTPProvider", conf->GetModule(this)->Get("server", "httpd/main")); + this->httpref = ServiceReference("HTTPProvider", conf.GetModule(this).Get("server", "httpd/main")); if (!httpref) throw ConfigException("Unable to find http reference, is httpd loaded?"); diff --git a/modules/fantasy.cpp b/modules/fantasy.cpp index 82584c41e..dc4fab4e9 100644 --- a/modules/fantasy.cpp +++ b/modules/fantasy.cpp @@ -76,7 +76,7 @@ public: "Note that users wanting to use fantasy commands\n" "MUST have enough access for both the FANTASY\n" "privilege and the command they are executing."), - Config->GetModule(this->owner)->Get("fantasycharacter", "!").c_str()); + Config->GetModule(this->owner).Get("fantasycharacter", "!").c_str()); return true; } }; @@ -109,7 +109,7 @@ public: return; Anope::string normalized_param0 = Anope::NormalizeBuffer(params[0]); - Anope::string fantasy_chars = Config->GetModule(this)->Get("fantasycharacter", "!"); + Anope::string fantasy_chars = Config->GetModule(this).Get("fantasycharacter", "!"); if (!normalized_param0.find(c->ci->bi->nick)) { diff --git a/modules/global/gl_queue.cpp b/modules/global/gl_queue.cpp index 583a46f6a..8a0f5c9f5 100644 --- a/modules/global/gl_queue.cpp +++ b/modules/global/gl_queue.cpp @@ -69,7 +69,7 @@ private: return; } - auto maxqueue = Config->GetModule(this->module)->Get("maxqueue", "10"); + auto maxqueue = Config->GetModule(this->module).Get("maxqueue", "10"); if (global->CountQueue(source.nc) >= maxqueue) { source.Reply(_("You can not queue any more messages.")); diff --git a/modules/global/global.cpp b/modules/global/global.cpp index 44b17326a..784088b97 100644 --- a/modules/global/global.cpp +++ b/modules/global/global.cpp @@ -61,9 +61,9 @@ public: return q->size(); } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - const auto glnick = conf->GetModule(this)->Get("client"); + const auto glnick = conf.GetModule(this).Get("client"); if (glnick.empty()) throw ConfigException(Module::name + ": must be defined"); @@ -76,21 +76,21 @@ public: void OnRestart() override { - const auto msg = Config->GetModule(this)->Get("globaloncycledown"); + const auto msg = Config->GetModule(this).Get("globaloncycledown"); if (!msg.empty()) this->SendSingle(msg, nullptr, nullptr, nullptr); } void OnShutdown() override { - const auto msg = Config->GetModule(this)->Get("globaloncycledown"); + const auto msg = Config->GetModule(this).Get("globaloncycledown"); if (!msg.empty()) this->SendSingle(msg, nullptr, nullptr, nullptr); } void OnNewServer(Server *s) override { - const auto msg = Config->GetModule(this)->Get("globaloncycleup"); + const auto msg = Config->GetModule(this).Get("globaloncycleup"); if (!msg.empty() && !Me->IsSynced()) s->Notice(global, msg); } @@ -138,7 +138,7 @@ public: return false; Anope::string line; - if (source && !Config->GetModule(this)->Get("anonymousglobal")) + if (source && !Config->GetModule(this).Get("anonymousglobal")) { // A source is available and they're not anonymous. line = Anope::printf("[%s] %s", source->GetNick().c_str(), message.c_str()); diff --git a/modules/help.cpp b/modules/help.cpp index 117293373..ba559ca7f 100644 --- a/modules/help.cpp +++ b/modules/help.cpp @@ -44,8 +44,8 @@ public: Anope::string source_command = source.command; const BotInfo *bi = source.service; const CommandInfo::map &map = source.c ? Config->Fantasy : bi->commands; - bool hide_privileged_commands = Config->GetBlock("options")->Get("hideprivilegedcommands"), - hide_registered_commands = Config->GetBlock("options")->Get("hideregisteredcommands"); + bool hide_privileged_commands = Config->GetBlock("options").Get("hideprivilegedcommands"), + hide_registered_commands = Config->GetBlock("options").Get("hideregisteredcommands"); if (params.empty() || params[0].equals_ci("ALL")) { diff --git a/modules/helpchan.cpp b/modules/helpchan.cpp index 0ea427ec2..1854b78c7 100644 --- a/modules/helpchan.cpp +++ b/modules/helpchan.cpp @@ -18,7 +18,7 @@ public: EventReturn OnChannelModeSet(Channel *c, MessageSource &, ChannelMode *mode, const Anope::string ¶m) override { - if (mode->name == "OP" && c && c->ci && c->name.equals_ci(Config->GetModule(this)->Get("helpchannel"))) + if (mode->name == "OP" && c && c->ci && c->name.equals_ci(Config->GetModule(this).Get("helpchannel"))) { User *u = User::Find(param); diff --git a/modules/hostserv/hostserv.cpp b/modules/hostserv/hostserv.cpp index 9c8266d02..1a38a7666 100644 --- a/modules/hostserv/hostserv.cpp +++ b/modules/hostserv/hostserv.cpp @@ -22,9 +22,9 @@ public: throw ModuleException("Your IRCd does not support vhosts"); } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - const Anope::string &hsnick = conf->GetModule(this)->Get("client"); + const Anope::string &hsnick = conf.GetModule(this).Get("client"); if (hsnick.empty()) throw ConfigException(Module::name + ": must be defined"); @@ -81,7 +81,7 @@ public: void OnUserModeUnset(const MessageSource &setter, User *u, const Anope::string &mname) override { - if (mname == "OPER" && Config->GetModule(this)->Get("activate_on_deoper", "yes")) + if (mname == "OPER" && Config->GetModule(this).Get("activate_on_deoper", "yes")) this->OnUserLogin(u); } @@ -95,7 +95,7 @@ public: void OnSetVHost(NickAlias *na) override { - if (Config->GetModule(this)->Get("activate_on_set", "yes")) + if (Config->GetModule(this).Get("activate_on_set", "yes")) { User *u = User::Find(na->nick); @@ -120,7 +120,7 @@ public: void OnDeleteVHost(NickAlias *na) override { - if (Config->GetModule(this)->Get("activate_on_set", "yes")) + if (Config->GetModule(this).Get("activate_on_set", "yes")) { User *u = User::Find(na->nick); diff --git a/modules/hostserv/hs_group.cpp b/modules/hostserv/hs_group.cpp index 06c29290e..bf7b5ddca 100644 --- a/modules/hostserv/hs_group.cpp +++ b/modules/hostserv/hs_group.cpp @@ -105,11 +105,11 @@ public: commandhsgroup.Sync(na); } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - Configuration::Block *block = conf->GetModule(this); - syncongroup = block->Get("syncongroup"); - synconset = block->Get("synconset"); + Configuration::Block &block = conf.GetModule(this); + syncongroup = block.Get("syncongroup"); + synconset = block.Get("synconset"); } }; diff --git a/modules/hostserv/hs_list.cpp b/modules/hostserv/hs_list.cpp index 345d62852..174f4baf1 100644 --- a/modules/hostserv/hs_list.cpp +++ b/modules/hostserv/hs_list.cpp @@ -51,7 +51,7 @@ public: } } - unsigned display_counter = 0, listmax = Config->GetModule(this->owner)->Get("listmax", "50"); + unsigned display_counter = 0, listmax = Config->GetModule(this->owner).Get("listmax", "50"); ListFormatter list(source.GetAccount()); list.AddColumn(_("Number")).AddColumn(_("Nick")).AddColumn(_("VHost")).AddColumn(_("Creator")).AddColumn(_("Created")); diff --git a/modules/hostserv/hs_request.cpp b/modules/hostserv/hs_request.cpp index 649462aac..a54184bd3 100644 --- a/modules/hostserv/hs_request.cpp +++ b/modules/hostserv/hs_request.cpp @@ -154,8 +154,8 @@ public: return; } - time_t send_delay = Config->GetModule("memoserv")->Get("senddelay"); - if (Config->GetModule(this->owner)->Get("memooper") && send_delay > 0 && u && u->lastmemosend + send_delay > Anope::CurTime) + time_t send_delay = Config->GetModule("memoserv").Get("senddelay"); + if (Config->GetModule(this->owner).Get("memooper") && send_delay > 0 && u && u->lastmemosend + send_delay > Anope::CurTime) { auto waitperiod = (u->lastmemosend + send_delay) - Anope::CurTime; source.Reply(_("Please wait %s before requesting a new vhost."), Anope::Duration(waitperiod, source.GetAccount()).c_str()); @@ -213,7 +213,7 @@ public: na->SetVHost(req->ident, req->host, source.GetNick(), req->time); FOREACH_MOD(OnSetVHost, (na)); - if (Config->GetModule(this->owner)->Get("memouser") && memoserv) + if (Config->GetModule(this->owner).Get("memouser") && memoserv) memoserv->Send(source.service->nick, na->nick, _("[auto memo] Your requested vhost has been approved."), true); source.Reply(_("VHost for %s has been activated."), na->nick.c_str()); @@ -229,7 +229,7 @@ public: this->SendSyntax(source); source.Reply(" "); source.Reply(_("Activate the requested vhost for the given nick.")); - if (Config->GetModule(this->owner)->Get("memouser")) + if (Config->GetModule(this->owner).Get("memouser")) source.Reply(_("A memo informing the user will also be sent.")); return true; @@ -263,7 +263,7 @@ public: { na->Shrink("hostrequest"); - if (Config->GetModule(this->owner)->Get("memouser") && memoserv) + if (Config->GetModule(this->owner).Get("memouser") && memoserv) { Anope::string message; if (!reason.empty()) @@ -286,7 +286,7 @@ public: this->SendSyntax(source); source.Reply(" "); source.Reply(_("Reject the requested vhost for the given nick.")); - if (Config->GetModule(this->owner)->Get("memouser")) + if (Config->GetModule(this->owner).Get("memouser")) source.Reply(_("A memo informing the user will also be sent, which includes the reason for the rejection if supplied.")); return true; @@ -305,7 +305,7 @@ public: void Execute(CommandSource &source, const std::vector ¶ms) override { unsigned counter = 0; - unsigned display_counter = 0, listmax = Config->GetModule(this->owner)->Get("listmax"); + unsigned display_counter = 0, listmax = Config->GetModule(this->owner).Get("listmax"); ListFormatter list(source.GetAccount()); list.AddColumn(_("Number")).AddColumn(_("Nick")).AddColumn(_("VHost")).AddColumn(_("Created")); @@ -380,7 +380,7 @@ static void req_send_memos(Module *me, CommandSource &source, const Anope::strin else host = vhost; - if (Config->GetModule(me)->Get("memooper") && memoserv) + if (Config->GetModule(me).Get("memooper") && memoserv) { for (auto *o : Oper::opers) { diff --git a/modules/httpd.cpp b/modules/httpd.cpp index d25742aa2..92382436f 100644 --- a/modules/httpd.cpp +++ b/modules/httpd.cpp @@ -360,25 +360,25 @@ public: this->providers.clear(); } - void OnReload(Configuration::Conf *config) override + void OnReload(Configuration::Conf &config) override { - Configuration::Block *conf = config->GetModule(this); + Configuration::Block &conf = config.GetModule(this); std::set existing; - for (int i = 0; i < conf->CountBlock("httpd"); ++i) + for (int i = 0; i < conf.CountBlock("httpd"); ++i) { - Configuration::Block *block = conf->GetBlock("httpd", i); + Configuration::Block &block = conf.GetBlock("httpd", i); - const Anope::string &hname = block->Get("name", "httpd/main"); + const Anope::string &hname = block.Get("name", "httpd/main"); existing.insert(hname); - Anope::string ip = block->Get("ip"); - int port = block->Get("port", "8080"); - int timeout = block->Get("timeout", "30"); - bool ssl = block->Get("ssl", "no"); - Anope::string ext_ip = block->Get("extforward_ip"); - Anope::string ext_header = block->Get("extforward_header"); + Anope::string ip = block.Get("ip"); + int port = block.Get("port", "8080"); + int timeout = block.Get("timeout", "30"); + bool ssl = block.Get("ssl", "no"); + Anope::string ext_ip = block.Get("extforward_ip"); + Anope::string ext_header = block.Get("extforward_header"); if (ip.empty()) { diff --git a/modules/irc2sql/irc2sql.cpp b/modules/irc2sql/irc2sql.cpp index c288a2366..3c6ab9199 100644 --- a/modules/irc2sql/irc2sql.cpp +++ b/modules/irc2sql/irc2sql.cpp @@ -17,21 +17,21 @@ void IRC2SQL::OnShutdown() quitting = true; } -void IRC2SQL::OnReload(Configuration::Conf *conf) +void IRC2SQL::OnReload(Configuration::Conf &conf) { - Configuration::Block *block = Config->GetModule(this); - prefix = block->Get("prefix", "anope_"); - GeoIPDB = block->Get("geoip_database"); - ctcpuser = block->Get("ctcpuser", "no"); - ctcpeob = block->Get("ctcpeob", "yes"); - Anope::string engine = block->Get("engine"); + Configuration::Block &block = Config->GetModule(this); + prefix = block.Get("prefix", "anope_"); + GeoIPDB = block.Get("geoip_database"); + ctcpuser = block.Get("ctcpuser", "no"); + ctcpeob = block.Get("ctcpeob", "yes"); + Anope::string engine = block.Get("engine"); this->sql = ServiceReference("SQL::Provider", engine); if (sql) this->CheckTables(); else Log() << "IRC2SQL: no database connection to " << engine; - const Anope::string &snick = block->Get("client"); + const Anope::string &snick = block.Get("client"); if (snick.empty()) throw ConfigException(Module::name + ": must be defined"); StatServ = BotInfo::Find(snick, true); diff --git a/modules/irc2sql/irc2sql.h b/modules/irc2sql/irc2sql.h index 27e1dee13..52a15e7f6 100644 --- a/modules/irc2sql/irc2sql.h +++ b/modules/irc2sql/irc2sql.h @@ -61,7 +61,7 @@ public: } void OnShutdown() override; - void OnReload(Configuration::Conf *config) override; + void OnReload(Configuration::Conf &config) override; void OnNewServer(Server *server) override; void OnServerQuit(Server *server) override; void OnUserConnect(User *u, bool &exempt) override; diff --git a/modules/ldap_authentication.cpp b/modules/ldap_authentication.cpp index 5860055e5..f4e3ddd0a 100644 --- a/modules/ldap_authentication.cpp +++ b/modules/ldap_authentication.cpp @@ -215,23 +215,23 @@ public: ModuleManager::SetPriority(this, PRIORITY_FIRST); } - void OnReload(Configuration::Conf *config) override + void OnReload(Configuration::Conf &config) override { - Configuration::Block *conf = Config->GetModule(this); + Configuration::Block &conf = Config->GetModule(this); - basedn = conf->Get("basedn"); - search_filter = conf->Get("search_filter"); - object_class = conf->Get("object_class"); - username_attribute = conf->Get("username_attribute"); - this->password_attribute = conf->Get("password_attribute"); - email_attribute = conf->Get("email_attribute"); - this->disable_register_reason = conf->Get("disable_register_reason"); - this->disable_email_reason = conf->Get("disable_email_reason"); + basedn = conf.Get("basedn"); + search_filter = conf.Get("search_filter"); + object_class = conf.Get("object_class"); + username_attribute = conf.Get("username_attribute"); + this->password_attribute = conf.Get("password_attribute"); + email_attribute = conf.Get("email_attribute"); + this->disable_register_reason = conf.Get("disable_register_reason"); + this->disable_email_reason = conf.Get("disable_email_reason"); if (!email_attribute.empty()) { /* Don't complain to users about how they need to update their email, we will do it for them */ - config->GetModule("nickserv")->Set("forceemail", "no"); + config.GetModule("nickserv").Set("forceemail", "no"); } } diff --git a/modules/ldap_oper.cpp b/modules/ldap_oper.cpp index 3f34eb7ca..fa57f7aa9 100644 --- a/modules/ldap_oper.cpp +++ b/modules/ldap_oper.cpp @@ -92,15 +92,15 @@ public: } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - Configuration::Block *config = Config->GetModule(this); + Configuration::Block &config = Config->GetModule(this); - this->binddn = config->Get("binddn"); - this->password = config->Get("password"); - this->basedn = config->Get("basedn"); - this->filter = config->Get("filter"); - opertype_attribute = config->Get("opertype_attribute"); + this->binddn = config.Get("binddn"); + this->password = config.Get("password"); + this->basedn = config.Get("basedn"); + this->filter = config.Get("filter"); + opertype_attribute = config.Get("opertype_attribute"); for (const auto *oper : my_opers) delete oper; diff --git a/modules/memoserv/memoserv.cpp b/modules/memoserv/memoserv.cpp index a1399e8f6..a7baa4daf 100644 --- a/modules/memoserv/memoserv.cpp +++ b/modules/memoserv/memoserv.cpp @@ -19,20 +19,20 @@ class MemoServCore final static bool SendMemoMail(NickCore *nc, MemoInfo *mi, Memo *m) { - Anope::string subject = Language::Translate(nc, Config->GetBlock("mail")->Get("memo_subject").c_str()), - message = Language::Translate(nc, Config->GetBlock("mail")->Get("memo_message").c_str()); + Anope::string subject = Language::Translate(nc, Config->GetBlock("mail").Get("memo_subject").c_str()), + message = Language::Translate(nc, Config->GetBlock("mail").Get("memo_message").c_str()); subject = subject.replace_all_cs("%n", nc->display); subject = subject.replace_all_cs("%s", m->sender); subject = subject.replace_all_cs("%d", Anope::ToString(mi->GetIndex(m) + 1)); subject = subject.replace_all_cs("%t", m->text); - subject = subject.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get("networkname")); + subject = subject.replace_all_cs("%N", Config->GetBlock("networkinfo").Get("networkname")); message = message.replace_all_cs("%n", nc->display); message = message.replace_all_cs("%s", m->sender); message = message.replace_all_cs("%d", Anope::ToString(mi->GetIndex(m) + 1)); message = message.replace_all_cs("%t", m->text); - message = message.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get("networkname")); + message = message.replace_all_cs("%N", Config->GetBlock("networkinfo").Get("networkname")); return Mail::Send(nc, subject, message); } @@ -58,7 +58,7 @@ public: { if (!sender->HasPriv("memoserv/no-limit") && !force) { - time_t send_delay = Config->GetModule("memoserv")->Get("senddelay"); + time_t send_delay = Config->GetModule("memoserv").Get("senddelay"); if (send_delay > 0 && sender->lastmemosend + send_delay > Anope::CurTime) return MEMO_TOO_FAST; else if (!mi->memomax) @@ -149,9 +149,9 @@ public: } } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - const Anope::string &msnick = conf->GetModule(this)->Get("client"); + const Anope::string &msnick = conf.GetModule(this).Get("client"); if (msnick.empty()) throw ConfigException(Module::name + ": must be defined"); @@ -165,12 +165,12 @@ public: void OnNickCoreCreate(NickCore *nc) override { - nc->memos.memomax = Config->GetModule(this)->Get("maxmemos"); + nc->memos.memomax = Config->GetModule(this).Get("maxmemos"); } void OnCreateChan(ChannelInfo *ci) override { - ci->memos.memomax = Config->GetModule(this)->Get("maxmemos"); + ci->memos.memomax = Config->GetModule(this).Get("maxmemos"); } void OnBotDelete(BotInfo *bi) override diff --git a/modules/memoserv/ms_ignore.cpp b/modules/memoserv/ms_ignore.cpp index 52ec79944..434a2b4cf 100644 --- a/modules/memoserv/ms_ignore.cpp +++ b/modules/memoserv/ms_ignore.cpp @@ -51,7 +51,7 @@ public: source.Reply(ACCESS_DENIED); else if (command.equals_ci("ADD") && !param.empty()) { - if (mi->ignores.size() >= Config->GetModule(this->owner)->Get("max", "50")) + if (mi->ignores.size() >= Config->GetModule(this->owner).Get("max", "50")) { source.Reply(_("Sorry, the memo ignore list for \002%s\002 is full."), channel.c_str()); return; diff --git a/modules/memoserv/ms_rsend.cpp b/modules/memoserv/ms_rsend.cpp index 8bcb7b3d9..6543e2451 100644 --- a/modules/memoserv/ms_rsend.cpp +++ b/modules/memoserv/ms_rsend.cpp @@ -48,7 +48,7 @@ public: return; } - if (Config->GetModule(this->owner)->Get("operonly") && !source.IsServicesOper()) + if (Config->GetModule(this->owner).Get("operonly") && !source.IsServicesOper()) source.Reply(ACCESS_DENIED); else { @@ -58,7 +58,7 @@ public: else if (result == MemoServService::MEMO_TOO_FAST) { auto lastmemosend = source.GetUser() ? source.GetUser()->lastmemosend : 0; - auto waitperiod = (lastmemosend + Config->GetModule("memoserv")->Get("senddelay")) - Anope::CurTime; + auto waitperiod = (lastmemosend + Config->GetModule("memoserv").Get("senddelay")) - Anope::CurTime; source.Reply(_("Please wait %s before using the %s command again."), Anope::Duration(waitperiod, source.GetAccount()).c_str(), source.command.c_str()); } else if (result == MemoServService::MEMO_TARGET_FULL) diff --git a/modules/memoserv/ms_send.cpp b/modules/memoserv/ms_send.cpp index e1ab3169d..ba025a5ca 100644 --- a/modules/memoserv/ms_send.cpp +++ b/modules/memoserv/ms_send.cpp @@ -57,7 +57,7 @@ public: else if (result == MemoServService::MEMO_TOO_FAST) { auto lastmemosend = source.GetUser() ? source.GetUser()->lastmemosend : 0; - auto waitperiod = (lastmemosend + Config->GetModule("memoserv")->Get("senddelay")) - Anope::CurTime; + auto waitperiod = (lastmemosend + Config->GetModule("memoserv").Get("senddelay")) - Anope::CurTime; source.Reply(_("Please wait %s before using the %s command again."), Anope::Duration(waitperiod, source.GetAccount()).c_str(), source.command.c_str()); } else if (result == MemoServService::MEMO_TARGET_FULL) diff --git a/modules/memoserv/ms_set.cpp b/modules/memoserv/ms_set.cpp index cce30581b..672aeec3b 100644 --- a/modules/memoserv/ms_set.cpp +++ b/modules/memoserv/ms_set.cpp @@ -155,7 +155,7 @@ private: source.Reply(_("You are not permitted to change your memo limit.")); return; } - int max_memos = Config->GetModule("memoserv")->Get("maxmemos"); + int max_memos = Config->GetModule("memoserv").Get("maxmemos"); limit = Anope::Convert(p1, -1); /* The first character is a digit, but we could still go negative @@ -255,7 +255,7 @@ public: "\002ON\002 is essentially \002LOGON\002 and \002NEW\002 combined.")); else if (subcommand.equals_ci("LIMIT")) { - int max_memos = Config->GetModule("memoserv")->Get("maxmemos"); + int max_memos = Config->GetModule("memoserv").Get("maxmemos"); if (source.IsServicesOper()) source.Reply(_("Syntax: \002LIMIT [\037user\037 | \037channel\037] {\037limit\037 | NONE} [HARD]\002\n" " \n" diff --git a/modules/nickserv/nickserv.cpp b/modules/nickserv/nickserv.cpp index 25d9a364e..7d34061c7 100644 --- a/modules/nickserv/nickserv.cpp +++ b/modules/nickserv/nickserv.cpp @@ -98,7 +98,7 @@ class NickServRelease final public: NickServRelease(Module *me, NickAlias *na, time_t delay) - : User(na->nick, Config->GetModule(me)->Get("enforceruser", "user"), Config->GetModule(me)->Get("enforcerhost", Me->GetName()), "", "", Me, "Services Enforcer", Anope::CurTime, "", {}, IRCD->UID_Retrieve(), NULL) + : User(na->nick, Config->GetModule(me).Get("enforceruser", "user"), Config->GetModule(me).Get("enforcerhost", Me->GetName()), "", "", Me, "Services Enforcer", Anope::CurTime, "", {}, IRCD->UID_Retrieve(), NULL) , Timer(me, delay) , nick(na->nick) { @@ -140,12 +140,12 @@ class NickServCore final { collided.Unset(na); - new NickServHeld(this, na, Config->GetModule(this)->Get("releasetimeout", "1m")); + new NickServHeld(this, na, Config->GetModule(this).Get("releasetimeout", "1m")); if (IRCD->CanSVSHold) - IRCD->SendSVSHold(na->nick, Config->GetModule(this)->Get("releasetimeout", "1m")); + IRCD->SendSVSHold(na->nick, Config->GetModule(this).Get("releasetimeout", "1m")); else - new NickServRelease(this, na, Config->GetModule(this)->Get("releasetimeout", "1m")); + new NickServRelease(this, na, Config->GetModule(this).Get("releasetimeout", "1m")); } } @@ -176,7 +176,7 @@ public: bool IsGuestNick(const Anope::string &nick) const override { - const auto guestnick = Config->GetModule(this)->Get("guestnick", "Guest####"); + const auto guestnick = Config->GetModule(this).Get("guestnick", "Guest####"); if (guestnick.empty()) return false; // No guest nick. @@ -208,7 +208,7 @@ public: else if (MOD_RESULT == EVENT_ALLOW) return; - if (Config->GetModule("nickserv")->Get("nonicknameownership")) + if (Config->GetModule("nickserv").Get("nonicknameownership")) return; if (!na->nc->HasExt("KILL_IMMED")) @@ -224,13 +224,13 @@ public: } else if (na->nc->HasExt("KILL_QUICK")) { - time_t killquick = Config->GetModule("nickserv")->Get("killquick", "20s"); + time_t killquick = Config->GetModule("nickserv").Get("killquick", "20s"); u->SendMessage(NickServ, _("If you do not change within %s, I will change your nick."), Anope::Duration(killquick, u->Account()).c_str()); new NickServCollide(this, this, u, na, killquick); } else { - time_t kill = Config->GetModule("nickserv")->Get("kill", "60s"); + time_t kill = Config->GetModule("nickserv").Get("kill", "60s"); u->SendMessage(NickServ, _("If you do not change within %s, I will change your nick."), Anope::Duration(kill, u->Account()).c_str()); new NickServCollide(this, this, u, na, kill); } @@ -241,10 +241,10 @@ public: void OnUserLogin(User *u) override { NickAlias *na = NickAlias::Find(u->nick); - if (na && *na->nc == u->Account() && !Config->GetModule("nickserv")->Get("nonicknameownership") && !na->nc->HasExt("UNCONFIRMED")) + if (na && *na->nc == u->Account() && !Config->GetModule("nickserv").Get("nonicknameownership") && !na->nc->HasExt("UNCONFIRMED")) u->SetMode(NickServ, "REGISTERED"); - const Anope::string &modesonid = Config->GetModule(this)->Get("modesonid"); + const Anope::string &modesonid = Config->GetModule(this).Get("modesonid"); if (!modesonid.empty()) u->SetModes(NickServ, modesonid); } @@ -261,7 +261,7 @@ public: for (auto i = 0; i < 10; ++i) { guestnick.clear(); - for (auto guestnickchr : Config->GetModule(this)->Get("guestnick", "Guest####").substr(0, IRCD->MaxNick)) + for (auto guestnickchr : Config->GetModule(this).Get("guestnick", "Guest####").substr(0, IRCD->MaxNick)) { if (guestnickchr == '#') guestnick.append(Anope::ToString(abs(Anope::RandomNumber()) % 10)); @@ -319,9 +319,9 @@ public: collided.Unset(na); /* clear pending collide */ } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - const Anope::string &nsnick = conf->GetModule(this)->Get("client"); + const Anope::string &nsnick = conf.GetModule(this).Get("client"); if (nsnick.empty()) throw ConfigException(Module::name + ": must be defined"); @@ -332,7 +332,7 @@ public: NickServ = bi; - spacesepstream(conf->GetModule(this)->Get("defaults", "memo_signon memo_receive")).GetTokens(defaults); + spacesepstream(conf.GetModule(this).Get("defaults", "memo_signon memo_receive")).GetTokens(defaults); if (defaults.empty()) { defaults.emplace_back("MEMO_SIGNON"); @@ -376,9 +376,9 @@ public: void OnNickIdentify(User *u) override { - Configuration::Block *block = Config->GetModule(this); + Configuration::Block &block = Config->GetModule(this); - if (block->Get("modeonid", "yes")) + if (block.Get("modeonid", "yes")) { for (const auto &[_, cc] : u->chans) { @@ -388,11 +388,11 @@ public: } } - const Anope::string &modesonid = block->Get("modesonid"); + const Anope::string &modesonid = block.Get("modesonid"); if (!modesonid.empty()) u->SetModes(NickServ, modesonid); - if (block->Get("forceemail", "yes") && u->Account()->email.empty()) + if (block.Get("forceemail", "yes") && u->Account()->email.empty()) { u->SendMessage(NickServ, _("You must now supply an email for your nick.\n" "This email will allow you to retrieve your password in\n" @@ -434,8 +434,8 @@ public: const NickAlias *na = NickAlias::Find(u->nick); - const Anope::string &unregistered_notice = Config->GetModule(this)->Get("unregistered_notice"); - if (!Config->GetModule("nickserv")->Get("nonicknameownership") && !unregistered_notice.empty() && !na && !u->IsIdentified()) + const Anope::string &unregistered_notice = Config->GetModule(this).Get("unregistered_notice"); + if (!Config->GetModule("nickserv").Get("nonicknameownership") && !unregistered_notice.empty() && !na && !u->IsIdentified()) u->SendMessage(NickServ, unregistered_notice.replace_all_cs("%n", u->nick)); else if (na && !u->IsIdentified(true)) this->Validate(u); @@ -477,7 +477,7 @@ public: { /* Reset +r and re-send account (even though it really should be set at this point) */ IRCD->SendLogin(u, na); - if (!Config->GetModule("nickserv")->Get("nonicknameownership") && na->nc == u->Account() && !na->nc->HasExt("UNCONFIRMED")) + if (!Config->GetModule("nickserv").Get("nonicknameownership") && na->nc == u->Account() && !na->nc->HasExt("UNCONFIRMED")) u->SetMode(NickServ, "REGISTERED"); Log(u, "", NickServ) << u->GetMask() << " automatically identified for group " << u->Account()->display; } @@ -496,7 +496,7 @@ public: { if (!params.empty() || source.c || source.service != *NickServ) return EVENT_CONTINUE; - if (!Config->GetModule("nickserv")->Get("nonicknameownership")) + if (!Config->GetModule("nickserv").Get("nonicknameownership")) source.Reply(_("\002%s\002 allows you to register a nickname and\n" "prevent others from using it. The following\n" "commands allow for registration and maintenance of\n" @@ -521,7 +521,7 @@ public: "Services Operators can also drop any nickname without needing\n" "to identify for the nick, and may view the access list for\n" "any nickname.")); - time_t nickserv_expire = Config->GetModule(this)->Get("expire", "1y"); + time_t nickserv_expire = Config->GetModule(this).Get("expire", "1y"); if (nickserv_expire >= 86400) source.Reply(_(" \n" "Accounts that are not used anymore are subject to\n" @@ -538,7 +538,7 @@ public: void OnUserQuit(User *u, const Anope::string &msg) override { - if (u->server && !u->server->GetQuitReason().empty() && Config->GetModule(this)->Get("hidenetsplitquit")) + if (u->server && !u->server->GetQuitReason().empty() && Config->GetModule(this).Get("hidenetsplitquit")) return; /* Update last quit and last seen for the user */ @@ -555,7 +555,7 @@ public: if (Anope::NoExpire || Anope::ReadOnly) return; - time_t nickserv_expire = Config->GetModule(this)->Get("expire", "90d"); + time_t nickserv_expire = Config->GetModule(this).Get("expire", "90d"); for (nickalias_map::const_iterator it = NickAliasList->begin(), it_end = NickAliasList->end(); it != it_end; ) { @@ -571,7 +571,7 @@ public: if (nickserv_expire && Anope::CurTime - na->last_seen >= nickserv_expire) expire = true; - if (na->nc->na == na && na->nc->aliases->size() > 1 && Config->GetModule("nickserv")->Get("preservedisplay")) + if (na->nc->na == na && na->nc->aliases->size() > 1 && Config->GetModule("nickserv").Get("preservedisplay")) expire = false; FOREACH_MOD(OnPreNickExpire, (na, expire)); @@ -589,13 +589,13 @@ public: { if (!na->nc->HasExt("UNCONFIRMED")) { - time_t nickserv_expire = Config->GetModule(this)->Get("expire", "1y"); + time_t nickserv_expire = Config->GetModule(this).Get("expire", "1y"); if (!na->HasExt("NS_NO_EXPIRE") && nickserv_expire && !Anope::NoExpire && (source.HasPriv("nickserv/auspex") || na->last_seen != Anope::CurTime)) info[_("Expires")] = Anope::strftime(na->last_seen + nickserv_expire, source.GetAccount()); } else { - time_t unconfirmed_expire = Config->GetModule("ns_register")->Get("unconfirmedexpire", "1d"); + time_t unconfirmed_expire = Config->GetModule("ns_register").Get("unconfirmedexpire", "1d"); info[_("Expires")] = Anope::strftime(na->time_registered + unconfirmed_expire, source.GetAccount()); } } diff --git a/modules/nickserv/ns_ajoin.cpp b/modules/nickserv/ns_ajoin.cpp index 8643a2c1b..a169022b1 100644 --- a/modules/nickserv/ns_ajoin.cpp +++ b/modules/nickserv/ns_ajoin.cpp @@ -139,9 +139,9 @@ class CommandNSAJoin final if ((*channels)->at(i)->channel.equals_ci(chan)) break; - if ((*channels)->size() >= Config->GetModule(this->owner)->Get("ajoinmax")) + if ((*channels)->size() >= Config->GetModule(this->owner).Get("ajoinmax")) { - source.Reply(_("Sorry, the maximum of %d auto join entries has been reached."), Config->GetModule(this->owner)->Get("ajoinmax")); + source.Reply(_("Sorry, the maximum of %d auto join entries has been reached."), Config->GetModule(this->owner).Get("ajoinmax")); return; } else if (i != (*channels)->size()) diff --git a/modules/nickserv/ns_cert.cpp b/modules/nickserv/ns_cert.cpp index 9a697df17..15f6dbab8 100644 --- a/modules/nickserv/ns_cert.cpp +++ b/modules/nickserv/ns_cert.cpp @@ -204,7 +204,7 @@ private: void DoAdd(CommandSource &source, NickCore *nc, Anope::string certfp) { NSCertList *cl = nc->Require("certificates"); - unsigned max = Config->GetModule(this->owner)->Get("max", "5"); + unsigned max = Config->GetModule(this->owner).Get("max", "5"); if (cl->GetCertCount() >= max) { @@ -325,7 +325,7 @@ public: source.Reply(ACCESS_DENIED); return; } - else if (Config->GetModule("nickserv")->Get("secureadmins", "yes") && source.GetAccount() != na->nc && na->nc->IsServicesOper() && !cmd.equals_ci("LIST")) + else if (Config->GetModule("nickserv").Get("secureadmins", "yes") && source.GetAccount() != na->nc && na->nc->IsServicesOper() && !cmd.equals_ci("LIST")) { source.Reply(_("You may view but not modify the certificate list of other Services Operators.")); return; @@ -401,7 +401,7 @@ public: if (!nc || nc->HasExt("NS_SUSPENDED")) return; - unsigned int maxlogins = Config->GetModule("ns_identify")->Get("maxlogins"); + unsigned int maxlogins = Config->GetModule("ns_identify").Get("maxlogins"); if (maxlogins && nc->users.size() >= maxlogins) { u->SendMessage(NickServ, _("Account \002%s\002 has already reached the maximum number of simultaneous logins (%u)."), nc->display.c_str(), maxlogins); @@ -420,7 +420,7 @@ public: void OnNickRegister(User *u, NickAlias *na, const Anope::string &pass) override { - if (!Config->GetModule(this)->Get("automatic", "yes") || !u || u->fingerprint.empty()) + if (!Config->GetModule(this).Get("automatic", "yes") || !u || u->fingerprint.empty()) return; auto *cl = certs.Require(na->nc); @@ -437,7 +437,7 @@ public: { BotInfo *NickServ = Config->GetClient("NickServ"); - unsigned int maxlogins = Config->GetModule("ns_identify")->Get("maxlogins"); + unsigned int maxlogins = Config->GetModule("ns_identify").Get("maxlogins"); if (maxlogins && na->nc->users.size() >= maxlogins) { u->SendMessage(NickServ, _("Account \002%s\002 has already reached the maximum number of simultaneous logins (%u)."), na->nc->display.c_str(), maxlogins); diff --git a/modules/nickserv/ns_drop.cpp b/modules/nickserv/ns_drop.cpp index 791db0bfb..f2e152ce8 100644 --- a/modules/nickserv/ns_drop.cpp +++ b/modules/nickserv/ns_drop.cpp @@ -51,13 +51,13 @@ public: return; } - if (Config->GetModule("nickserv")->Get("secureadmins", "yes") && !is_mine && na->nc->IsServicesOper()) + if (Config->GetModule("nickserv").Get("secureadmins", "yes") && !is_mine && na->nc->IsServicesOper()) { source.Reply(_("You may not drop other Services Operators' nicknames.")); return; } - if (na->nc->na == na && na->nc->aliases->size() > 1 && Config->GetModule("nickserv")->Get("preservedisplay") && !source.HasPriv("nickserv/drop/display")) + if (na->nc->na == na && na->nc->aliases->size() > 1 && Config->GetModule("nickserv").Get("preservedisplay") && !source.HasPriv("nickserv/drop/display")) { source.Reply(_("You may not drop \002%s\002 as it is the display nick for the account."), na->nick.c_str()); return; diff --git a/modules/nickserv/ns_group.cpp b/modules/nickserv/ns_group.cpp index 47d8066e0..69df8d16e 100644 --- a/modules/nickserv/ns_group.cpp +++ b/modules/nickserv/ns_group.cpp @@ -138,7 +138,7 @@ public: return; } - if (Config->GetModule("nickserv")->Get("restrictopernicks")) + if (Config->GetModule("nickserv").Get("restrictopernicks")) { for (auto *o : Oper::opers) { @@ -151,8 +151,8 @@ public: } NickAlias *target, *na = NickAlias::Find(source.GetNick()); - time_t reg_delay = Config->GetModule("nickserv")->Get("regdelay"); - unsigned maxaliases = Config->GetModule(this->owner)->Get("maxaliases"); + time_t reg_delay = Config->GetModule("nickserv").Get("regdelay"); + unsigned maxaliases = Config->GetModule(this->owner).Get("maxaliases"); if (!(target = NickAlias::Find(nick))) source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); else if (user && Anope::CurTime < user->lastnickreg + reg_delay) @@ -165,7 +165,7 @@ public: Log(LOG_COMMAND, source, this) << "and tried to group to SUSPENDED nick " << target->nick; source.Reply(NICK_X_SUSPENDED, target->nick.c_str()); } - else if (na && Config->GetModule(this->owner)->Get("nogroupchange")) + else if (na && Config->GetModule(this->owner).Get("nogroupchange")) source.Reply(_("Your nick is already registered.")); else if (na && *target->nc == *na->nc) source.Reply(_("You are already a member of the group of \002%s\002."), target->nick.c_str()); @@ -336,8 +336,8 @@ public: ListFormatter list(source.GetAccount()); list.AddColumn(_("Nick")).AddColumn(_("Expires")); - time_t nickserv_expire = Config->GetModule("nickserv")->Get("expire", "90d"), - unconfirmed_expire = Config->GetModule("ns_register")->Get("unconfirmedexpire", "1d"); + time_t nickserv_expire = Config->GetModule("nickserv").Get("expire", "90d"), + unconfirmed_expire = Config->GetModule("ns_register").Get("unconfirmedexpire", "1d"); for (auto *na2 : *nc->aliases) { Anope::string expires; @@ -398,7 +398,7 @@ public: NSGroup(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR), commandnsgroup(this), commandnsungroup(this), commandnsglist(this) { - if (Config->GetModule("nickserv")->Get("nonicknameownership")) + if (Config->GetModule("nickserv").Get("nonicknameownership")) throw ModuleException(modname + " can not be used with options:nonicknameownership enabled"); } }; diff --git a/modules/nickserv/ns_identify.cpp b/modules/nickserv/ns_identify.cpp index c1f077ee5..44e6bb840 100644 --- a/modules/nickserv/ns_identify.cpp +++ b/modules/nickserv/ns_identify.cpp @@ -95,7 +95,7 @@ public: return; } - unsigned int maxlogins = Config->GetModule(this->owner)->Get("maxlogins"); + unsigned int maxlogins = Config->GetModule(this->owner).Get("maxlogins"); if (na && maxlogins && na->nc->users.size() >= maxlogins) { source.Reply(_("Account \002%s\002 has already reached the maximum number of simultaneous logins (%u)."), na->nc->display.c_str(), maxlogins); diff --git a/modules/nickserv/ns_list.cpp b/modules/nickserv/ns_list.cpp index c322d259b..5a5beacbd 100644 --- a/modules/nickserv/ns_list.cpp +++ b/modules/nickserv/ns_list.cpp @@ -30,7 +30,7 @@ public: bool is_servadmin = source.HasCommand("nickserv/list"); int count = 0, from = 0, to = 0; bool suspended, nsnoexpire, unconfirmed; - unsigned listmax = Config->GetModule(this->owner)->Get("listmax", "50"); + unsigned listmax = Config->GetModule(this->owner).Get("listmax", "50"); suspended = nsnoexpire = unconfirmed = false; @@ -164,7 +164,7 @@ public: " \002LIST #51-100\002\n" " Lists all registered nicks within the given range (51-100).")); - const Anope::string ®exengine = Config->GetBlock("options")->Get("regexengine"); + const Anope::string ®exengine = Config->GetBlock("options").Get("regexengine"); if (!regexengine.empty()) { source.Reply(" "); diff --git a/modules/nickserv/ns_maxemail.cpp b/modules/nickserv/ns_maxemail.cpp index 45409188d..ab18e4b54 100644 --- a/modules/nickserv/ns_maxemail.cpp +++ b/modules/nickserv/ns_maxemail.cpp @@ -38,7 +38,7 @@ class NSMaxEmail final bool CheckLimitReached(CommandSource &source, const Anope::string &email) { - int NSEmailMax = Config->GetModule(this)->Get("maxemails"); + int NSEmailMax = Config->GetModule(this).Get("maxemails"); if (NSEmailMax < 1 || email.empty()) return false; @@ -79,9 +79,9 @@ public: { } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - clean = conf->GetModule(this)->Get("remove_aliases", "true"); + clean = conf.GetModule(this).Get("remove_aliases", "true"); } EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector ¶ms) override diff --git a/modules/nickserv/ns_recover.cpp b/modules/nickserv/ns_recover.cpp index 8de4a9e40..062eb1dfc 100644 --- a/modules/nickserv/ns_recover.cpp +++ b/modules/nickserv/ns_recover.cpp @@ -71,7 +71,7 @@ public: Log(LOG_COMMAND, source, cmd) << "and was automatically identified to " << u->Account()->display; } - if (Config->GetModule("ns_recover")->Get("restoreonrecover")) + if (Config->GetModule("ns_recover").Get("restoreonrecover")) { if (!u->chans.empty()) { @@ -239,14 +239,14 @@ public: commandnsrecover(this), recover(this, "recover"), svsnick(this, "svsnick") { - if (Config->GetModule("nickserv")->Get("nonicknameownership")) + if (Config->GetModule("nickserv").Get("nonicknameownership")) throw ModuleException(modname + " can not be used with options:nonicknameownership enabled"); } void OnUserNickChange(User *u, const Anope::string &oldnick) override { - if (Config->GetModule(this)->Get("restoreonrecover")) + if (Config->GetModule(this).Get("restoreonrecover")) { NSRecoverInfo *ei = recover.Get(u); BotInfo *NickServ = Config->GetClient("NickServ"); @@ -281,7 +281,7 @@ public: void OnJoinChannel(User *u, Channel *c) override { - if (Config->GetModule(this)->Get("restoreonrecover")) + if (Config->GetModule(this).Get("restoreonrecover")) { NSRecoverInfo *ei = recover.Get(u); diff --git a/modules/nickserv/ns_register.cpp b/modules/nickserv/ns_register.cpp index 38fa55ca5..8222f7ad3 100644 --- a/modules/nickserv/ns_register.cpp +++ b/modules/nickserv/ns_register.cpp @@ -56,7 +56,7 @@ public: NickAlias *u_na = NickAlias::Find(u->nick); /* Set +r if they're on a nick in the group */ - if (!Config->GetModule("nickserv")->Get("nonicknameownership") && u_na && *u_na->nc == *na->nc) + if (!Config->GetModule("nickserv").Get("nonicknameownership") && u_na && *u_na->nc == *na->nc) u->SetMode(source.service, "REGISTERED"); } } @@ -79,7 +79,7 @@ public: if (na) { IRCD->SendLogin(source.GetUser(), na); - if (!Config->GetModule("nickserv")->Get("nonicknameownership") && na->nc == source.GetAccount() && !na->nc->HasExt("UNCONFIRMED")) + if (!Config->GetModule("nickserv").Get("nonicknameownership") && na->nc == source.GetAccount() && !na->nc->HasExt("UNCONFIRMED")) source.GetUser()->SetMode(source.service, "REGISTERED"); } } @@ -124,7 +124,7 @@ public: CommandNSRegister(Module *creator) : Command(creator, "nickserv/register", 1, 2) { this->SetDesc(_("Register a nickname")); - if (Config->GetModule("nickserv")->Get("forceemail", "yes")) + if (Config->GetModule("nickserv").Get("forceemail", "yes")) this->SetSyntax(_("\037password\037 \037email\037")); else this->SetSyntax(_("\037password\037 \037[email]\037")); @@ -137,7 +137,7 @@ public: Anope::string u_nick = source.GetNick(); Anope::string pass = params[0]; Anope::string email = params.size() > 1 ? params[1] : ""; - const Anope::string &nsregister = Config->GetModule(this->owner)->Get("registration"); + const Anope::string &nsregister = Config->GetModule(this->owner).Get("registration"); if (Anope::ReadOnly) { @@ -151,8 +151,8 @@ public: return; } - time_t nickregdelay = Config->GetModule(this->owner)->Get("nickregdelay"); - time_t reg_delay = Config->GetModule("nickserv")->Get("regdelay"); + time_t nickregdelay = Config->GetModule(this->owner).Get("nickregdelay"); + time_t reg_delay = Config->GetModule("nickserv").Get("regdelay"); if (u && !u->HasMode("OPER") && nickregdelay && Anope::CurTime - u->timestamp < nickregdelay) { auto waitperiod = (u->timestamp + nickregdelay) - Anope::CurTime; @@ -179,7 +179,7 @@ public: return; } - if (Config->GetModule("nickserv")->Get("restrictopernicks")) + if (Config->GetModule("nickserv").Get("restrictopernicks")) { for (auto *o : Oper::opers) { @@ -191,10 +191,10 @@ public: } } - unsigned int minpasslen = Config->GetModule("nickserv")->Get("minpasslen", "10"); - unsigned int maxpasslen = Config->GetModule("nickserv")->Get("maxpasslen", "50"); + unsigned int minpasslen = Config->GetModule("nickserv").Get("minpasslen", "10"); + unsigned int maxpasslen = Config->GetModule("nickserv").Get("maxpasslen", "50"); - if (Config->GetModule("nickserv")->Get("forceemail", "yes") && email.empty()) + if (Config->GetModule("nickserv").Get("forceemail", "yes") && email.empty()) this->OnSyntaxError(source, ""); else if (u && Anope::CurTime < u->lastnickreg + reg_delay) { @@ -271,7 +271,7 @@ public: bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - unsigned int minpasslen = Config->GetModule("nickserv")->Get("minpasslen", "10"); + unsigned int minpasslen = Config->GetModule("nickserv").Get("minpasslen", "10"); this->SendSyntax(source); source.Reply(" "); source.Reply(_("Registers your nickname in the %s database. Once\n" @@ -294,7 +294,7 @@ public: source.service->nick.c_str(), source.service->nick.c_str(), minpasslen); - if (!Config->GetModule("nickserv")->Get("forceemail", "yes")) + if (!Config->GetModule("nickserv").Get("forceemail", "yes")) { source.Reply(" "); source.Reply(_("The \037email\037 parameter is optional and will set the email\n" @@ -322,7 +322,7 @@ public: void Execute(CommandSource &source, const std::vector ¶ms) override { - if (!Config->GetModule(this->owner)->Get("registration").equals_ci("mail")) + if (!Config->GetModule(this->owner).Get("registration").equals_ci("mail")) { source.Reply(ACCESS_DENIED); return; @@ -336,7 +336,7 @@ public: source.Reply(_("Your account is already confirmed.")); else { - if (Anope::CurTime < source.nc->lastmail + Config->GetModule(this->owner)->Get("resenddelay")) + if (Anope::CurTime < source.nc->lastmail + Config->GetModule(this->owner).Get("resenddelay")) source.Reply(_("Cannot send mail now; please retry a little later.")); else if (SendRegmail(source.GetUser(), na, source.service)) { @@ -353,7 +353,7 @@ public: bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - if (!Config->GetModule(this->owner)->Get("registration").equals_ci("mail")) + if (!Config->GetModule(this->owner).Get("registration").equals_ci("mail")) return false; this->SendSyntax(source); @@ -364,7 +364,7 @@ public: void OnServHelp(CommandSource &source) override { - if (Config->GetModule(this->owner)->Get("registration").equals_ci("mail")) + if (Config->GetModule(this->owner).Get("registration").equals_ci("mail")) Command::OnServHelp(source); } }; @@ -384,7 +384,7 @@ public: commandnsregister(this), commandnsconfirm(this), commandnsrsend(this), unconfirmed(this, "UNCONFIRMED"), passcode(this, "passcode") { - if (Config->GetModule(this)->Get("registration").equals_ci("disable")) + if (Config->GetModule(this).Get("registration").equals_ci("disable")) throw ModuleException("Module " + this->name + " will not load with registration disabled."); } @@ -393,14 +393,14 @@ public: BotInfo *NickServ; if (unconfirmed.HasExt(u->Account()) && (NickServ = Config->GetClient("NickServ"))) { - const Anope::string &nsregister = Config->GetModule(this)->Get("registration"); + const Anope::string &nsregister = Config->GetModule(this).Get("registration"); if (nsregister.equals_ci("admin")) u->SendMessage(NickServ, _("All new accounts must be validated by an administrator. Please wait for your registration to be confirmed.")); else u->SendMessage(NickServ, _("Your email address is not confirmed. To confirm it, follow the instructions that were emailed to you.")); const NickAlias *this_na = u->AccountNick(); time_t time_registered = Anope::CurTime - this_na->time_registered; - time_t unconfirmed_expire = Config->GetModule(this)->Get("unconfirmedexpire", "1d"); + time_t unconfirmed_expire = Config->GetModule(this).Get("unconfirmedexpire", "1d"); if (unconfirmed_expire > time_registered) u->SendMessage(NickServ, _("Your account will expire, if not confirmed, in %s."), Anope::Duration(unconfirmed_expire - time_registered, u->Account()).c_str()); } @@ -410,7 +410,7 @@ public: { if (unconfirmed.HasExt(na->nc)) { - time_t unconfirmed_expire = Config->GetModule(this)->Get("unconfirmedexpire", "1d"); + time_t unconfirmed_expire = Config->GetModule(this).Get("unconfirmedexpire", "1d"); if (unconfirmed_expire && Anope::CurTime - na->time_registered >= unconfirmed_expire) expire = true; } @@ -428,15 +428,15 @@ static bool SendRegmail(User *u, const NickAlias *na, BotInfo *bi) *code = Anope::Random(15); } - Anope::string subject = Language::Translate(na->nc, Config->GetBlock("mail")->Get("registration_subject").c_str()), - message = Language::Translate(na->nc, Config->GetBlock("mail")->Get("registration_message").c_str()); + Anope::string subject = Language::Translate(na->nc, Config->GetBlock("mail").Get("registration_subject").c_str()), + message = Language::Translate(na->nc, Config->GetBlock("mail").Get("registration_message").c_str()); subject = subject.replace_all_cs("%n", na->nick); - subject = subject.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get("networkname")); + subject = subject.replace_all_cs("%N", Config->GetBlock("networkinfo").Get("networkname")); subject = subject.replace_all_cs("%c", *code); message = message.replace_all_cs("%n", na->nick); - message = message.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get("networkname")); + message = message.replace_all_cs("%N", Config->GetBlock("networkinfo").Get("networkname")); message = message.replace_all_cs("%c", *code); return Mail::Send(u, nc, bi, subject, message); diff --git a/modules/nickserv/ns_resetpass.cpp b/modules/nickserv/ns_resetpass.cpp index fbb8d1540..52dd4e139 100644 --- a/modules/nickserv/ns_resetpass.cpp +++ b/modules/nickserv/ns_resetpass.cpp @@ -73,7 +73,7 @@ public: NSResetPass(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR), commandnsresetpass(this), reset(this, "reset") { - if (!Config->GetBlock("mail")->Get("usemail")) + if (!Config->GetBlock("mail").Get("usemail")) throw ModuleException("Not using mail."); } @@ -132,16 +132,16 @@ public: static bool SendResetEmail(User *u, const NickAlias *na, BotInfo *bi) { - Anope::string subject = Language::Translate(na->nc, Config->GetBlock("mail")->Get("reset_subject").c_str()), - message = Language::Translate(na->nc, Config->GetBlock("mail")->Get("reset_message").c_str()), + Anope::string subject = Language::Translate(na->nc, Config->GetBlock("mail").Get("reset_subject").c_str()), + message = Language::Translate(na->nc, Config->GetBlock("mail").Get("reset_message").c_str()), passcode = Anope::Random(20); subject = subject.replace_all_cs("%n", na->nick); - subject = subject.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get("networkname")); + subject = subject.replace_all_cs("%N", Config->GetBlock("networkinfo").Get("networkname")); subject = subject.replace_all_cs("%c", passcode); message = message.replace_all_cs("%n", na->nick); - message = message.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get("networkname")); + message = message.replace_all_cs("%N", Config->GetBlock("networkinfo").Get("networkname")); message = message.replace_all_cs("%c", passcode); ResetInfo *ri = na->nc->Extend("reset"); diff --git a/modules/nickserv/ns_set.cpp b/modules/nickserv/ns_set.cpp index a1291fe26..b9d489ee3 100644 --- a/modules/nickserv/ns_set.cpp +++ b/modules/nickserv/ns_set.cpp @@ -34,8 +34,8 @@ public: source.Reply(_("Sets various nickname options. \037option\037 can be one of:")); Anope::string this_name = source.command; - bool hide_privileged_commands = Config->GetBlock("options")->Get("hideprivilegedcommands"), - hide_registered_commands = Config->GetBlock("options")->Get("hideregisteredcommands"); + bool hide_privileged_commands = Config->GetBlock("options").Get("hideprivilegedcommands"), + hide_registered_commands = Config->GetBlock("options").Get("hideregisteredcommands"); for (const auto &[c_name, info] : source.service->commands) { if (c_name.find_ci(this_name + " ") == 0) @@ -134,14 +134,14 @@ public: return; } - unsigned int minpasslen = Config->GetModule("nickserv")->Get("minpasslen", "10"); + unsigned int minpasslen = Config->GetModule("nickserv").Get("minpasslen", "10"); if (len < minpasslen) { source.Reply(PASSWORD_TOO_SHORT, minpasslen); return; } - unsigned int maxpasslen = Config->GetModule("nickserv")->Get("maxpasslen", "50"); + unsigned int maxpasslen = Config->GetModule("nickserv").Get("maxpasslen", "50"); if (len > maxpasslen) { source.Reply(PASSWORD_TOO_LONG, maxpasslen); @@ -196,7 +196,7 @@ public: size_t len = params[1].length(); - if (Config->GetModule("nickserv")->Get("secureadmins", "yes") && source.nc != nc && nc->IsServicesOper()) + if (Config->GetModule("nickserv").Get("secureadmins", "yes") && source.nc != nc && nc->IsServicesOper()) { source.Reply(_("You may not change the password of other Services Operators.")); return; @@ -208,14 +208,14 @@ public: return; } - unsigned int minpasslen = Config->GetModule("nickserv")->Get("minpasslen", "10"); + unsigned int minpasslen = Config->GetModule("nickserv").Get("minpasslen", "10"); if (len < minpasslen) { source.Reply(PASSWORD_TOO_SHORT, minpasslen); return; } - unsigned int maxpasslen = Config->GetModule("nickserv")->Get("maxpasslen", "50"); + unsigned int maxpasslen = Config->GetModule("nickserv").Get("maxpasslen", "50"); if (len > maxpasslen) { source.Reply(PASSWORD_TOO_LONG, maxpasslen); @@ -440,7 +440,7 @@ public: NickAlias *user_na = NickAlias::Find(user), *na = NickAlias::Find(param); - if (Config->GetModule("nickserv")->Get("nonicknameownership")) + if (Config->GetModule("nickserv").Get("nonicknameownership")) { source.Reply(_("This command may not be used on this network because nickname ownership is disabled.")); return; @@ -526,19 +526,19 @@ class CommandNSSetEmail n->first = new_email; n->second = code; - Anope::string subject = Config->GetBlock("mail")->Get("emailchange_subject"), - message = Config->GetBlock("mail")->Get("emailchange_message"); + Anope::string subject = Config->GetBlock("mail").Get("emailchange_subject"), + message = Config->GetBlock("mail").Get("emailchange_message"); subject = subject.replace_all_cs("%e", nc->email); subject = subject.replace_all_cs("%E", new_email); subject = subject.replace_all_cs("%n", nc->display); - subject = subject.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get("networkname")); + subject = subject.replace_all_cs("%N", Config->GetBlock("networkinfo").Get("networkname")); subject = subject.replace_all_cs("%c", code); message = message.replace_all_cs("%e", nc->email); message = message.replace_all_cs("%E", new_email); message = message.replace_all_cs("%n", nc->display); - message = message.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get("networkname")); + message = message.replace_all_cs("%N", Config->GetBlock("networkinfo").Get("networkname")); message = message.replace_all_cs("%c", code); Anope::string old = nc->email; @@ -577,12 +577,12 @@ public: return; } - if (param.empty() && Config->GetModule("nickserv")->Get("forceemail", "yes")) + if (param.empty() && Config->GetModule("nickserv").Get("forceemail", "yes")) { source.Reply(_("You cannot unset the email on this network.")); return; } - else if (Config->GetModule("nickserv")->Get("secureadmins", "yes") && source.nc != nc && nc->IsServicesOper()) + else if (Config->GetModule("nickserv").Get("secureadmins", "yes") && source.nc != nc && nc->IsServicesOper()) { source.Reply(_("You may not change the email of other Services Operators.")); return; @@ -598,8 +598,8 @@ public: if (MOD_RESULT == EVENT_STOP) return; - const auto nsmailreg = Config->GetModule("ns_register")->Get("registration").equals_ci("mail"); - if (!param.empty() && Config->GetModule("nickserv")->Get("confirmemailchanges", nsmailreg ? "yes" : "no") && !source.IsServicesOper()) + const auto nsmailreg = Config->GetModule("ns_register").Get("registration").equals_ci("mail"); + if (!param.empty() && Config->GetModule("nickserv").Get("confirmemailchanges", nsmailreg ? "yes" : "no") && !source.IsServicesOper()) { if (SendConfirmMail(source.GetUser(), source.GetAccount(), source.service, param)) { diff --git a/modules/nickserv/ns_set_keepmodes.cpp b/modules/nickserv/ns_set_keepmodes.cpp index e31b33dac..aa09d0555 100644 --- a/modules/nickserv/ns_set_keepmodes.cpp +++ b/modules/nickserv/ns_set_keepmodes.cpp @@ -191,7 +191,7 @@ public: { if (keep_modes.HasExt(u->Account())) { - const auto norestore = Config->GetModule(this)->Get("norestore"); + const auto norestore = Config->GetModule(this).Get("norestore"); User::ModeList modes = u->Account()->last_modes; for (const auto &[last_mode, last_value] : modes) { diff --git a/modules/nickserv/ns_set_kill.cpp b/modules/nickserv/ns_set_kill.cpp index 8447bf74f..0338c4bb8 100644 --- a/modules/nickserv/ns_set_kill.cpp +++ b/modules/nickserv/ns_set_kill.cpp @@ -30,7 +30,7 @@ public: return; } - if (Config->GetModule("nickserv")->Get("nonicknameownership")) + if (Config->GetModule("nickserv").Get("nonicknameownership")) { source.Reply(_("This command may not be used on this network because nickname ownership is disabled.")); return; @@ -67,7 +67,7 @@ public: } else if (param.equals_ci("IMMED")) { - if (Config->GetModule(this->owner)->Get("allowkillimmed")) + if (Config->GetModule(this->owner).Get("allowkillimmed")) { nc->Extend("KILLPROTECT"); nc->Shrink("KILL_QUICK"); diff --git a/modules/nickserv/ns_set_misc.cpp b/modules/nickserv/ns_set_misc.cpp index 173f1f2da..77dd62d92 100644 --- a/modules/nickserv/ns_set_misc.cpp +++ b/modules/nickserv/ns_set_misc.cpp @@ -200,21 +200,21 @@ public: delete data; } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { descriptions.clear(); - for (int i = 0; i < conf->CountBlock("command"); ++i) + for (int i = 0; i < conf.CountBlock("command"); ++i) { - Configuration::Block *block = conf->GetBlock("command", i); + Configuration::Block &block = conf.GetBlock("command", i); - const Anope::string &cmd = block->Get("command"); + const Anope::string &cmd = block.Get("command"); if (cmd != "nickserv/set/misc" && cmd != "nickserv/saset/misc") continue; - Anope::string cname = block->Get("name"); - Anope::string desc = block->Get("misc_description"); + Anope::string cname = block.Get("name"); + Anope::string desc = block.Get("misc_description"); if (cname.empty() || desc.empty()) continue; diff --git a/modules/nickserv/ns_suspend.cpp b/modules/nickserv/ns_suspend.cpp index 6cdce688a..950528e50 100644 --- a/modules/nickserv/ns_suspend.cpp +++ b/modules/nickserv/ns_suspend.cpp @@ -70,7 +70,7 @@ public: const Anope::string &nick = params[0]; Anope::string expiry = params[1]; Anope::string reason = params.size() > 2 ? params[2] : ""; - time_t expiry_secs = Config->GetModule(this->owner)->Get("suspendexpire"); + time_t expiry_secs = Config->GetModule(this->owner).Get("suspendexpire"); if (Anope::ReadOnly) source.Reply(READ_ONLY_MODE); @@ -98,7 +98,7 @@ public: return; } - if (Config->GetModule("nickserv")->Get("secureadmins", "yes") && na->nc->IsServicesOper()) + if (Config->GetModule("nickserv").Get("secureadmins", "yes") && na->nc->IsServicesOper()) { source.Reply(_("You may not suspend other Services Operators' nicknames.")); return; @@ -240,9 +240,9 @@ public: { } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - Anope::string s = conf->GetModule(this)->Get("show"); + Anope::string s = conf.GetModule(this).Get("show"); commasepstream(s).GetTokens(show); std::transform(show.begin(), show.end(), show.begin(), trim()); } diff --git a/modules/operserv/operserv.cpp b/modules/operserv/operserv.cpp index a05159179..836ee77c3 100644 --- a/modules/operserv/operserv.cpp +++ b/modules/operserv/operserv.cpp @@ -216,9 +216,9 @@ public: XLineManager::UnregisterXLineManager(&snlines); } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - const Anope::string &osnick = conf->GetModule(this)->Get("client"); + const Anope::string &osnick = conf.GetModule(this).Get("client"); if (osnick.empty()) throw ConfigException(this->name + ": must be defined"); @@ -232,7 +232,7 @@ public: EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message, const Anope::map &tags) override { - if (bi == OperServ && !u->HasMode("OPER") && Config->GetModule(this)->Get("opersonly")) + if (bi == OperServ && !u->HasMode("OPER") && Config->GetModule(this).Get("opersonly")) { u->SendMessage(bi, ACCESS_DENIED); Log(bi, "bados") << "Denied access to " << bi->nick << " from " << u->GetMask() << " (non-oper)"; diff --git a/modules/operserv/os_akill.cpp b/modules/operserv/os_akill.cpp index e904713cf..e24b7fca6 100644 --- a/modules/operserv/os_akill.cpp +++ b/modules/operserv/os_akill.cpp @@ -79,7 +79,7 @@ private: sep.GetToken(mask); } - time_t expires = !expiry.empty() ? Anope::DoTime(expiry) : Config->GetModule("operserv")->Get("autokillexpiry", "30d"); + time_t expires = !expiry.empty() ? Anope::DoTime(expiry) : Config->GetModule("operserv").Get("autokillexpiry", "30d"); /* If the expiry given does not contain a final letter, it's in days, * said the doc. Ah well. */ @@ -124,7 +124,7 @@ private: if (mask[0] == '/' && mask[mask.length() - 1] == '/') { - const Anope::string ®exengine = Config->GetBlock("options")->Get("regexengine"); + const Anope::string ®exengine = Config->GetBlock("options").Get("regexengine"); if (regexengine.empty()) { @@ -155,7 +155,7 @@ private: if (targ) mask = "*@" + targ->host; - if (Config->GetModule("operserv")->Get("addakiller", "yes") && !source.GetNick().empty()) + if (Config->GetModule("operserv").Get("addakiller", "yes") && !source.GetNick().empty()) reason = "[" + source.GetNick() + "] " + reason; if (mask.find_first_not_of("/~@.*?") == Anope::string::npos) @@ -170,7 +170,7 @@ private: } auto *x = new XLine(mask, source.GetNick(), expires, reason); - if (Config->GetModule("operserv")->Get("akillids")) + if (Config->GetModule("operserv").Get("akillids")) x->id = XLineManager::GenerateUID(); unsigned int affected = 0; @@ -202,7 +202,7 @@ private: } akills->AddXLine(x); - if (Config->GetModule("operserv")->Get("akillonadd")) + if (Config->GetModule("operserv").Get("akillonadd")) akills->Send(NULL, x); source.Reply(_("\002%s\002 added to the AKILL list."), mask.c_str()); @@ -362,7 +362,7 @@ private: ListFormatter list(source.GetAccount()); list.AddColumn(_("Number")).AddColumn(_("Mask")).AddColumn(_("Creator")).AddColumn(_("Created")).AddColumn(_("Expires")); - if (Config->GetModule("operserv")->Get("akillids")) + if (Config->GetModule("operserv").Get("akillids")) list.AddColumn(_("ID")); list.AddColumn(_("Reason")); @@ -443,7 +443,7 @@ public: "be given, even if it is the same as the default. The\n" "current AKILL default expiry time can be found with the\n" "\002STATS AKILL\002 command.")); - const Anope::string ®exengine = Config->GetBlock("options")->Get("regexengine"); + const Anope::string ®exengine = Config->GetBlock("options").Get("regexengine"); if (!regexengine.empty()) { source.Reply(" "); diff --git a/modules/operserv/os_chankill.cpp b/modules/operserv/os_chankill.cpp index 3ac583cb7..e66123a62 100644 --- a/modules/operserv/os_chankill.cpp +++ b/modules/operserv/os_chankill.cpp @@ -40,7 +40,7 @@ public: last_param = 2; } - time_t expires = !expiry.empty() ? Anope::DoTime(expiry) : Config->GetModule("operserv")->Get("autokillexpiry", "30d"); + time_t expires = !expiry.empty() ? Anope::DoTime(expiry) : Config->GetModule("operserv").Get("autokillexpiry", "30d"); if (!expiry.empty() && isdigit(expiry[expiry.length() - 1])) expires *= 86400; if (expires && expires < 60) @@ -63,7 +63,7 @@ public: if (!reason.empty()) { Anope::string realreason; - if (Config->GetModule("operserv")->Get("addakiller") && !source.GetNick().empty()) + if (Config->GetModule("operserv").Get("addakiller") && !source.GetNick().empty()) realreason = "[" + source.GetNick() + "] " + reason; else realreason = reason; diff --git a/modules/operserv/os_config.cpp b/modules/operserv/os_config.cpp index 22a46efa7..b10c59e4d 100644 --- a/modules/operserv/os_config.cpp +++ b/modules/operserv/os_config.cpp @@ -35,7 +35,7 @@ public: Configuration::MutableBlock *block = Config->GetMutableBlock(params[1]); if (!block) - block = Config->GetModule(params[1]); + block = &Config->GetModule(params[1]); if (!block) { @@ -57,8 +57,8 @@ public: for (unsigned i = 0; !show_blocks[i].empty(); ++i) { - Configuration::Block *block = Config->GetBlock(show_blocks[i]); - const Configuration::Block::item_map &items = block->GetItems(); + Configuration::Block &block = Config->GetBlock(show_blocks[i]); + const Configuration::Block::item_map &items = block.GetItems(); ListFormatter lflist(source.GetAccount()); lflist.AddColumn(_("Name")).AddColumn(_("Value")); @@ -74,7 +74,7 @@ public: std::vector replies; lflist.Process(replies); - source.Reply(_("%s settings:"), block->GetName().c_str()); + source.Reply(_("%s settings:"), block.GetName().c_str()); for (const auto &reply : replies) source.Reply(reply); @@ -87,14 +87,14 @@ public: for (int i = 0; i < Config->CountBlock("module"); ++i) { - Configuration::Block *block = Config->GetBlock("module", i); - const Configuration::Block::item_map &items = block->GetItems(); + Configuration::Block &block = Config->GetBlock("module", i); + const Configuration::Block::item_map &items = block.GetItems(); if (items.size() <= 1) continue; ListFormatter::ListEntry entry; - entry["Module Name"] = block->Get("name"); + entry["Module Name"] = block.Get("name"); for (const auto &[name, value] : items) { diff --git a/modules/operserv/os_defcon.cpp b/modules/operserv/os_defcon.cpp index 65a6555a6..5fd2d59bb 100644 --- a/modules/operserv/os_defcon.cpp +++ b/modules/operserv/os_defcon.cpp @@ -331,31 +331,34 @@ public: } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - Configuration::Block *block = conf->GetModule(this); DefconConfig dconfig; - dconfig.defaultlevel = block->Get("defaultlevel"); - dconfig.defcons[4] = block->Get("level4"); - dconfig.defcons[3] = block->Get("level3"); - dconfig.defcons[2] = block->Get("level2"); - dconfig.defcons[1] = block->Get("level1"); - dconfig.sessionlimit = block->Get("sessionlimit"); - dconfig.akillreason = block->Get("akillreason"); - dconfig.akillexpire = block->Get("akillexpire"); - dconfig.chanmodes = block->Get("chanmodes"); - dconfig.timeout = block->Get("timeout"); - dconfig.globalondefcon = block->Get("globalondefcon"); - dconfig.message = block->Get("message"); - dconfig.offmessage = block->Get("offmessage"); + { + Configuration::Block &block = conf.GetModule(this); + dconfig.defaultlevel = block.Get("defaultlevel"); + dconfig.defcons[4] = block.Get("level4"); + dconfig.defcons[3] = block.Get("level3"); + dconfig.defcons[2] = block.Get("level2"); + dconfig.defcons[1] = block.Get("level1"); + dconfig.sessionlimit = block.Get("sessionlimit"); + dconfig.akillreason = block.Get("akillreason"); + dconfig.akillexpire = block.Get("akillexpire"); + dconfig.chanmodes = block.Get("chanmodes"); + dconfig.timeout = block.Get("timeout"); + dconfig.globalondefcon = block.Get("globalondefcon"); + dconfig.message = block.Get("message"); + dconfig.offmessage = block.Get("offmessage"); + } - block = conf->GetModule("os_session"); - - dconfig.max_session_kill = block->Get("maxsessionkill"); - dconfig.session_autokill_expiry = block->Get("sessionautokillexpiry"); - dconfig.sle_reason = block->Get("sessionlimitexceeded"); - dconfig.sle_detailsloc = block->Get("sessionlimitdetailsloc"); + { + Configuration::Block &block = conf.GetModule("os_session"); + dconfig.max_session_kill = block.Get("maxsessionkill"); + dconfig.session_autokill_expiry = block.Get("sessionautokillexpiry"); + dconfig.sle_reason = block.Get("sessionlimitexceeded"); + dconfig.sle_detailsloc = block.Get("sessionlimitdetailsloc"); + } if (dconfig.defaultlevel < 1 || dconfig.defaultlevel > 5) throw ConfigException("The value for must be between 1 and 5"); diff --git a/modules/operserv/os_dns.cpp b/modules/operserv/os_dns.cpp index 195cd0f25..147e29eaa 100644 --- a/modules/operserv/os_dns.cpp +++ b/modules/operserv/os_dns.cpp @@ -752,15 +752,15 @@ public: delete dns_servers->at(i - 1); } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - Configuration::Block *block = conf->GetModule(this); - this->ttl = block->Get("ttl"); - this->user_drop_mark = block->Get("user_drop_mark"); - this->user_drop_time = block->Get("user_drop_time"); - this->user_drop_readd_time = block->Get("user_drop_readd_time"); - this->remove_split_servers = block->Get("remove_split_servers"); - this->readd_connected_servers = block->Get("readd_connected_servers"); + Configuration::Block &block = conf.GetModule(this); + this->ttl = block.Get("ttl"); + this->user_drop_mark = block.Get("user_drop_mark"); + this->user_drop_time = block.Get("user_drop_time"); + this->user_drop_readd_time = block.Get("user_drop_readd_time"); + this->remove_split_servers = block.Get("remove_split_servers"); + this->readd_connected_servers = block.Get("readd_connected_servers"); } void OnNewServer(Server *s) override diff --git a/modules/operserv/os_forbid.cpp b/modules/operserv/os_forbid.cpp index 733c433cc..892d58d0c 100644 --- a/modules/operserv/os_forbid.cpp +++ b/modules/operserv/os_forbid.cpp @@ -239,7 +239,7 @@ public: } NickAlias *target = NickAlias::Find(entry); - if (target != NULL && Config->GetModule("nickserv")->Get("secureadmins", "yes") && target->nc->IsServicesOper()) + if (target != NULL && Config->GetModule("nickserv").Get("secureadmins", "yes") && target->nc->IsServicesOper()) { source.Reply(ACCESS_DENIED); return; @@ -312,7 +312,7 @@ public: BotInfo *OperServ = Config->GetClient("OperServ"); if (IRCD->CanSQLineChannel && OperServ) { - time_t inhabit = Config->GetModule("chanserv")->Get("inhabit", "1m"); + time_t inhabit = Config->GetModule("chanserv").Get("inhabit", "1m"); XLine x(c->name, OperServ->nick, Anope::CurTime + inhabit, d->reason); IRCD->SendSQLine(NULL, &x); } @@ -449,7 +449,7 @@ public: source.Reply(_("Forbid allows you to forbid usage of certain nicknames, channels,\n" "and email addresses. Wildcards are accepted for all entries.")); - const Anope::string ®exengine = Config->GetBlock("options")->Get("regexengine"); + const Anope::string ®exengine = Config->GetBlock("options").Get("regexengine"); if (!regexengine.empty()) { source.Reply(" "); @@ -513,7 +513,7 @@ public: ServiceReference chanserv("ChanServService", "ChanServ"); if (IRCD->CanSQLineChannel) { - time_t inhabit = Config->GetModule("chanserv")->Get("inhabit", "1m"); + time_t inhabit = Config->GetModule("chanserv").Get("inhabit", "1m"); XLine x(c->name, OperServ->nick, Anope::CurTime + inhabit, d->reason); IRCD->SendSQLine(NULL, &x); } diff --git a/modules/operserv/os_ignore.cpp b/modules/operserv/os_ignore.cpp index ecc1ad3b5..ec1dda883 100644 --- a/modules/operserv/os_ignore.cpp +++ b/modules/operserv/os_ignore.cpp @@ -383,7 +383,7 @@ public: " \n" "Ignores will not be enforced on IRC Operators.")); - const Anope::string ®exengine = Config->GetBlock("options")->Get("regexengine"); + const Anope::string ®exengine = Config->GetBlock("options").Get("regexengine"); if (!regexengine.empty()) { source.Reply(" "); diff --git a/modules/operserv/os_info.cpp b/modules/operserv/os_info.cpp index 3becec624..ed111a3cd 100644 --- a/modules/operserv/os_info.cpp +++ b/modules/operserv/os_info.cpp @@ -148,7 +148,7 @@ public: OperInfos *oi = e->Require("operinfo"); - if ((*oi)->size() >= Config->GetModule(this->module)->Get("max", "10")) + if ((*oi)->size() >= Config->GetModule(this->module).Get("max", "10")) { source.Reply(_("The oper info list for \002%s\002 is full."), target.c_str()); return; diff --git a/modules/operserv/os_kill.cpp b/modules/operserv/os_kill.cpp index e03a022c3..7ad58d062 100644 --- a/modules/operserv/os_kill.cpp +++ b/modules/operserv/os_kill.cpp @@ -35,7 +35,7 @@ public: { if (reason.empty()) reason = "No reason specified"; - if (Config->GetModule("operserv")->Get("addakiller")) + if (Config->GetModule("operserv").Get("addakiller")) reason = "(" + source.GetNick() + ") " + reason; Log(LOG_ADMIN, source, this) << "on " << u2->nick << " for " << reason; u2->Kill(*source.service, reason); diff --git a/modules/operserv/os_list.cpp b/modules/operserv/os_list.cpp index a80683054..46c4c89bb 100644 --- a/modules/operserv/os_list.cpp +++ b/modules/operserv/os_list.cpp @@ -117,7 +117,7 @@ public: "specified, lists only channels matching \002pattern\002 that have the +s or\n" "+p mode.")); - const Anope::string ®exengine = Config->GetBlock("options")->Get("regexengine"); + const Anope::string ®exengine = Config->GetBlock("options").Get("regexengine"); if (!regexengine.empty()) { source.Reply(" "); @@ -260,7 +260,7 @@ public: "only users that are on the given channel. If INVISIBLE is specified, only users\n" "with the +i flag will be listed.")); - const Anope::string ®exengine = Config->GetBlock("options")->Get("regexengine"); + const Anope::string ®exengine = Config->GetBlock("options").Get("regexengine"); if (!regexengine.empty()) { source.Reply(" "); diff --git a/modules/operserv/os_logsearch.cpp b/modules/operserv/os_logsearch.cpp index f4f6b9210..cd3781ae1 100644 --- a/modules/operserv/os_logsearch.cpp +++ b/modules/operserv/os_logsearch.cpp @@ -85,7 +85,7 @@ public: bool wildcard = search_string.find_first_of("?*") != Anope::string::npos; bool regex = !search_string.empty() && search_string[0] == '/' && search_string[search_string.length() - 1] == '/'; - const Anope::string &logfile_name = Config->GetModule(this->owner)->Get("logname"); + const Anope::string &logfile_name = Config->GetModule(this->owner).Get("logname"); std::vector matches; for (int d = days - 1; d >= 0; --d) { diff --git a/modules/operserv/os_news.cpp b/modules/operserv/os_news.cpp index ba6fe37bf..33fa657ef 100644 --- a/modules/operserv/os_news.cpp +++ b/modules/operserv/os_news.cpp @@ -318,7 +318,7 @@ public: "to them. However, no more than \002%d\002 messages will be\n" "sent in order to avoid flooding the user. If there are\n" "more news messages, only the most recent will be sent."), - Config->GetModule(this->owner)->Get("newscount", "3")); + Config->GetModule(this->owner).Get("newscount", "3")); return true; } }; @@ -346,7 +346,7 @@ public: "be sent to them. However, no more than \002%d\002 messages will\n" "be sent in order to avoid flooding the user. If there are\n" "more news messages, only the most recent will be sent."), - Config->GetModule(this->owner)->Get("newscount", "3")); + Config->GetModule(this->owner).Get("newscount", "3")); return true; } }; @@ -399,9 +399,9 @@ class OSNews final BotInfo *bi = NULL; if (Type == NEWS_OPER) - bi = BotInfo::Find(Config->GetModule(this)->Get("oper_announcer", "OperServ"), true); + bi = BotInfo::Find(Config->GetModule(this).Get("oper_announcer", "OperServ"), true); else - bi = BotInfo::Find(Config->GetModule(this)->Get("announcer", "Global"), true); + bi = BotInfo::Find(Config->GetModule(this).Get("announcer", "Global"), true); if (bi == NULL) return; @@ -448,11 +448,11 @@ public: { } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - oper_announcer = conf->GetModule(this)->Get("oper_announcer", "OperServ"); - announcer = conf->GetModule(this)->Get("announcer", "Global"); - news_count = conf->GetModule(this)->Get("newscount", "3"); + oper_announcer = conf.GetModule(this).Get("oper_announcer", "OperServ"); + announcer = conf.GetModule(this).Get("announcer", "Global"); + news_count = conf.GetModule(this).Get("newscount", "3"); } void OnUserModeSet(const MessageSource &setter, User *u, const Anope::string &mname) override diff --git a/modules/operserv/os_session.cpp b/modules/operserv/os_session.cpp index 5e2399d53..93ba17473 100644 --- a/modules/operserv/os_session.cpp +++ b/modules/operserv/os_session.cpp @@ -591,21 +591,21 @@ public: ModuleManager::SetPriority(this, PRIORITY_FIRST); } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - Configuration::Block *block = Config->GetModule(this); + Configuration::Block &block = Config->GetModule(this); - session_limit = block->Get("defaultsessionlimit"); - max_session_kill = block->Get("maxsessionkill"); - session_autokill_expiry = block->Get("sessionautokillexpiry"); - sle_reason = block->Get("sessionlimitexceeded"); - sle_detailsloc = block->Get("sessionlimitdetailsloc"); + session_limit = block.Get("defaultsessionlimit"); + max_session_kill = block.Get("maxsessionkill"); + session_autokill_expiry = block.Get("sessionautokillexpiry"); + sle_reason = block.Get("sessionlimitexceeded"); + sle_detailsloc = block.Get("sessionlimitdetailsloc"); - max_exception_limit = block->Get("maxsessionlimit"); - exception_expiry = block->Get("exceptionexpiry"); + max_exception_limit = block.Get("maxsessionlimit"); + exception_expiry = block.Get("exceptionexpiry"); - ipv4_cidr = block->Get("session_ipv4_cidr", "32"); - ipv6_cidr = block->Get("session_ipv6_cidr", "128"); + ipv4_cidr = block.Get("session_ipv4_cidr", "32"); + ipv6_cidr = block.Get("session_ipv6_cidr", "128"); if (ipv4_cidr > 32 || ipv6_cidr > 128) throw ConfigException(this->name + ": session CIDR value out of range"); diff --git a/modules/operserv/os_set.cpp b/modules/operserv/os_set.cpp index d7f3fc711..50451d53a 100644 --- a/modules/operserv/os_set.cpp +++ b/modules/operserv/os_set.cpp @@ -77,7 +77,7 @@ private: * * Rob **/ - bool super_admin = Config->GetModule(this->owner)->Get("superadmin"); + bool super_admin = Config->GetModule(this->owner).Get("superadmin"); if (!super_admin) source.Reply(_("Super admin can not be set because it is not enabled in the configuration.")); else if (setting.equals_ci("ON")) diff --git a/modules/operserv/os_shutdown.cpp b/modules/operserv/os_shutdown.cpp index 5ebdb2200..37dc15747 100644 --- a/modules/operserv/os_shutdown.cpp +++ b/modules/operserv/os_shutdown.cpp @@ -18,14 +18,14 @@ public: CommandOSQuit(Module *creator) : Command(creator, "operserv/quit", 0, 1) { this->SetDesc(_("Terminate services WITHOUT saving")); - if (Config->GetModule(this->owner)->Get("requirename")) + if (Config->GetModule(this->owner).Get("requirename")) this->SetSyntax(_("\037network-name\037")); } void Execute(CommandSource &source, const std::vector ¶ms) override { - const auto requirename = Config->GetModule(this->owner)->Get("requirename"); - const auto networkname = Config->GetBlock("networkinfo")->Get("networkname"); + const auto requirename = Config->GetModule(this->owner).Get("requirename"); + const auto networkname = Config->GetBlock("networkinfo").Get("networkname"); if (requirename && (params.empty() || !params[0].equals_cs(networkname))) { OnSyntaxError(source, source.command); @@ -57,14 +57,14 @@ public: CommandOSRestart(Module *creator) : Command(creator, "operserv/restart", 0, 1) { this->SetDesc(_("Save databases and restart services")); - if (Config->GetModule(this->owner)->Get("requirename")) + if (Config->GetModule(this->owner).Get("requirename")) this->SetSyntax(_("\037network-name\037")); } void Execute(CommandSource &source, const std::vector ¶ms) override { - const auto requirename = Config->GetModule(this->owner)->Get("requirename"); - const auto networkname = Config->GetBlock("networkinfo")->Get("networkname"); + const auto requirename = Config->GetModule(this->owner).Get("requirename"); + const auto networkname = Config->GetBlock("networkinfo").Get("networkname"); if (requirename && (params.empty() || !params[0].equals_cs(networkname))) { OnSyntaxError(source, source.command); @@ -94,14 +94,14 @@ public: CommandOSShutdown(Module *creator) : Command(creator, "operserv/shutdown", 0, 1) { this->SetDesc(_("Terminate services with save")); - if (Config->GetModule(this->owner)->Get("requirename")) + if (Config->GetModule(this->owner).Get("requirename")) this->SetSyntax(_("\037network-name\037")); } void Execute(CommandSource &source, const std::vector ¶ms) override { - const auto requirename = Config->GetModule(this->owner)->Get("requirename"); - const auto networkname = Config->GetBlock("networkinfo")->Get("networkname"); + const auto requirename = Config->GetModule(this->owner).Get("requirename"); + const auto networkname = Config->GetBlock("networkinfo").Get("networkname"); if (requirename && (params.empty() || !params[0].equals_cs(networkname))) { OnSyntaxError(source, source.command); diff --git a/modules/operserv/os_stats.cpp b/modules/operserv/os_stats.cpp index 1190ac1fc..4b9b2f875 100644 --- a/modules/operserv/os_stats.cpp +++ b/modules/operserv/os_stats.cpp @@ -71,7 +71,7 @@ private: { /* AKILLs */ source.Reply(_("Current number of AKILLs: \002%zu\002"), akills->GetCount()); - timeout = Config->GetModule("operserv")->Get("autokillexpiry", "30d") + 59; + timeout = Config->GetModule("operserv").Get("autokillexpiry", "30d") + 59; if (timeout >= 172800) source.Reply(_("Default AKILL expiry time: \002%d days\002"), timeout / 86400); else if (timeout >= 86400) @@ -91,7 +91,7 @@ private: { /* SNLINEs */ source.Reply(_("Current number of SNLINEs: \002%zu\002"), snlines->GetCount()); - timeout = Config->GetModule("operserv")->Get("snlineexpiry", "30d") + 59; + timeout = Config->GetModule("operserv").Get("snlineexpiry", "30d") + 59; if (timeout >= 172800) source.Reply(_("Default SNLINE expiry time: \002%d days\002"), timeout / 86400); else if (timeout >= 86400) @@ -111,7 +111,7 @@ private: { /* SQLINEs */ source.Reply(_("Current number of SQLINEs: \002%zu\002"), sqlines->GetCount()); - timeout = Config->GetModule("operserv")->Get("sglineexpiry", "30d") + 59; + timeout = Config->GetModule("operserv").Get("sglineexpiry", "30d") + 59; if (timeout >= 172800) source.Reply(_("Default SQLINE expiry time: \002%d days\002"), timeout / 86400); else if (timeout >= 86400) diff --git a/modules/operserv/os_sxline.cpp b/modules/operserv/os_sxline.cpp index 270ece378..18ae3c0c0 100644 --- a/modules/operserv/os_sxline.cpp +++ b/modules/operserv/os_sxline.cpp @@ -202,7 +202,7 @@ private: { ListFormatter list(source.GetAccount()); list.AddColumn(_("Number")).AddColumn(_("Mask")).AddColumn(_("By")).AddColumn(_("Created")).AddColumn(_("Expires")); - if (Config->GetModule("operserv")->Get("akillids")) + if (Config->GetModule("operserv").Get("akillids")) list.AddColumn(_("ID")); list.AddColumn(_("Reason")); @@ -283,7 +283,7 @@ class CommandOSSNLine final last_param = 3; } - time_t expires = !expiry.empty() ? Anope::DoTime(expiry) : Config->GetModule("operserv")->Get("snlineexpiry", "30d"); + time_t expires = !expiry.empty() ? Anope::DoTime(expiry) : Config->GetModule("operserv").Get("snlineexpiry", "30d"); /* If the expiry given does not contain a final letter, it's in days, * said the doc. Ah well. */ @@ -327,7 +327,7 @@ class CommandOSSNLine final if (mask[0] == '/' && mask[mask.length() - 1] == '/') { - const Anope::string ®exengine = Config->GetBlock("options")->Get("regexengine"); + const Anope::string ®exengine = Config->GetBlock("options").Get("regexengine"); if (regexengine.empty()) { @@ -361,7 +361,7 @@ class CommandOSSNLine final if (mask[masklen - 1] == ' ') mask.erase(masklen - 1); - if (Config->GetModule("operserv")->Get("addakiller", "yes") && !source.GetNick().empty()) + if (Config->GetModule("operserv").Get("addakiller", "yes") && !source.GetNick().empty()) reason = "[" + source.GetNick() + "] " + reason; if (mask.find_first_not_of("/.*?") == Anope::string::npos) @@ -371,7 +371,7 @@ class CommandOSSNLine final } auto *x = new XLine(mask, source.GetNick(), expires, reason); - if (Config->GetModule("operserv")->Get("akillids")) + if (Config->GetModule("operserv").Get("akillids")) x->id = XLineManager::GenerateUID(); unsigned int affected = 0; @@ -404,7 +404,7 @@ class CommandOSSNLine final this->xlm()->AddXLine(x); - if (Config->GetModule("operserv")->Get("killonsnline", "yes")) + if (Config->GetModule("operserv").Get("killonsnline", "yes")) { Anope::string rreason = "G-Lined: " + reason; @@ -457,7 +457,7 @@ public: " \n" "\002Note\002: because the realname mask may contain spaces, the\n" "separator between it and the reason is a colon.")); - const Anope::string ®exengine = Config->GetBlock("options")->Get("regexengine"); + const Anope::string ®exengine = Config->GetBlock("options").Get("regexengine"); if (!regexengine.empty()) { source.Reply(" "); @@ -511,7 +511,7 @@ class CommandOSSQLine final last_param = 3; } - time_t expires = !expiry.empty() ? Anope::DoTime(expiry) : Config->GetModule("operserv")->Get("sqlineexpiry", "30d"); + time_t expires = !expiry.empty() ? Anope::DoTime(expiry) : Config->GetModule("operserv").Get("sqlineexpiry", "30d"); /* If the expiry given does not contain a final letter, it's in days, * said the doc. Ah well. */ @@ -544,7 +544,7 @@ class CommandOSSQLine final if (mask[0] == '/' && mask[mask.length() - 1] == '/') { - const Anope::string ®exengine = Config->GetBlock("options")->Get("regexengine"); + const Anope::string ®exengine = Config->GetBlock("options").Get("regexengine"); if (regexengine.empty()) { @@ -571,7 +571,7 @@ class CommandOSSQLine final } } - if (Config->GetModule("operserv")->Get("addakiller", "yes") && !source.GetNick().empty()) + if (Config->GetModule("operserv").Get("addakiller", "yes") && !source.GetNick().empty()) reason = "[" + source.GetNick() + "] " + reason; if (mask.find_first_not_of("./?*") == Anope::string::npos) @@ -581,7 +581,7 @@ class CommandOSSQLine final } auto *x = new XLine(mask, source.GetNick(), expires, reason); - if (Config->GetModule("operserv")->Get("akillids")) + if (Config->GetModule("operserv").Get("akillids")) x->id = XLineManager::GenerateUID(); unsigned int affected = 0; @@ -611,7 +611,7 @@ class CommandOSSQLine final this->xlm()->AddXLine(x); - if (Config->GetModule("operserv")->Get("killonsqline", "yes")) + if (Config->GetModule("operserv").Get("killonsqline", "yes")) { Anope::string rreason = "Q-Lined: " + reason; @@ -688,7 +688,7 @@ public: "must be given, even if it is the same as the default. The\n" "current SQLINE default expiry time can be found with the\n" "\002STATS AKILL\002 command.")); - const Anope::string ®exengine = Config->GetBlock("options")->Get("regexengine"); + const Anope::string ®exengine = Config->GetBlock("options").Get("regexengine"); if (!regexengine.empty()) { source.Reply(" "); diff --git a/modules/protocol/hybrid.cpp b/modules/protocol/hybrid.cpp index 59f535e8a..30ae296ff 100644 --- a/modules/protocol/hybrid.cpp +++ b/modules/protocol/hybrid.cpp @@ -796,7 +796,7 @@ public: message_tmode(this), message_uid(this) { - if (Config->GetModule(this)) + if (IRCD == &ircd_proto) this->AddModes(); } diff --git a/modules/protocol/inspircd.cpp b/modules/protocol/inspircd.cpp index b0e059d73..538a27a37 100644 --- a/modules/protocol/inspircd.cpp +++ b/modules/protocol/inspircd.cpp @@ -105,7 +105,7 @@ class InspIRCdProto final private: static Anope::string GetAccountNicks(NickAlias* na) { - if (!na || Config->GetModule("nickserv")->Get("nonicknameownership")) + if (!na || Config->GetModule("nickserv").Get("nonicknameownership")) return {}; Anope::string nicks; @@ -188,7 +188,7 @@ public: void SendConnect() override { Uplink::Send("CAPAB", "START", 1206); - Uplink::Send("CAPAB", "CAPABILITIES", "CASEMAPPING=" + Config->GetBlock("options")->Get("casemap", "ascii") + (sha256 ? " CHALLENGE=*" : "")); + Uplink::Send("CAPAB", "CAPABILITIES", "CASEMAPPING=" + Config->GetBlock("options").Get("casemap", "ascii") + (sha256 ? " CHALLENGE=*" : "")); Uplink::Send("CAPAB", "END"); } @@ -1553,7 +1553,7 @@ struct IRCDMessageCapab final IRCD->CanTagMessage = true; } - const auto &anoperegex = Config->GetBlock("options")->Get("regexengine"); + const auto &anoperegex = Config->GetBlock("options").Get("regexengine"); if (!anoperegex.empty() && !inspircdregex.empty() && anoperegex != inspircdregex) Log() << "Warning: InspIRCd is using regex engine " << inspircdregex << ", but we have " << anoperegex << ". This may cause inconsistencies."; } diff --git a/modules/proxyscan.cpp b/modules/proxyscan.cpp index 846095abc..53b94e696 100644 --- a/modules/proxyscan.cpp +++ b/modules/proxyscan.cpp @@ -260,23 +260,23 @@ public: delete this->listener; } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - Configuration::Block *config = Config->GetModule(this); + Configuration::Block &config = Config->GetModule(this); - Anope::string s_target_ip = config->Get("target_ip"); + Anope::string s_target_ip = config.Get("target_ip"); if (s_target_ip.empty()) throw ConfigException(this->name + " target_ip may not be empty"); - int s_target_port = config->Get("target_port", "-1"); + int s_target_port = config.Get("target_port", "-1"); if (s_target_port <= 0) throw ConfigException(this->name + " target_port may not be empty and must be a positive number"); - Anope::string s_listen_ip = config->Get("listen_ip"); + Anope::string s_listen_ip = config.Get("listen_ip"); if (s_listen_ip.empty()) throw ConfigException(this->name + " listen_ip may not be empty"); - int s_listen_port = config->Get("listen_port", "-1"); + int s_listen_port = config.Get("listen_port", "-1"); if (s_listen_port <= 0) throw ConfigException(this->name + " listen_port may not be empty and must be a positive number"); @@ -284,12 +284,12 @@ public: target_port = s_target_port; this->listen_ip = s_listen_ip; this->listen_port = s_listen_port; - this->con_notice = config->Get("connect_notice"); - this->con_source = config->Get("connect_source"); - add_to_akill = config->Get("add_to_akill", "true"); - this->connectionTimeout.SetSecs(config->Get("timeout", "5s")); + this->con_notice = config.Get("connect_notice"); + this->con_source = config.Get("connect_source"); + add_to_akill = config.Get("add_to_akill", "true"); + this->connectionTimeout.SetSecs(config.Get("timeout", "5s")); - ProxyCheckString = Config->GetBlock("networkinfo")->Get("networkname") + " proxy check"; + ProxyCheckString = Config->GetBlock("networkinfo").Get("networkname") + " proxy check"; delete this->listener; this->listener = NULL; try @@ -302,13 +302,13 @@ public: } this->proxyscans.clear(); - for (int i = 0; i < config->CountBlock("proxyscan"); ++i) + for (int i = 0; i < Config->CountBlock("proxyscan"); ++i) { - Configuration::Block *block = config->GetBlock("proxyscan", i); + Configuration::Block &block = config.GetBlock("proxyscan", i); ProxyCheck p; Anope::string token; - commasepstream sep(block->Get("type")); + commasepstream sep(block.Get("type")); while (sep.GetToken(token)) { if (!token.equals_ci("HTTP") && !token.equals_ci("SOCKS5")) @@ -318,7 +318,7 @@ public: if (p.types.empty()) continue; - commasepstream sep2(block->Get("port")); + commasepstream sep2(block.Get("port")); while (sep2.GetToken(token)) { if (auto port = Anope::TryConvert(token)) @@ -327,8 +327,8 @@ public: if (p.ports.empty()) continue; - p.duration = block->Get("time", "4h"); - p.reason = block->Get("reason"); + p.duration = block.Get("time", "4h"); + p.reason = block.Get("reason"); if (p.reason.empty()) continue; diff --git a/modules/redis.cpp b/modules/redis.cpp index 25ecf0678..f50b4c67f 100644 --- a/modules/redis.cpp +++ b/modules/redis.cpp @@ -535,19 +535,19 @@ public: } } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - Configuration::Block *block = conf->GetModule(this); + Configuration::Block &block = conf.GetModule(this); std::vector new_services; - for (int i = 0; i < block->CountBlock("redis"); ++i) + for (int i = 0; i < block.CountBlock("redis"); ++i) { - Configuration::Block *redis = block->GetBlock("redis", i); + Configuration::Block &redis = block.GetBlock("redis", i); - const Anope::string &n = redis->Get("name"), - &ip = redis->Get("ip"); - int port = redis->Get("port"); - unsigned db = redis->Get("db"); + const Anope::string &n = redis.Get("name"), + &ip = redis.Get("ip"); + int port = redis.Get("port"); + unsigned db = redis.Get("db"); delete services[n]; services[n] = new MyRedisService(this, n, ip, port, db); diff --git a/modules/regex_stdlib.cpp b/modules/regex_stdlib.cpp index 0e932c02a..ff524914a 100644 --- a/modules/regex_stdlib.cpp +++ b/modules/regex_stdlib.cpp @@ -67,11 +67,11 @@ public: this->SetPermanent(true); } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - Configuration::Block *block = conf->GetModule(this); + Configuration::Block &block = conf.GetModule(this); - const Anope::string syntax = block->Get("syntax", "ecmascript"); + const Anope::string syntax = block.Get("syntax", "ecmascript"); if (syntax == "awk") stdlib_regex_provider.type = std::regex::awk; else if (syntax == "basic") diff --git a/modules/rewrite.cpp b/modules/rewrite.cpp index 0a9b22dcb..28007dadd 100644 --- a/modules/rewrite.cpp +++ b/modules/rewrite.cpp @@ -163,23 +163,23 @@ public: { } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { Rewrite::rewrites.clear(); - for (int i = 0; i < conf->CountBlock("command"); ++i) + for (int i = 0; i < conf.CountBlock("command"); ++i) { - Configuration::Block *block = conf->GetBlock("command", i); + Configuration::Block &block = conf.GetBlock("command", i); - if (!block->Get("rewrite")) + if (!block.Get("rewrite")) continue; Rewrite rw; - rw.client = block->Get("service"); - rw.source_message = block->Get("rewrite_source"); - rw.target_message = block->Get("rewrite_target"); - rw.desc = block->Get("rewrite_description"); + rw.client = block.Get("service"); + rw.source_message = block.Get("rewrite_source"); + rw.target_message = block.Get("rewrite_target"); + rw.desc = block.Get("rewrite_description"); if (rw.client.empty() || rw.source_message.empty() || rw.target_message.empty()) continue; diff --git a/modules/rpc/jsonrpc.cpp b/modules/rpc/jsonrpc.cpp index 1e7315984..ad496708a 100644 --- a/modules/rpc/jsonrpc.cpp +++ b/modules/rpc/jsonrpc.cpp @@ -267,12 +267,12 @@ public: httpref->UnregisterPage(&jsonrpcinterface); } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { if (httpref) httpref->UnregisterPage(&jsonrpcinterface); - this->httpref = ServiceReference("HTTPProvider", conf->GetModule(this)->Get("server", "httpd/main")); + this->httpref = ServiceReference("HTTPProvider", conf.GetModule(this).Get("server", "httpd/main")); if (!httpref) throw ConfigException("Unable to find http reference, is httpd loaded?"); diff --git a/modules/sasl.cpp b/modules/sasl.cpp index 63b90fc8c..795a76bf3 100644 --- a/modules/sasl.cpp +++ b/modules/sasl.cpp @@ -250,7 +250,7 @@ public: Anope::string GetAgent() override { - Anope::string agent = Config->GetModule(Service::owner)->Get("agent", "NickServ"); + Anope::string agent = Config->GetModule(Service::owner).Get("agent", "NickServ"); BotInfo *bi = Config->GetClient(agent); if (bi) agent = bi->GetUID(); @@ -326,7 +326,7 @@ public: return; } - const auto badpasslimit = Config->GetBlock("options")->Get("badpasslimit"); + const auto badpasslimit = Config->GetBlock("options").Get("badpasslimit"); if (!badpasslimit) return; @@ -335,7 +335,7 @@ public: it = badpasswords.emplace(session->uid, std::make_pair(0, 0)).first; auto &[invalid_pw_time, invalid_pw_count] = it->second; - const auto badpasstimeout = Config->GetBlock("options")->Get("badpasstimeout"); + const auto badpasstimeout = Config->GetBlock("options").Get("badpasstimeout"); if (badpasstimeout > 0 && invalid_pw_time > 0 && invalid_pw_time < Anope::CurTime - badpasstimeout) invalid_pw_count = 0; @@ -360,7 +360,7 @@ public: void Tick() override { - const auto badpasstimeout = Config->GetBlock("options")->Get("badpasstimeout"); + const auto badpasstimeout = Config->GetBlock("options").Get("badpasstimeout"); for (auto it = badpasswords.begin(); it != badpasswords.end(); ) { if (it->second.first + badpasstimeout < Anope::CurTime) diff --git a/modules/sql_authentication.cpp b/modules/sql_authentication.cpp index a7044119a..a524a43fc 100644 --- a/modules/sql_authentication.cpp +++ b/modules/sql_authentication.cpp @@ -90,13 +90,13 @@ public: } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - Configuration::Block *config = conf->GetModule(this); - this->engine = config->Get("engine"); - this->query = config->Get("query"); - this->disable_reason = config->Get("disable_reason"); - this->disable_email_reason = config->Get("disable_email_reason"); + Configuration::Block &config = conf.GetModule(this); + this->engine = config.Get("engine"); + this->query = config.Get("query"); + this->disable_reason = config.Get("disable_reason"); + this->disable_email_reason = config.Get("disable_email_reason"); this->SQL = ServiceReference("SQL::Provider", this->engine); } diff --git a/modules/sql_log.cpp b/modules/sql_log.cpp index 63200c2e4..ad23dfb19 100644 --- a/modules/sql_log.cpp +++ b/modules/sql_log.cpp @@ -20,10 +20,10 @@ public: { } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - Configuration::Block *config = conf->GetModule(this); - this->table = config->Get("table", "logs"); + Configuration::Block &config = conf.GetModule(this); + this->table = config.Get("table", "logs"); } void OnLogMessage(LogInfo *li, const Log *l, const Anope::string &msg) override diff --git a/modules/sql_oper.cpp b/modules/sql_oper.cpp index 0cdd82436..cc4c0658d 100644 --- a/modules/sql_oper.cpp +++ b/modules/sql_oper.cpp @@ -150,12 +150,12 @@ public: } } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - Configuration::Block *config = conf->GetModule(this); + Configuration::Block &config = conf.GetModule(this); - this->engine = config->Get("engine"); - this->query = config->Get("query"); + this->engine = config.Get("engine"); + this->query = config.Get("query"); this->SQL = ServiceReference("SQL::Provider", this->engine); } diff --git a/modules/webcpanel/pages/register.cpp b/modules/webcpanel/pages/register.cpp index 6873dcc43..74ac89a2f 100644 --- a/modules/webcpanel/pages/register.cpp +++ b/modules/webcpanel/pages/register.cpp @@ -13,7 +13,7 @@ bool WebCPanel::Register::OnRequest(HTTPProvider *server, const Anope::string &p replacements["TITLE"] = page_title; - if (Config->GetModule("nickserv")->Get("forceemail", "yes")) + if (Config->GetModule("nickserv").Get("forceemail", "yes")) replacements["FORCE_EMAIL"] = "yes"; TemplateFileServer page("register.html"); diff --git a/modules/webcpanel/webcpanel.cpp b/modules/webcpanel/webcpanel.cpp index abeaa82b0..182e7077f 100644 --- a/modules/webcpanel/webcpanel.cpp +++ b/modules/webcpanel/webcpanel.cpp @@ -58,10 +58,10 @@ public: me = this; - Configuration::Block *block = Config->GetModule(this); - provider_name = block->Get("server", "httpd/main"); - template_base = Anope::ExpandData(block->Get("template_dir", "webcpanel/templates/default")); - page_title = block->Get("title", "Anope IRC Services"); + Configuration::Block &block = Config->GetModule(this); + provider_name = block.Get("server", "httpd/main"); + template_base = Anope::ExpandData(block.Get("template_dir", "webcpanel/templates/default")); + page_title = block.Get("title", "Anope IRC Services"); provider = ServiceReference("HTTPProvider", provider_name); if (!provider) diff --git a/src/command.cpp b/src/command.cpp index d5bbca2dd..080e6471d 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -222,7 +222,7 @@ namespace void HandleUnknownCommand(CommandSource& source, const Anope::string &message) { // Try to find a similar command. - size_t distance = Config->GetBlock("options")->Get("didyoumeandifference", "4"); + size_t distance = Config->GetBlock("options").Get("didyoumeandifference", "4"); Anope::string similar; auto umessage = message.upper(); for (const auto &[command, info] : source.service->commands) diff --git a/src/config.cpp b/src/config.cpp index 47ce6feaa..33d7a8de8 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -43,14 +43,14 @@ int Block::CountBlock(const Anope::string &bname) const return blocks.count(bname); } -const Block *Block::GetBlock(const Anope::string &bname, int num) const +const Block &Block::GetBlock(const Anope::string &bname, int num) const { std::pair it = blocks.equal_range(bname); for (int i = 0; it.first != it.second; ++it.first, ++i) if (i == num) - return &it.first->second; - return &EmptyBlock; + return it.first->second; + return EmptyBlock; } Block *Block::GetMutableBlock(const Anope::string &bname, int num) @@ -127,16 +127,16 @@ Conf::Conf() : Block("") for (int i = 0; i < this->CountBlock("include"); ++i) { - const Block *include = this->GetBlock("include", i); + const Block &include = this->GetBlock("include", i); - const Anope::string &type = include->Get("type"), - &file = include->Get("name"); + const Anope::string &type = include.Get("type"), + &file = include.Get("name"); File f(file, type == "executable"); this->LoadConf(f); } - FOREACH_MOD(OnReload, (this)); + FOREACH_MOD(OnReload, (*this)); /* Check for modified values that aren't allowed to be modified */ if (Config) @@ -159,58 +159,58 @@ Conf::Conf() : Block("") for (const auto &tag : noreload) { - if (this->GetBlock(tag.block)->Get(tag.name) != Config->GetBlock(tag.block)->Get(tag.name)) + if (this->GetBlock(tag.block).Get(tag.name) != Config->GetBlock(tag.block).Get(tag.name)) throw ConfigException("<" + tag.block + ":" + tag.name + "> can not be modified once set"); } } - const Block *serverinfo = this->GetBlock("serverinfo"), *options = this->GetBlock("options"), - *mail = this->GetBlock("mail"), *networkinfo = this->GetBlock("networkinfo"); + const Block &serverinfo = this->GetBlock("serverinfo"), &options = this->GetBlock("options"), + &mail = this->GetBlock("mail"), &networkinfo = this->GetBlock("networkinfo"); - const Anope::string &servername = serverinfo->Get("name"); + const Anope::string &servername = serverinfo.Get("name"); ValidateNotEmptyOrSpaces("serverinfo", "name", servername); if (servername.find(' ') != Anope::string::npos || servername.find('.') == Anope::string::npos) throw ConfigException("serverinfo:name is not a valid server name"); - ValidateNotEmpty("serverinfo", "description", serverinfo->Get("description")); - ValidateNotEmpty("serverinfo", "pid", serverinfo->Get("pid")); - ValidateNotEmpty("serverinfo", "motd", serverinfo->Get("motd")); + ValidateNotEmpty("serverinfo", "description", serverinfo.Get("description")); + ValidateNotEmpty("serverinfo", "pid", serverinfo.Get("pid")); + ValidateNotEmpty("serverinfo", "motd", serverinfo.Get("motd")); - ValidateNotZero("options", "readtimeout", options->Get("readtimeout")); + ValidateNotZero("options", "readtimeout", options.Get("readtimeout")); - ValidateNotZero("networkinfo", "nicklen", networkinfo->Get("nicklen", "1")); - ValidateNotZero("networkinfo", "userlen", networkinfo->Get("userlen", "1")); - ValidateNotZero("networkinfo", "hostlen", networkinfo->Get("hostlen", "1")); - ValidateNotZero("networkinfo", "chanlen", networkinfo->Get("chanlen", "1")); + ValidateNotZero("networkinfo", "nicklen", networkinfo.Get("nicklen", "1")); + ValidateNotZero("networkinfo", "userlen", networkinfo.Get("userlen", "1")); + ValidateNotZero("networkinfo", "hostlen", networkinfo.Get("hostlen", "1")); + ValidateNotZero("networkinfo", "chanlen", networkinfo.Get("chanlen", "1")); - spacesepstream(options->Get("ulineservers")).GetTokens(this->Ulines); + spacesepstream(options.Get("ulineservers")).GetTokens(this->Ulines); - if (mail->Get("usemail")) + if (mail.Get("usemail")) { Anope::string check[] = { "sendfrom", "registration_subject", "registration_message", "emailchange_subject", "emailchange_message", "memo_subject", "memo_message" }; for (const auto &field : check) - ValidateNotEmpty("mail", field, mail->Get(field)); + ValidateNotEmpty("mail", field, mail.Get(field)); } - this->ReadTimeout = options->Get("readtimeout"); - this->ServiceAlias = options->Get("servicealias"); + this->ReadTimeout = options.Get("readtimeout"); + this->ServiceAlias = options.Get("servicealias"); { std::vector defaults; - spacesepstream(this->GetModule("nickserv")->Get("defaults")).GetTokens(defaults); + spacesepstream(this->GetModule("nickserv").Get("defaults")).GetTokens(defaults); this->DefPrivmsg = std::find(defaults.begin(), defaults.end(), "msg") != defaults.end(); } - this->DefLanguage = options->Get("defaultlanguage"); - this->TimeoutCheck = options->Get("timeoutcheck"); - this->NickChars = networkinfo->Get("nick_chars"); + this->DefLanguage = options.Get("defaultlanguage"); + this->TimeoutCheck = options.Get("timeoutcheck"); + this->NickChars = networkinfo.Get("nick_chars"); for (int i = 0; i < this->CountBlock("uplink"); ++i) { - const Block *uplink = this->GetBlock("uplink", i); + const Block &uplink = this->GetBlock("uplink", i); int protocol; - const Anope::string &protocolstr = uplink->Get("protocol", "ipv4"); + const Anope::string &protocolstr = uplink.Get("protocol", "ipv4"); if (protocolstr == "ipv4") protocol = AF_INET; else if (protocolstr == "ipv6") @@ -220,17 +220,17 @@ Conf::Conf() : Block("") else throw ConfigException("uplink:protocol must be set to ipv4, ipv6, or unix"); - const Anope::string &host = uplink->Get("host"); + const Anope::string &host = uplink.Get("host"); ValidateNotEmptyOrSpaces("uplink", "host", host); int port = 0; if (protocol != AF_UNIX) { - port = uplink->Get("port"); + port = uplink.Get("port"); ValidateNotZero("uplink", "port", port); } - const Anope::string &password = uplink->Get("password"); + const Anope::string &password = uplink.Get("password"); ValidateNotEmptyOrSpaces("uplink", "password", password); if (password[0] == ':') throw ConfigException("uplink:password is not valid"); @@ -240,9 +240,9 @@ Conf::Conf() : Block("") for (int i = 0; i < this->CountBlock("module"); ++i) { - const Block *module = this->GetBlock("module", i); + const Block &module = this->GetBlock("module", i); - const Anope::string &modname = module->Get("name"); + const Anope::string &modname = module.Get("name"); ValidateNotEmptyOrSpaces("module", "name", modname); @@ -251,13 +251,13 @@ Conf::Conf() : Block("") for (int i = 0; i < this->CountBlock("opertype"); ++i) { - const Block *opertype = this->GetBlock("opertype", i); + const Block &opertype = this->GetBlock("opertype", i); - const Anope::string &oname = opertype->Get("name"), - &modes = opertype->Get("modes"), - &inherits = opertype->Get("inherits"), - &commands = opertype->Get("commands"), - &privs = opertype->Get("privs"); + const Anope::string &oname = opertype.Get("name"), + &modes = opertype.Get("modes"), + &inherits = opertype.Get("inherits"), + &commands = opertype.Get("commands"), + &privs = opertype.Get("privs"); ValidateNotEmpty("opertype", "name", oname); @@ -294,15 +294,15 @@ Conf::Conf() : Block("") for (int i = 0; i < this->CountBlock("oper"); ++i) { - const Block *oper = this->GetBlock("oper", i); + const Block &oper = this->GetBlock("oper", i); - const Anope::string &nname = oper->Get("name"), - &type = oper->Get("type"), - &password = oper->Get("password"), - &certfp = oper->Get("certfp"), - &host = oper->Get("host"), - &vhost = oper->Get("vhost"); - bool require_oper = oper->Get("require_oper"); + const Anope::string &nname = oper.Get("name"), + &type = oper.Get("type"), + &password = oper.Get("password"), + &certfp = oper.Get("certfp"), + &host = oper.Get("host"), + &vhost = oper.Get("vhost"); + bool require_oper = oper.Get("require_oper"); ValidateNotEmptyOrSpaces("oper", "name", nname); ValidateNotEmpty("oper", "type", type); @@ -330,15 +330,15 @@ Conf::Conf() : Block("") bi->conf = false; for (int i = 0; i < this->CountBlock("service"); ++i) { - const Block *service = this->GetBlock("service", i); + const Block &service = this->GetBlock("service", i); - const Anope::string &nick = service->Get("nick"), - &user = service->Get("user"), - &host = service->Get("host"), - &gecos = service->Get("gecos"), - &modes = service->Get("modes"), - &channels = service->Get("channels"), - &alias = service->Get("alias", nick.upper()); + const Anope::string &nick = service.Get("nick"), + &user = service.Get("user"), + &host = service.Get("host"), + &gecos = service.Get("gecos"), + &modes = service.Get("modes"), + &channels = service.Get("channels"), + &alias = service.Get("alias", nick.upper()); ValidateNotEmptyOrSpaces("service", "nick", nick); ValidateNotEmptyOrSpaces("service", "user", user); @@ -396,7 +396,6 @@ Conf::Conf() : Block("") { size_t ch = oldchannel.find('#'); Anope::string chname = oldchannel.substr(ch != Anope::string::npos ? ch : 0); - bool found = false; for (const auto &botchannel : bi->botchannels) { @@ -421,24 +420,24 @@ Conf::Conf() : Block("") for (int i = 0; i < this->CountBlock("log"); ++i) { - const Block *log = this->GetBlock("log", i); + const Block &log = this->GetBlock("log", i); - int logage = log->Get("logage"); - bool rawio = log->Get("rawio"); - bool debug = log->Get("debug"); + int logage = log.Get("logage"); + bool rawio = log.Get("rawio"); + bool debug = log.Get("debug"); LogInfo l(logage, rawio, debug); - l.bot = BotInfo::Find(log->Get("bot", "Global"), true); - spacesepstream(log->Get("target")).GetTokens(l.targets); - spacesepstream(log->Get("source")).GetTokens(l.sources); - spacesepstream(log->Get("admin")).GetTokens(l.admin); - spacesepstream(log->Get("override")).GetTokens(l.override); - spacesepstream(log->Get("commands")).GetTokens(l.commands); - spacesepstream(log->Get("servers")).GetTokens(l.servers); - spacesepstream(log->Get("channels")).GetTokens(l.channels); - spacesepstream(log->Get("users")).GetTokens(l.users); - spacesepstream(log->Get("other")).GetTokens(l.normal); + l.bot = BotInfo::Find(log.Get("bot", "Global"), true); + spacesepstream(log.Get("target")).GetTokens(l.targets); + spacesepstream(log.Get("source")).GetTokens(l.sources); + spacesepstream(log.Get("admin")).GetTokens(l.admin); + spacesepstream(log.Get("override")).GetTokens(l.override); + spacesepstream(log.Get("commands")).GetTokens(l.commands); + spacesepstream(log.Get("servers")).GetTokens(l.servers); + spacesepstream(log.Get("channels")).GetTokens(l.channels); + spacesepstream(log.Get("users")).GetTokens(l.users); + spacesepstream(log.Get("other")).GetTokens(l.normal); this->LogInfos.push_back(l); } @@ -447,14 +446,14 @@ Conf::Conf() : Block("") bi->commands.clear(); for (int i = 0; i < this->CountBlock("command"); ++i) { - const Block *command = this->GetBlock("command", i); + const Block &command = this->GetBlock("command", i); - const Anope::string &service = command->Get("service"), - &nname = command->Get("name"), - &cmd = command->Get("command"), - &permission = command->Get("permission"), - &group = command->Get("group"); - bool hide = command->Get("hide"); + const Anope::string &service = command.Get("service"), + &nname = command.Get("name"), + &cmd = command.Get("command"), + &permission = command.Get("permission"), + &group = command.Get("group"); + bool hide = command.Get("hide"); ValidateNotEmptyOrSpaces("command", "service", service); ValidateNotEmpty("command", "name", nname); @@ -472,25 +471,25 @@ Conf::Conf() : Block("") PrivilegeManager::ClearPrivileges(); for (int i = 0; i < this->CountBlock("privilege"); ++i) { - const Block *privilege = this->GetBlock("privilege", i); + const Block &privilege = this->GetBlock("privilege", i); - const Anope::string &nname = privilege->Get("name"), - &desc = privilege->Get("desc"); - int rank = privilege->Get("rank"); + const Anope::string &nname = privilege.Get("name"), + &desc = privilege.Get("desc"); + int rank = privilege.Get("rank"); PrivilegeManager::AddPrivilege(Privilege(nname, desc, rank)); } for (int i = 0; i < this->CountBlock("fantasy"); ++i) { - const Block *fantasy = this->GetBlock("fantasy", i); + const Block &fantasy = this->GetBlock("fantasy", i); - const Anope::string &nname = fantasy->Get("name"), - &service = fantasy->Get("command"), - &permission = fantasy->Get("permission"), - &group = fantasy->Get("group"); - bool hide = fantasy->Get("hide"), - prepend_channel = fantasy->Get("prepend_channel", "yes"); + const Anope::string &nname = fantasy.Get("name"), + &service = fantasy.Get("command"), + &permission = fantasy.Get("permission"), + &group = fantasy.Get("group"); + bool hide = fantasy.Get("hide"), + prepend_channel = fantasy.Get("prepend_channel", "yes"); ValidateNotEmpty("fantasy", "name", nname); ValidateNotEmptyOrSpaces("fantasy", "command", service); @@ -505,10 +504,10 @@ Conf::Conf() : Block("") for (int i = 0; i < this->CountBlock("command_group"); ++i) { - const Block *command_group = this->GetBlock("command_group", i); + const Block &command_group = this->GetBlock("command_group", i); - const Anope::string &nname = command_group->Get("name"), - &description = command_group->Get("description"); + const Anope::string &nname = command_group.Get("name"), + &description = command_group.Get("description"); CommandGroup gr; gr.name = nname; @@ -544,19 +543,19 @@ Conf::Conf() : Block("") Log() << "Tied oper " << na->nc->display << " to type " << o->ot->GetName(); } - if (options->Get("casemap", "ascii") == "ascii") + if (options.Get("casemap", "ascii") == "ascii") Anope::casemap = std::locale(std::locale(), new Anope::ascii_ctype()); - else if (options->Get("casemap") == "rfc1459") + else if (options.Get("casemap") == "rfc1459") Anope::casemap = std::locale(std::locale(), new Anope::rfc1459_ctype()); else { try { - Anope::casemap = std::locale(options->Get("casemap").c_str()); + Anope::casemap = std::locale(options.Get("casemap").c_str()); } catch (const std::runtime_error &) { - Log() << "Unknown casemap " << options->Get("casemap") << " - casemap not changed"; + Log() << "Unknown casemap " << options.Get("casemap") << " - casemap not changed"; } } Anope::CaseMapRebuild(); @@ -620,30 +619,30 @@ void Conf::Post(Conf *old) } } -Block *Conf::GetModule(const Module *m) +Block &Conf::GetModule(const Module *m) { if (!m) - return &Block::EmptyBlock; + return Block::EmptyBlock; return GetModule(m->name); } -Block *Conf::GetModule(const Anope::string &mname) +Block &Conf::GetModule(const Anope::string &mname) { std::map::iterator it = modules.find(mname); if (it != modules.end()) - return it->second; + return *it->second; Block *&block = modules[mname]; /* Search for the block */ for (std::pair iters = blocks.equal_range("module"); iters.first != iters.second; ++iters.first) { - Block *b = &iters.first->second; + Block &b = iters.first->second; - if (b->Get("name") == mname) + if (b.Get("name") == mname) { - block = b; + block = &b; break; } } @@ -660,25 +659,25 @@ BotInfo *Conf::GetClient(const Anope::string &cname) if (it != bots.end()) return BotInfo::Find(!it->second.empty() ? it->second : cname, true); - Block *block = GetModule(cname.lower()); - const Anope::string &client = block->Get("client"); + Block &block = GetModule(cname.lower()); + const Anope::string &client = block.Get("client"); bots[cname] = client; return GetClient(cname); } -const Block *Conf::GetCommand(CommandSource &source) +const Block &Conf::GetCommand(CommandSource &source) { const Anope::string &block_name = source.c ? "fantasy" : "command"; for (std::pair iters = blocks.equal_range(block_name); iters.first != iters.second; ++iters.first) { - Block *b = &iters.first->second; + Block &b = iters.first->second; - if (b->Get("name") == source.command) + if (b.Get("name") == source.command) return b; } - return &Block::EmptyBlock; + return Block::EmptyBlock; } File::File(const Anope::string &n, bool e) : name(n), executable(e) @@ -929,12 +928,12 @@ void Conf::LoadConf(File &file) /* Check defines */ for (int i = 0; i < this->CountBlock("define"); ++i) { - const Block *define = this->GetBlock("define", i); + const Block &define = this->GetBlock("define", i); - const Anope::string &dname = define->Get("name"); + const Anope::string &dname = define.Get("name"); - if (dname == wordbuffer && define != b) - wordbuffer = define->Get("value"); + if (dname == wordbuffer && &define != b) + wordbuffer = define.Get("value"); } if (b) diff --git a/src/init.cpp b/src/init.cpp index 0508ab94f..4befb9ea1 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -215,7 +215,7 @@ static void InitSignals() static void remove_pidfile() { - auto pidfile = Anope::ExpandData(Config->GetBlock("serverinfo")->Get("pid")); + auto pidfile = Anope::ExpandData(Config->GetBlock("serverinfo").Get("pid")); if (!pidfile.empty()) remove(pidfile.c_str()); } @@ -224,7 +224,7 @@ static void remove_pidfile() static void write_pidfile() { - auto pidfile = Anope::ExpandData(Config->GetBlock("serverinfo")->Get("pid")); + auto pidfile = Anope::ExpandData(Config->GetBlock("serverinfo").Get("pid")); if (Anope::NoPID || pidfile.empty()) return; @@ -242,25 +242,25 @@ static void write_pidfile() static void setuidgid() { #ifndef _WIN32 - Configuration::Block *options = Config->GetBlock("options"); + Configuration::Block &options = Config->GetBlock("options"); uid_t uid = -1; gid_t gid = -1; - if (!options->Get("user").empty()) + if (!options.Get("user").empty()) { errno = 0; - struct passwd *u = getpwnam(options->Get("user").c_str()); + struct passwd *u = getpwnam(options.Get("user").c_str()); if (u == NULL) - Log() << "Unable to setuid to " << options->Get("user") << ": " << Anope::LastError(); + Log() << "Unable to setuid to " << options.Get("user") << ": " << Anope::LastError(); else uid = u->pw_uid; } - if (!options->Get("group").empty()) + if (!options.Get("group").empty()) { errno = 0; - struct group *g = getgrnam(options->Get("group").c_str()); + struct group *g = getgrnam(options.Get("group").c_str()); if (g == NULL) - Log() << "Unable to setgid to " << options->Get("group") << ": " << Anope::LastError(); + Log() << "Unable to setgid to " << options.Get("group") << ": " << Anope::LastError(); else gid = g->gr_gid; } @@ -278,16 +278,16 @@ static void setuidgid() if (static_cast(gid) != -1) { if (setgid(gid) == -1) - Log() << "Unable to setgid to " << options->Get("group") << ": " << Anope::LastError(); + Log() << "Unable to setgid to " << options.Get("group") << ": " << Anope::LastError(); else - Log() << "Successfully set group to " << options->Get("group"); + Log() << "Successfully set group to " << options.Get("group"); } if (static_cast(uid) != -1) { if (setuid(uid) == -1) - Log() << "Unable to setuid to " << options->Get("user") << ": " << Anope::LastError(); + Log() << "Unable to setuid to " << options.Get("user") << ": " << Anope::LastError(); else - Log() << "Successfully set user to " << options->Get("user"); + Log() << "Successfully set user to " << options.Get("user"); } #endif } @@ -493,8 +493,8 @@ bool Anope::Init(int ac, char **av) } /* Create me */ - Configuration::Block *block = Config->GetBlock("serverinfo"); - Me = new Server(NULL, block->Get("name"), 0, block->Get("description"), block->Get("id")); + Configuration::Block &block = Config->GetBlock("serverinfo"); + Me = new Server(NULL, block.Get("name"), 0, block.Get("description"), block.Get("id")); for (const auto &[_, bi] : *BotListByNick) { bi->server = Me; @@ -512,15 +512,15 @@ bool Anope::Init(int ac, char **av) /* load modules */ Log() << "Loading modules..."; for (int i = 0; i < Config->CountBlock("module"); ++i) - ModuleManager::LoadModule(Config->GetBlock("module", i)->Get("name"), NULL); + ModuleManager::LoadModule(Config->GetBlock("module", i).Get("name"), NULL); #ifndef _WIN32 /* If we're root, issue a warning now */ if (!getuid() && !getgid()) { /* If we are configured to setuid later, don't issue a warning */ - Configuration::Block *options = Config->GetBlock("options"); - if (options->Get("user").empty()) + Configuration::Block &options = Config->GetBlock("options"); + if (options.Get("user").empty()) { std::cerr << "WARNING: You are currently running Anope as the root superuser. Anope does not" << std::endl; std::cerr << " require root privileges to run, and it is discouraged that you run Anope" << std::endl; diff --git a/src/language.cpp b/src/language.cpp index 8d449d362..440461133 100644 --- a/src/language.cpp +++ b/src/language.cpp @@ -36,7 +36,7 @@ void Language::InitLanguages() setlocale(LC_ALL, ""); - spacesepstream sep(Config->GetBlock("options")->Get("languages")); + spacesepstream sep(Config->GetBlock("options").Get("languages")); Anope::string language; while (sep.GetToken(language)) { diff --git a/src/mail.cpp b/src/mail.cpp index f3adab44c..9fb7aedff 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -15,14 +15,14 @@ Mail::Message::Message(const Anope::string &sf, const Anope::string &mailto, const Anope::string &a, const Anope::string &s, const Anope::string &m) : Thread() - , sendmail_path(Config->GetBlock("mail")->Get("sendmailpath", "/usr/sbin/sendmail -it")) + , sendmail_path(Config->GetBlock("mail").Get("sendmailpath", "/usr/sbin/sendmail -it")) , send_from(sf) , mail_to(mailto) , addr(a) , subject(s) , message(m) - , content_type(Config->GetBlock("mail")->Get("content_type", "text/plain; charset=UTF-8")) - , dont_quote_addresses(Config->GetBlock("mail")->Get("dontquoteaddresses")) + , content_type(Config->GetBlock("mail").Get("content_type", "text/plain; charset=UTF-8")) + , dont_quote_addresses(Config->GetBlock("mail").Get("dontquoteaddresses")) { } @@ -72,32 +72,32 @@ bool Mail::Send(User *u, NickCore *nc, BotInfo *service, const Anope::string &su if (!nc || !service || subject.empty() || message.empty()) return false; - Configuration::Block *b = Config->GetBlock("mail"); + Configuration::Block &b = Config->GetBlock("mail"); if (!u) { - if (!b->Get("usemail") || b->Get("sendfrom").empty()) + if (!b.Get("usemail") || b.Get("sendfrom").empty()) return false; else if (nc->email.empty()) return false; nc->lastmail = Anope::CurTime; - Thread *t = new Mail::Message(b->Get("sendfrom"), nc->display, nc->email, subject, message); + Thread *t = new Mail::Message(b.Get("sendfrom"), nc->display, nc->email, subject, message); t->Start(); return true; } else { - if (!b->Get("usemail") || b->Get("sendfrom").empty()) + if (!b.Get("usemail") || b.Get("sendfrom").empty()) u->SendMessage(service, _("Services have been configured to not send mail.")); - else if (Anope::CurTime - u->lastmail < b->Get("delay")) - u->SendMessage(service, _("Please wait \002%lu\002 seconds and retry."), (unsigned long)b->Get("delay") - (Anope::CurTime - u->lastmail)); + else if (Anope::CurTime - u->lastmail < b.Get("delay")) + u->SendMessage(service, _("Please wait \002%lu\002 seconds and retry."), (unsigned long)b.Get("delay") - (Anope::CurTime - u->lastmail)); else if (nc->email.empty()) u->SendMessage(service, _("Email for \002%s\002 is invalid."), nc->display.c_str()); else { u->lastmail = nc->lastmail = Anope::CurTime; - Thread *t = new Mail::Message(b->Get("sendfrom"), nc->display, nc->email, subject, message); + Thread *t = new Mail::Message(b.Get("sendfrom"), nc->display, nc->email, subject, message); t->Start(); return true; } @@ -108,12 +108,12 @@ bool Mail::Send(User *u, NickCore *nc, BotInfo *service, const Anope::string &su bool Mail::Send(NickCore *nc, const Anope::string &subject, const Anope::string &message) { - Configuration::Block *b = Config->GetBlock("mail"); - if (!b->Get("usemail") || b->Get("sendfrom").empty() || !nc || nc->email.empty() || subject.empty() || message.empty()) + Configuration::Block &b = Config->GetBlock("mail"); + if (!b.Get("usemail") || b.Get("sendfrom").empty() || !nc || nc->email.empty() || subject.empty() || message.empty()) return false; nc->lastmail = Anope::CurTime; - Thread *t = new Mail::Message(b->Get("sendfrom"), nc->display, nc->email, subject, message); + Thread *t = new Mail::Message(b.Get("sendfrom"), nc->display, nc->email, subject, message); t->Start(); return true; diff --git a/src/main.cpp b/src/main.cpp index f53b0ba0f..32329043e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -167,8 +167,8 @@ int main(int ac, char **av, char **envp) /* Set up timers */ time_t last_check = Anope::CurTime; - UpdateTimer updateTimer(Config->GetBlock("options")->Get("updatetimeout", "2m")); - ExpireTimer expireTimer(Config->GetBlock("options")->Get("expiretimeout", "30m")); + UpdateTimer updateTimer(Config->GetBlock("options").Get("updatetimeout", "2m")); + ExpireTimer expireTimer(Config->GetBlock("options").Get("expiretimeout", "30m")); /*** Main loop. ***/ while (!Anope::Quitting) diff --git a/src/messages.cpp b/src/messages.cpp index ddc6ec380..391b3d330 100644 --- a/src/messages.cpp +++ b/src/messages.cpp @@ -237,7 +237,7 @@ void MOTD::Run(MessageSource &source, const std::vector ¶ms, if (s != Me) return; - auto motdfile = Anope::ExpandConfig(Config->GetBlock("serverinfo")->Get("motd")); + auto motdfile = Anope::ExpandConfig(Config->GetBlock("serverinfo").Get("motd")); std::ifstream stream(motdfile.str()); if (!stream.is_open()) { @@ -405,7 +405,7 @@ void Stats::Run(MessageSource &source, const std::vector ¶ms, case 'o': case 'O': /* Check whether the user is an operator */ - if (!u->HasMode("OPER") && Config->GetBlock("options")->Get("hidestatso")) + if (!u->HasMode("OPER") && Config->GetBlock("options").Get("hidestatso")) IRCD->SendNumeric(RPL_STATSLINKINFO, source.GetSource(), params[0][0], "End of /STATS report."); else { @@ -473,7 +473,7 @@ void Whois::Run(MessageSource &source, const std::vector ¶ms, IRCD->SendNumeric(RPL_WHOISUSER, source.GetSource(), u->nick, u->GetIdent(), u->host, '*', u->realname); if (bi) IRCD->SendNumeric(RPL_WHOISREGNICK, source.GetSource(), bi->nick, "is a registered nick"); - IRCD->SendNumeric(RPL_WHOISSERVER, source.GetSource(), u->nick, Me->GetName(), Config->GetBlock("serverinfo")->Get("description")); + IRCD->SendNumeric(RPL_WHOISSERVER, source.GetSource(), u->nick, Me->GetName(), Config->GetBlock("serverinfo").Get("description")); if (bi) IRCD->SendNumeric(RPL_WHOISIDLE, source.GetSource(), bi->nick, Anope::CurTime - bi->lastmsg, bi->signon, "seconds idle, signon time"); IRCD->SendNumeric(RPL_WHOISOPERATOR, source.GetSource(), u->nick, "is a Network Service"); diff --git a/src/misc.cpp b/src/misc.cpp index 2c1950ba6..6f0d95833 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -391,7 +391,7 @@ bool Anope::Match(const Anope::string &str, const Anope::string &mask, bool case if (r == NULL || r->GetExpression() != stripped_mask) { - ServiceReference provider("Regex", Config->GetBlock("options")->Get("regexengine")); + ServiceReference provider("Regex", Config->GetBlock("options").Get("regexengine")); if (provider) { try diff --git a/src/modulemanager.cpp b/src/modulemanager.cpp index 07dea3228..11a00e363 100644 --- a/src/modulemanager.cpp +++ b/src/modulemanager.cpp @@ -242,7 +242,7 @@ ModuleReturn ModuleManager::LoadModule(const Anope::string &modname, User *u) /* Initialize config */ try { - m->OnReload(Config); + m->OnReload(*Config); } catch (const ModuleException &ex) { diff --git a/src/protocol.cpp b/src/protocol.cpp index c66f87653..a45985a0d 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -25,10 +25,10 @@ IRCDProto *IRCD = NULL; IRCDProto::IRCDProto(Module *creator, const Anope::string &p) : Service(creator, "IRCDProto", creator->name) , proto_name(p) - , MaxChannel(Config->GetBlock("networkinfo")->Get("chanlen", "32")) - , MaxHost(Config->GetBlock("networkinfo")->Get("hostlen", "64")) - , MaxNick(Config->GetBlock("networkinfo")->Get("nicklen", "31")) - , MaxUser(Config->GetBlock("networkinfo")->Get("userlen", "10")) + , MaxChannel(Config->GetBlock("networkinfo").Get("chanlen", "32")) + , MaxHost(Config->GetBlock("networkinfo").Get("hostlen", "64")) + , MaxNick(Config->GetBlock("networkinfo").Get("nicklen", "31")) + , MaxUser(Config->GetBlock("networkinfo").Get("userlen", "10")) { if (IRCD == NULL) IRCD = this; @@ -76,7 +76,7 @@ Anope::string IRCDProto::SID_Retrieve() if (!IRCD || !IRCD->RequiresID) return ""; - static Anope::string current_sid = Config->GetBlock("serverinfo")->Get("id"); + static Anope::string current_sid = Config->GetBlock("serverinfo").Get("id"); if (current_sid.empty()) current_sid = "00A"; @@ -289,8 +289,8 @@ bool IRCDProto::IsHostValid(const Anope::string &host) if (host.empty() || host.length() > IRCD->MaxHost) return false; - const Anope::string &vhostdisablebe = Config->GetBlock("networkinfo")->Get("disallow_start_or_end"), - vhostchars = Config->GetBlock("networkinfo")->Get("vhost_chars"); + const Anope::string &vhostdisablebe = Config->GetBlock("networkinfo").Get("disallow_start_or_end"), + vhostchars = Config->GetBlock("networkinfo").Get("vhost_chars"); if (vhostdisablebe.find_first_of(host[0]) != Anope::string::npos) return false; @@ -306,7 +306,7 @@ bool IRCDProto::IsHostValid(const Anope::string &host) return false; } - return dots > 0 || Config->GetBlock("networkinfo")->Get("allow_undotted_vhosts"); + return dots > 0 || Config->GetBlock("networkinfo").Get("allow_undotted_vhosts"); } void IRCDProto::SendOper(User *u) @@ -317,7 +317,7 @@ void IRCDProto::SendOper(User *u) size_t IRCDProto::GetMaxListFor(Channel *c, ChannelMode *cm) { - return c->HasMode("LBAN") ? 0 : Config->GetBlock("networkinfo")->Get("modelistsize", "100"); + return c->HasMode("LBAN") ? 0 : Config->GetBlock("networkinfo").Get("modelistsize", "100"); } Anope::string IRCDProto::NormalizeMask(const Anope::string &mask) diff --git a/src/uplink.cpp b/src/uplink.cpp index c032d6118..100217291 100644 --- a/src/uplink.cpp +++ b/src/uplink.cpp @@ -53,8 +53,8 @@ void Uplink::Connect() Configuration::Uplink &u = Config->Uplinks[Anope::CurrentUplink]; new UplinkSocket(); - if (!Config->GetBlock("serverinfo")->Get("localhost").empty()) - UplinkSock->Bind(Config->GetBlock("serverinfo")->Get("localhost")); + if (!Config->GetBlock("serverinfo").Get("localhost").empty()) + UplinkSock->Bind(Config->GetBlock("serverinfo").Get("localhost")); FOREACH_MOD(OnPreServerConnect, ()); Anope::string ip = Anope::Resolve(u.host, u.protocol); Log(LOG_TERMINAL) << "Attempting to connect to uplink #" << (Anope::CurrentUplink + 1) << " " << u.host << " (" << ip << '/' << u.port << ") with protocol " << IRCD->GetProtocolName(); @@ -164,7 +164,7 @@ UplinkSocket::~UplinkSocket() } else if (!Anope::Quitting) { - time_t retry = Config->GetBlock("options")->Get("retrywait"); + time_t retry = Config->GetBlock("options").Get("retrywait"); Log() << "Disconnected, retrying in " << retry << " seconds"; new ReconnectTimer(retry); diff --git a/src/users.cpp b/src/users.cpp index f6a4adb37..8f8e9570d 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -835,14 +835,14 @@ Anope::string User::Mask() const bool User::BadPassword() { - if (!Config->GetBlock("options")->Get("badpasslimit")) + if (!Config->GetBlock("options").Get("badpasslimit")) return false; - if (Config->GetBlock("options")->Get("badpasstimeout") > 0 && this->invalid_pw_time > 0 && this->invalid_pw_time < Anope::CurTime - Config->GetBlock("options")->Get("badpasstimeout")) + if (Config->GetBlock("options").Get("badpasstimeout") > 0 && this->invalid_pw_time > 0 && this->invalid_pw_time < Anope::CurTime - Config->GetBlock("options").Get("badpasstimeout")) this->invalid_pw_count = 0; ++this->invalid_pw_count; this->invalid_pw_time = Anope::CurTime; - if (this->invalid_pw_count >= Config->GetBlock("options")->Get("badpasslimit")) + if (this->invalid_pw_count >= Config->GetBlock("options").Get("badpasslimit")) { this->Kill(Me, "Too many invalid passwords"); return true; diff --git a/src/xline.cpp b/src/xline.cpp index cdfc2d7c4..9e8dd41bf 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -25,11 +25,11 @@ Serialize::Checker > XLineManage void XLine::Init() { - if (this->mask.length() >= 2 && this->mask[0] == '/' && this->mask[this->mask.length() - 1] == '/' && !Config->GetBlock("options")->Get("regexengine").empty()) + if (this->mask.length() >= 2 && this->mask[0] == '/' && this->mask[this->mask.length() - 1] == '/' && !Config->GetBlock("options").Get("regexengine").empty()) { Anope::string stripped_mask = this->mask.substr(1, this->mask.length() - 2); - ServiceReference provider("Regex", Config->GetBlock("options")->Get("regexengine")); + ServiceReference provider("Regex", Config->GetBlock("options").Get("regexengine")); if (provider) { try