From cbc5431d62e3fe9166f18395dce3ddf2af0906d3 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sat, 28 Mar 2026 21:32:23 +0000 Subject: Switch modules from reference<> to shared_ptr<> and weak_ptr<>. --- modules/codepage.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'modules/codepage.cpp') diff --git a/modules/codepage.cpp b/modules/codepage.cpp index 903b408ca..c6a0e0279 100644 --- a/modules/codepage.cpp +++ b/modules/codepage.cpp @@ -337,7 +337,7 @@ private: public: ModuleCodepage() : Module(VF_VENDOR | VF_COMMON, "Allows the server administrator to define what characters are allowed in nicknames and how characters should be compared in a case insensitive way.") - , ISupport::EventListener(this) + , ISupport::EventListener(weak_from_this()) , origcasemap(national_case_insensitive_map) , origcasemapname(ServerInstance->Config->CaseMapping) , origisnick(ServerInstance->Users.IsNick) @@ -363,18 +363,18 @@ public: const std::string name = codepagetag->getString("name"); if (name.empty()) - throw ModuleException(this, " is a required field!"); + throw ModuleException(weak_from_this(), " is a required field!"); std::unique_ptr newcodepage = std::make_unique(); for (const auto& [_, tag] : ServerInstance->Config->ConfTags("cpchars")) { uint32_t begin = tag->getNum("begin", tag->getNum("index", 0)); if (!begin) - throw ModuleException(this, " tag without index or begin specified at " + tag->source.str()); + throw ModuleException(weak_from_this(), " tag without index or begin specified at " + tag->source.str()); uint32_t end = tag->getNum("end", begin); if (begin > end) - throw ModuleException(this, " must be lower than at " + tag->source.str()); + throw ModuleException(weak_from_this(), " must be lower than at " + tag->source.str()); bool front = tag->getBool("front", false); for (uint32_t pos = begin; pos <= end; ++pos) @@ -387,11 +387,11 @@ public: break; case Codepage::AllowCharacterResult::NOT_VALID: - throw ModuleException(this, " tag contains a forbidden character: {} at {}", + throw ModuleException(weak_from_this(), " tag contains a forbidden character: {} at {}", GetPrintable(pos), tag->source.str()); case Codepage::AllowCharacterResult::NOT_VALID_AT_FRONT: - throw ModuleException(this, " tag contains a forbidden front character: {} at {}", + throw ModuleException(weak_from_this(), " tag contains a forbidden front character: {} at {}", GetPrintable(pos), tag->source.str()); } } @@ -401,14 +401,14 @@ public: { uint32_t lower = tag->getNum("lower", 0); if (!lower) - throw ModuleException(this, " is required at " + tag->source.str()); + throw ModuleException(weak_from_this(), " is required at " + tag->source.str()); uint32_t upper = tag->getNum("upper", 0); if (!upper) - throw ModuleException(this, " is required at " + tag->source.str()); + throw ModuleException(weak_from_this(), " is required at " + tag->source.str()); if (!newcodepage->Map(upper, lower)) - throw ModuleException(this, "Malformed tag at " + tag->source.str()); + throw ModuleException(weak_from_this(), "Malformed tag at " + tag->source.str()); ServerInstance->Logs.Debug(MODNAME, "Marked {} as the lower case version of {}", GetPrintable(lower), GetPrintable(upper)); -- cgit v1.3.1-10-gc9f91