diff options
| author | Sadie Powell <sadie@witchery.services> | 2025-03-02 14:51:02 +0000 |
|---|---|---|
| committer | Sadie Powell <sadie@witchery.services> | 2025-03-02 15:27:47 +0000 |
| commit | f9911dde529adf3dc03f4f14bbd70756ac2f665c (patch) | |
| tree | 7c720e4f82fdb30b7d8a22fc0809f50bc862fae3 /modules/chanserv | |
| parent | a5e5eb5eb084e8343260ce7bc26ea86798f64fe1 (diff) | |
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.
Diffstat (limited to 'modules/chanserv')
| -rw-r--r-- | modules/chanserv/chanserv.cpp | 32 | ||||
| -rw-r--r-- | modules/chanserv/cs_access.cpp | 20 | ||||
| -rw-r--r-- | modules/chanserv/cs_akick.cpp | 8 | ||||
| -rw-r--r-- | modules/chanserv/cs_ban.cpp | 12 | ||||
| -rw-r--r-- | modules/chanserv/cs_clone.cpp | 2 | ||||
| -rw-r--r-- | modules/chanserv/cs_entrymsg.cpp | 2 | ||||
| -rw-r--r-- | modules/chanserv/cs_fantasy_stats.cpp | 6 | ||||
| -rw-r--r-- | modules/chanserv/cs_fantasy_top.cpp | 6 | ||||
| -rw-r--r-- | modules/chanserv/cs_flags.cpp | 16 | ||||
| -rw-r--r-- | modules/chanserv/cs_kick.cpp | 4 | ||||
| -rw-r--r-- | modules/chanserv/cs_list.cpp | 6 | ||||
| -rw-r--r-- | modules/chanserv/cs_log.cpp | 14 | ||||
| -rw-r--r-- | modules/chanserv/cs_mode.cpp | 18 | ||||
| -rw-r--r-- | modules/chanserv/cs_register.cpp | 2 | ||||
| -rw-r--r-- | modules/chanserv/cs_seen.cpp | 6 | ||||
| -rw-r--r-- | modules/chanserv/cs_set.cpp | 18 | ||||
| -rw-r--r-- | modules/chanserv/cs_set_misc.cpp | 14 | ||||
| -rw-r--r-- | modules/chanserv/cs_suspend.cpp | 6 | ||||
| -rw-r--r-- | modules/chanserv/cs_xop.cpp | 24 |
19 files changed, 108 insertions, 108 deletions
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<Anope::string>("botmodes", - Config->GetModule("chanserv")->Get<Anope::string>("botmodes", "o") + return Config->GetModule("botserv").Get<Anope::string>("botmodes", + Config->GetModule("chanserv").Get<Anope::string>("botmodes", "o") ); } @@ -52,7 +52,7 @@ public: * @param chan The channel */ ChanServTimer(Reference<BotInfo> &cs, ExtensibleItem<bool> &i, Module *m, Channel *chan) - : Timer(m, Config->GetModule(m)->Get<time_t>("inhabit", "1m")) + : Timer(m, Config->GetModule(m).Get<time_t>("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<const Anope::string>("client"); + const Anope::string &channick = conf.GetModule(this).Get<const Anope::string>("client"); if (channick.empty()) throw ConfigException(Module::name + ": <client> must be defined"); @@ -116,7 +116,7 @@ public: ChanServ = bi; - spacesepstream(conf->GetModule(this)->Get<const Anope::string>("defaults", "keeptopic peace securefounder signkick")).GetTokens(defaults); + spacesepstream(conf.GetModule(this).Get<const Anope::string>("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<bool>("always_lower_ts"); + always_lower = conf.GetModule(this).Get<bool>("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<Anope::string> &tags) override { - if (bi == ChanServ && Config->GetModule(this)->Get<bool>("opersonly") && !u->HasMode("OPER")) + if (bi == ChanServ && Config->GetModule(this).Get<bool>("opersonly") && !u->HasMode("OPER")) { u->SendMessage(bi, ACCESS_DENIED); return EVENT_STOP; @@ -151,7 +151,7 @@ public: { std::deque<ChannelInfo *> chans; nc->GetChannelReferences(chans); - int max_reg = Config->GetModule(this)->Get<int>("maxregistered"); + int max_reg = Config->GetModule(this).Get<int>("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<const Anope::string>("require"); + const Anope::string &require = Config->GetModule(this).Get<const Anope::string>("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<time_t>("expire", "30d"); + time_t chanserv_expire = Config->GetModule(this).Get<time_t>("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<const Anope::string>("require"); + const Anope::string &require = Config->GetModule(this).Get<const Anope::string>("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<const Anope::string>("nomlock").find(cm->mchar) != Anope::string::npos - || Config->GetModule(this)->Get<const Anope::string>("require").find(cm->mchar) != Anope::string::npos) + if (Config->GetModule(this).Get<const Anope::string>("nomlock").find(cm->mchar) != Anope::string::npos + || Config->GetModule(this).Get<const Anope::string>("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<time_t>("expire", "30d"); + time_t chanserv_expire = Config->GetModule(this).Get<time_t>("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<time_t>("expire", "30d"); + time_t chanserv_expire = Config->GetModule(this).Get<time_t>("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<bool>("disallow_channel_access")) + if (Config->GetModule("chanserv").Get<bool>("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<bool>("disallow_hostmask_access")) + if (!na && Config->GetModule("chanserv").Get<bool>("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<unsigned>("accessmax", "1000"); + unsigned access_max = Config->GetModule("chanserv").Get<unsigned>("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<bool>("disallow_channel_access")) + if (!Config->GetModule("chanserv").Get<bool>("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<const Anope::string>("name"); + const Anope::string &pname = priv.Get<const Anope::string>("name"); Privilege *p = PrivilegeManager::FindPrivilege(pname); if (p == NULL) continue; - const Anope::string &value = priv->Get<const Anope::string>("level"); + const Anope::string &value = priv.Get<const Anope::string>("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<int16_t>("level"); + defaultLevels[p->name] = priv.Get<int16_t>("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<unsigned>("reasonmax", "200"); + unsigned reasonmax = Config->GetModule("chanserv").Get<unsigned>("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<unsigned>("autokickmax")) + if (ci->GetAkickCount() >= Config->GetModule(this->owner).Get<unsigned>("autokickmax")) { - source.Reply(_("Sorry, you can only have %d autokick masks on a channel."), Config->GetModule(this->owner)->Get<unsigned>("autokickmax")); + source.Reply(_("Sorry, you can only have %d autokick masks on a channel."), Config->GetModule(this->owner).Get<unsigned>("autokickmax")); return; } @@ -568,7 +568,7 @@ public: reason = autokick->reason; if (reason.empty()) { - reason = Language::Translate(u, Config->GetModule(this)->Get<const Anope::string>("autokickreason").c_str()); + reason = Language::Translate(u, Config->GetModule(this).Get<const Anope::string>("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<Anope::string> ¶ms) override { - Configuration::Block *block = Config->GetCommand(source); - const Anope::string &mode = block->Get<Anope::string>("mode", "BAN"); + Configuration::Block &block = Config->GetCommand(source); + const Anope::string &mode = block.Get<Anope::string>("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<unsigned>("reasonmax", "200"); + unsigned reasonmax = Config->GetModule("chanserv").Get<unsigned>("reasonmax", "200"); if (reason.length() > reasonmax) reason = reason.substr(0, reasonmax); - Anope::string signkickformat = Config->GetModule("chanserv")->Get<Anope::string>("signkickformat", "%m (%n)"); + Anope::string signkickformat = Config->GetModule("chanserv").Get<Anope::string>("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<bool>("kick", "yes")) + if (block.Get<bool>("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<bool>("kick", "yes")) + if (block.Get<bool>("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<Anope::string> masks; - unsigned access_max = Config->GetModule("chanserv")->Get<unsigned>("accessmax", "1000"); + unsigned access_max = Config->GetModule("chanserv").Get<unsigned>("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<EntryMessageList>("entrymsg"); - if ((*messages)->size() >= Config->GetModule(this->owner)->Get<unsigned>("maxentries")) + if ((*messages)->size() >= Config->GetModule(this->owner).Get<unsigned>("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<const Anope::string>("prefix", "anope_"); - this->sql = ServiceReference<SQL::Provider>("SQL::Provider", conf->GetModule("chanstats")->Get<const Anope::string>("engine")); + prefix = conf.GetModule("chanstats").Get<const Anope::string>("prefix", "anope_"); + this->sql = ServiceReference<SQL::Provider>("SQL::Provider", conf.GetModule("chanstats").Get<const Anope::string>("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<const Anope::string>("prefix", "anope_"); - this->sql = ServiceReference<SQL::Provider>("SQL::Provider", conf->GetModule("chanstats")->Get<const Anope::string>("engine")); + prefix = conf.GetModule("chanstats").Get<const Anope::string>("prefix", "anope_"); + this->sql = ServiceReference<SQL::Provider>("SQL::Provider", conf.GetModule("chanstats").Get<const Anope::string>("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<bool>("disallow_channel_access")) + if (Config->GetModule("chanserv").Get<bool>("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<bool>("disallow_hostmask_access")) + if (!na && Config->GetModule("chanserv").Get<bool>("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<unsigned>("accessmax", "1000"); + unsigned access_max = Config->GetModule("chanserv").Get<unsigned>("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<const Anope::string>("name"); + const Anope::string &pname = priv.Get<const Anope::string>("name"); Privilege *p = PrivilegeManager::FindPrivilege(pname); if (p == NULL) continue; - const Anope::string &value = priv->Get<const Anope::string>("flag"); + const Anope::string &value = priv.Get<const Anope::string>("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<unsigned>("reasonmax", "200"); + unsigned reasonmax = Config->GetModule("chanserv").Get<unsigned>("reasonmax", "200"); if (reason.length() > reasonmax) reason = reason.substr(0, reasonmax); - Anope::string signkickformat = Config->GetModule("chanserv")->Get<Anope::string>("signkickformat", "%m (%n)"); + Anope::string signkickformat = Config->GetModule("chanserv").Get<Anope::string>("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<unsigned>("listmax", "50"); + unsigned listmax = Config->GetModule(this->owner).Get<unsigned>("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<const Anope::string>("regexengine").empty()) + if (!Config->GetBlock("options").Get<const Anope::string>("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<const Anope::string>("regexengine").c_str()); + "Enclose your pattern in // if this is desired."), Config->GetBlock("options").Get<const Anope::string>("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<const Anope::string>("service"); - ld.command = def->Get<const Anope::string>("command"); - ld.method = def->Get<const Anope::string>("method"); + ld.service = def.Get<const Anope::string>("service"); + ld.command = def.Get<const Anope::string>("command"); + ld.method = def.Get<const Anope::string>("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<unsigned>("max", "50")) + if (modelocks->GetMLock().size() >= Config->GetModule(this->owner).Get<unsigned>("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<const Anope::string>("name"), - &cmd = block->Get<const Anope::string>("command"); + const Anope::string &cname = block.Get<const Anope::string>("name"), + &cmd = block.Get<const Anope::string>("command"); if (cname.empty() || cmd != "chanserv/modes") continue; - const Anope::string &set = block->Get<const Anope::string>("set"), - &unset = block->Get<const Anope::string>("unset"); + const Anope::string &set = block.Get<const Anope::string>("set"), + &unset = block.Get<const Anope::string>("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<const Anope::string>("mlock", "+nt")); + spacesepstream sep(Config->GetModule(this).Get<const Anope::string>("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<unsigned>("maxregistered"); + unsigned maxregistered = Config->GetModule("chanserv").Get<unsigned>("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<bool>("simple"); + simple = conf.GetModule(this).Get<bool>("simple"); } void OnExpireTick() override { size_t previous_size = database.size(); - time_t purgetime = Config->GetModule(this)->Get<time_t>("purgetime"); + time_t purgetime = Config->GetModule(this).Get<time_t>("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<bool>("hideprivilegedcommands"), - hide_registered_commands = Config->GetBlock("options")->Get<bool>("hideregisteredcommands"); + bool hide_privileged_commands = Config->GetBlock("options").Get<bool>("hideprivilegedcommands"), + hide_registered_commands = Config->GetBlock("options").Get<bool>("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<unsigned>("maxregistered"); + unsigned max_reg = Config->GetModule("chanserv").Get<unsigned>("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<Anope::string>("botmodes", - Config->GetModule("chanserv")->Get<Anope::string>("botmodes", "o") + return Config->GetModule("botserv").Get<Anope::string>("botmodes", + Config->GetModule("chanserv").Get<Anope::string>("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<unsigned>("maxregistered"); + unsigned max_reg = Config->GetModule("chanserv").Get<unsigned>("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<bool>("persist_lower_ts"); + persist_lower_ts = conf.GetModule(this).Get<bool>("persist_lower_ts"); } void OnCreateChan(ChannelInfo *ci) override { - ci->bantype = Config->GetModule(this)->Get<int>("defbantype", "2"); + ci->bantype = Config->GetModule(this).Get<int>("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<const Anope::string>("command") != "chanserv/set/misc") + if (block.Get<const Anope::string>("command") != "chanserv/set/misc") continue; - Anope::string cname = block->Get<const Anope::string>("name"); - Anope::string desc = block->Get<const Anope::string>("misc_description"); + Anope::string cname = block.Get<const Anope::string>("name"); + Anope::string desc = block.Get<const Anope::string>("misc_description"); if (cname.empty() || desc.empty()) continue; descriptions[cname] = desc; - auto numeric = block->Get<unsigned>("misc_numeric"); + auto numeric = block.Get<unsigned>("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<time_t>("suspendexpire"); + time_t expiry_secs = Config->GetModule(this->owner).Get<time_t>("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<Anope::string>("show"); + Anope::string s = conf.GetModule(this).Get<Anope::string>("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<bool>("disallow_channel_access")) + if (Config->GetModule("chanserv").Get<bool>("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<bool>("disallow_hostmask_access")) + if (!na && Config->GetModule("chanserv").Get<bool>("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<unsigned>("accessmax", "1000"); + unsigned access_max = Config->GetModule("chanserv").Get<unsigned>("accessmax", "1000"); if (access_max && ci->GetDeepAccessCount() >= access_max) { source.Reply(_("Sorry, you can only have %d access entries on a channel, |
