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/operserv | |
| 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/operserv')
| -rw-r--r-- | modules/operserv/operserv.cpp | 6 | ||||
| -rw-r--r-- | modules/operserv/os_akill.cpp | 14 | ||||
| -rw-r--r-- | modules/operserv/os_chankill.cpp | 4 | ||||
| -rw-r--r-- | modules/operserv/os_config.cpp | 14 | ||||
| -rw-r--r-- | modules/operserv/os_defcon.cpp | 47 | ||||
| -rw-r--r-- | modules/operserv/os_dns.cpp | 18 | ||||
| -rw-r--r-- | modules/operserv/os_forbid.cpp | 8 | ||||
| -rw-r--r-- | modules/operserv/os_ignore.cpp | 2 | ||||
| -rw-r--r-- | modules/operserv/os_info.cpp | 2 | ||||
| -rw-r--r-- | modules/operserv/os_kill.cpp | 2 | ||||
| -rw-r--r-- | modules/operserv/os_list.cpp | 4 | ||||
| -rw-r--r-- | modules/operserv/os_logsearch.cpp | 2 | ||||
| -rw-r--r-- | modules/operserv/os_news.cpp | 16 | ||||
| -rw-r--r-- | modules/operserv/os_session.cpp | 22 | ||||
| -rw-r--r-- | modules/operserv/os_set.cpp | 2 | ||||
| -rw-r--r-- | modules/operserv/os_shutdown.cpp | 18 | ||||
| -rw-r--r-- | modules/operserv/os_stats.cpp | 6 | ||||
| -rw-r--r-- | modules/operserv/os_sxline.cpp | 26 |
18 files changed, 108 insertions, 105 deletions
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<const Anope::string>("client"); + const Anope::string &osnick = conf.GetModule(this).Get<const Anope::string>("client"); if (osnick.empty()) throw ConfigException(this->name + ": <client> must be defined"); @@ -232,7 +232,7 @@ public: EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message, const Anope::map<Anope::string> &tags) override { - if (bi == OperServ && !u->HasMode("OPER") && Config->GetModule(this)->Get<bool>("opersonly")) + if (bi == OperServ && !u->HasMode("OPER") && Config->GetModule(this).Get<bool>("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<time_t>("autokillexpiry", "30d"); + time_t expires = !expiry.empty() ? Anope::DoTime(expiry) : Config->GetModule("operserv").Get<time_t>("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<const Anope::string>("regexengine"); + const Anope::string ®exengine = Config->GetBlock("options").Get<const Anope::string>("regexengine"); if (regexengine.empty()) { @@ -155,7 +155,7 @@ private: if (targ) mask = "*@" + targ->host; - if (Config->GetModule("operserv")->Get<bool>("addakiller", "yes") && !source.GetNick().empty()) + if (Config->GetModule("operserv").Get<bool>("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<bool>("akillids")) + if (Config->GetModule("operserv").Get<bool>("akillids")) x->id = XLineManager::GenerateUID(); unsigned int affected = 0; @@ -202,7 +202,7 @@ private: } akills->AddXLine(x); - if (Config->GetModule("operserv")->Get<bool>("akillonadd")) + if (Config->GetModule("operserv").Get<bool>("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<bool>("akillids")) + if (Config->GetModule("operserv").Get<bool>("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<const Anope::string>("regexengine"); + const Anope::string ®exengine = Config->GetBlock("options").Get<const Anope::string>("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<time_t>("autokillexpiry", "30d"); + time_t expires = !expiry.empty() ? Anope::DoTime(expiry) : Config->GetModule("operserv").Get<time_t>("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<bool>("addakiller") && !source.GetNick().empty()) + if (Config->GetModule("operserv").Get<bool>("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<Anope::string> 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<Anope::string>("name"); + entry["Module Name"] = block.Get<Anope::string>("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<int>("defaultlevel"); - dconfig.defcons[4] = block->Get<const Anope::string>("level4"); - dconfig.defcons[3] = block->Get<const Anope::string>("level3"); - dconfig.defcons[2] = block->Get<const Anope::string>("level2"); - dconfig.defcons[1] = block->Get<const Anope::string>("level1"); - dconfig.sessionlimit = block->Get<int>("sessionlimit"); - dconfig.akillreason = block->Get<const Anope::string>("akillreason"); - dconfig.akillexpire = block->Get<time_t>("akillexpire"); - dconfig.chanmodes = block->Get<const Anope::string>("chanmodes"); - dconfig.timeout = block->Get<time_t>("timeout"); - dconfig.globalondefcon = block->Get<bool>("globalondefcon"); - dconfig.message = block->Get<const Anope::string>("message"); - dconfig.offmessage = block->Get<const Anope::string>("offmessage"); - - block = conf->GetModule("os_session"); - - dconfig.max_session_kill = block->Get<int>("maxsessionkill"); - dconfig.session_autokill_expiry = block->Get<time_t>("sessionautokillexpiry"); - dconfig.sle_reason = block->Get<const Anope::string>("sessionlimitexceeded"); - dconfig.sle_detailsloc = block->Get<const Anope::string>("sessionlimitdetailsloc"); + { + Configuration::Block &block = conf.GetModule(this); + dconfig.defaultlevel = block.Get<int>("defaultlevel"); + dconfig.defcons[4] = block.Get<const Anope::string>("level4"); + dconfig.defcons[3] = block.Get<const Anope::string>("level3"); + dconfig.defcons[2] = block.Get<const Anope::string>("level2"); + dconfig.defcons[1] = block.Get<const Anope::string>("level1"); + dconfig.sessionlimit = block.Get<int>("sessionlimit"); + dconfig.akillreason = block.Get<const Anope::string>("akillreason"); + dconfig.akillexpire = block.Get<time_t>("akillexpire"); + dconfig.chanmodes = block.Get<const Anope::string>("chanmodes"); + dconfig.timeout = block.Get<time_t>("timeout"); + dconfig.globalondefcon = block.Get<bool>("globalondefcon"); + dconfig.message = block.Get<const Anope::string>("message"); + dconfig.offmessage = block.Get<const Anope::string>("offmessage"); + } + + { + Configuration::Block &block = conf.GetModule("os_session"); + dconfig.max_session_kill = block.Get<int>("maxsessionkill"); + dconfig.session_autokill_expiry = block.Get<time_t>("sessionautokillexpiry"); + dconfig.sle_reason = block.Get<const Anope::string>("sessionlimitexceeded"); + dconfig.sle_detailsloc = block.Get<const Anope::string>("sessionlimitdetailsloc"); + } if (dconfig.defaultlevel < 1 || dconfig.defaultlevel > 5) throw ConfigException("The value for <defcon:defaultlevel> 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 - { - Configuration::Block *block = conf->GetModule(this); - this->ttl = block->Get<time_t>("ttl"); - this->user_drop_mark = block->Get<int>("user_drop_mark"); - this->user_drop_time = block->Get<time_t>("user_drop_time"); - this->user_drop_readd_time = block->Get<time_t>("user_drop_readd_time"); - this->remove_split_servers = block->Get<bool>("remove_split_servers"); - this->readd_connected_servers = block->Get<bool>("readd_connected_servers"); + void OnReload(Configuration::Conf &conf) override + { + Configuration::Block &block = conf.GetModule(this); + this->ttl = block.Get<time_t>("ttl"); + this->user_drop_mark = block.Get<int>("user_drop_mark"); + this->user_drop_time = block.Get<time_t>("user_drop_time"); + this->user_drop_readd_time = block.Get<time_t>("user_drop_readd_time"); + this->remove_split_servers = block.Get<bool>("remove_split_servers"); + this->readd_connected_servers = block.Get<bool>("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<bool>("secureadmins", "yes") && target->nc->IsServicesOper()) + if (target != NULL && Config->GetModule("nickserv").Get<bool>("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<time_t>("inhabit", "1m"); + time_t inhabit = Config->GetModule("chanserv").Get<time_t>("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<const Anope::string>("regexengine"); + const Anope::string ®exengine = Config->GetBlock("options").Get<const Anope::string>("regexengine"); if (!regexengine.empty()) { source.Reply(" "); @@ -513,7 +513,7 @@ public: ServiceReference<ChanServService> chanserv("ChanServService", "ChanServ"); if (IRCD->CanSQLineChannel) { - time_t inhabit = Config->GetModule("chanserv")->Get<time_t>("inhabit", "1m"); + time_t inhabit = Config->GetModule("chanserv").Get<time_t>("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<const Anope::string>("regexengine"); + const Anope::string ®exengine = Config->GetBlock("options").Get<const Anope::string>("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<OperInfos>("operinfo"); - if ((*oi)->size() >= Config->GetModule(this->module)->Get<unsigned>("max", "10")) + if ((*oi)->size() >= Config->GetModule(this->module).Get<unsigned>("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<bool>("addakiller")) + if (Config->GetModule("operserv").Get<bool>("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<const Anope::string>("regexengine"); + const Anope::string ®exengine = Config->GetBlock("options").Get<const Anope::string>("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<const Anope::string>("regexengine"); + const Anope::string ®exengine = Config->GetBlock("options").Get<const Anope::string>("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<const Anope::string>("logname"); + const Anope::string &logfile_name = Config->GetModule(this->owner).Get<const Anope::string>("logname"); std::vector<Anope::string> 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<unsigned>("newscount", "3")); + Config->GetModule(this->owner).Get<unsigned>("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<unsigned>("newscount", "3")); + Config->GetModule(this->owner).Get<unsigned>("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<const Anope::string>("oper_announcer", "OperServ"), true); + bi = BotInfo::Find(Config->GetModule(this).Get<const Anope::string>("oper_announcer", "OperServ"), true); else - bi = BotInfo::Find(Config->GetModule(this)->Get<const Anope::string>("announcer", "Global"), true); + bi = BotInfo::Find(Config->GetModule(this).Get<const Anope::string>("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<const Anope::string>("oper_announcer", "OperServ"); - announcer = conf->GetModule(this)->Get<const Anope::string>("announcer", "Global"); - news_count = conf->GetModule(this)->Get<unsigned>("newscount", "3"); + oper_announcer = conf.GetModule(this).Get<const Anope::string>("oper_announcer", "OperServ"); + announcer = conf.GetModule(this).Get<const Anope::string>("announcer", "Global"); + news_count = conf.GetModule(this).Get<unsigned>("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<int>("defaultsessionlimit"); - max_session_kill = block->Get<int>("maxsessionkill"); - session_autokill_expiry = block->Get<time_t>("sessionautokillexpiry"); - sle_reason = block->Get<const Anope::string>("sessionlimitexceeded"); - sle_detailsloc = block->Get<const Anope::string>("sessionlimitdetailsloc"); + session_limit = block.Get<int>("defaultsessionlimit"); + max_session_kill = block.Get<int>("maxsessionkill"); + session_autokill_expiry = block.Get<time_t>("sessionautokillexpiry"); + sle_reason = block.Get<const Anope::string>("sessionlimitexceeded"); + sle_detailsloc = block.Get<const Anope::string>("sessionlimitdetailsloc"); - max_exception_limit = block->Get<int>("maxsessionlimit"); - exception_expiry = block->Get<time_t>("exceptionexpiry"); + max_exception_limit = block.Get<int>("maxsessionlimit"); + exception_expiry = block.Get<time_t>("exceptionexpiry"); - ipv4_cidr = block->Get<unsigned>("session_ipv4_cidr", "32"); - ipv6_cidr = block->Get<unsigned>("session_ipv6_cidr", "128"); + ipv4_cidr = block.Get<unsigned>("session_ipv4_cidr", "32"); + ipv6_cidr = block.Get<unsigned>("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<bool>("superadmin"); + bool super_admin = Config->GetModule(this->owner).Get<bool>("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<bool>("requirename")) + if (Config->GetModule(this->owner).Get<bool>("requirename")) this->SetSyntax(_("\037network-name\037")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { - const auto requirename = Config->GetModule(this->owner)->Get<bool>("requirename"); - const auto networkname = Config->GetBlock("networkinfo")->Get<Anope::string>("networkname"); + const auto requirename = Config->GetModule(this->owner).Get<bool>("requirename"); + const auto networkname = Config->GetBlock("networkinfo").Get<Anope::string>("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<bool>("requirename")) + if (Config->GetModule(this->owner).Get<bool>("requirename")) this->SetSyntax(_("\037network-name\037")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { - const auto requirename = Config->GetModule(this->owner)->Get<bool>("requirename"); - const auto networkname = Config->GetBlock("networkinfo")->Get<Anope::string>("networkname"); + const auto requirename = Config->GetModule(this->owner).Get<bool>("requirename"); + const auto networkname = Config->GetBlock("networkinfo").Get<Anope::string>("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<bool>("requirename")) + if (Config->GetModule(this->owner).Get<bool>("requirename")) this->SetSyntax(_("\037network-name\037")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { - const auto requirename = Config->GetModule(this->owner)->Get<bool>("requirename"); - const auto networkname = Config->GetBlock("networkinfo")->Get<Anope::string>("networkname"); + const auto requirename = Config->GetModule(this->owner).Get<bool>("requirename"); + const auto networkname = Config->GetBlock("networkinfo").Get<Anope::string>("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<time_t>("autokillexpiry", "30d") + 59; + timeout = Config->GetModule("operserv").Get<time_t>("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<time_t>("snlineexpiry", "30d") + 59; + timeout = Config->GetModule("operserv").Get<time_t>("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<time_t>("sglineexpiry", "30d") + 59; + timeout = Config->GetModule("operserv").Get<time_t>("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<bool>("akillids")) + if (Config->GetModule("operserv").Get<bool>("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<time_t>("snlineexpiry", "30d"); + time_t expires = !expiry.empty() ? Anope::DoTime(expiry) : Config->GetModule("operserv").Get<time_t>("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<const Anope::string>("regexengine"); + const Anope::string ®exengine = Config->GetBlock("options").Get<const Anope::string>("regexengine"); if (regexengine.empty()) { @@ -361,7 +361,7 @@ class CommandOSSNLine final if (mask[masklen - 1] == ' ') mask.erase(masklen - 1); - if (Config->GetModule("operserv")->Get<bool>("addakiller", "yes") && !source.GetNick().empty()) + if (Config->GetModule("operserv").Get<bool>("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<bool>("akillids")) + if (Config->GetModule("operserv").Get<bool>("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<bool>("killonsnline", "yes")) + if (Config->GetModule("operserv").Get<bool>("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<const Anope::string>("regexengine"); + const Anope::string ®exengine = Config->GetBlock("options").Get<const Anope::string>("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<time_t>("sqlineexpiry", "30d"); + time_t expires = !expiry.empty() ? Anope::DoTime(expiry) : Config->GetModule("operserv").Get<time_t>("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<const Anope::string>("regexengine"); + const Anope::string ®exengine = Config->GetBlock("options").Get<const Anope::string>("regexengine"); if (regexengine.empty()) { @@ -571,7 +571,7 @@ class CommandOSSQLine final } } - if (Config->GetModule("operserv")->Get<bool>("addakiller", "yes") && !source.GetNick().empty()) + if (Config->GetModule("operserv").Get<bool>("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<bool>("akillids")) + if (Config->GetModule("operserv").Get<bool>("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<bool>("killonsqline", "yes")) + if (Config->GetModule("operserv").Get<bool>("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<const Anope::string>("regexengine"); + const Anope::string ®exengine = Config->GetBlock("options").Get<const Anope::string>("regexengine"); if (!regexengine.empty()) { source.Reply(" "); |
