aboutsummaryrefslogtreecommitdiffstats
path: root/modules/help.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2026-03-28 21:32:23 +0000
committerGravatar Sadie Powell2026-03-29 00:42:15 +0000
commitcbc5431d62e3fe9166f18395dce3ddf2af0906d3 (patch)
tree48a87fc27dc4826ce0caf4071e2060a9ff9e24c5 /modules/help.cpp
parentMove service code from base to its own header. (diff)
downloadinspircd++-cbc5431d62e3fe9166f18395dce3ddf2af0906d3.tar.gz
inspircd++-cbc5431d62e3fe9166f18395dce3ddf2af0906d3.tar.bz2
inspircd++-cbc5431d62e3fe9166f18395dce3ddf2af0906d3.zip
Switch modules from reference<> to shared_ptr<> and weak_ptr<>.
Diffstat (limited to 'modules/help.cpp')
-rw-r--r--modules/help.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/modules/help.cpp b/modules/help.cpp
index df43b2ecb..84681f3e4 100644
--- a/modules/help.cpp
+++ b/modules/help.cpp
@@ -63,7 +63,7 @@ public:
HelpMap help;
std::string nohelp;
- CommandHelp(Module* Creator)
+ CommandHelp(const WeakModulePtr& Creator)
: Command(Creator, "HELP")
, startkey("start")
{
@@ -98,7 +98,7 @@ private:
public:
ModuleHelp()
: Module(VF_VENDOR, "Adds the /HELP command which allows users to view help on various topics.")
- , cmd(this)
+ , cmd(weak_from_this())
{
}
@@ -109,23 +109,23 @@ public:
HelpMap newhelp;
auto tags = ServerInstance->Config->ConfTags("helptopic", ServerInstance->Config->ConfTags("helpop"));
if (tags.empty())
- throw ModuleException(this, "You have loaded the help module but not configured any help topics!");
+ throw ModuleException(weak_from_this(), "You have loaded the help module but not configured any help topics!");
for (const auto& [_, tag] : tags)
{
// Attempt to read the help key.
const std::string key = tag->getString("key");
if (key.empty())
- throw ModuleException(this, "<{}:key> is empty at {}", tag->name, tag->source.str());
+ throw ModuleException(weak_from_this(), "<{}:key> is empty at {}", tag->name, tag->source.str());
else if (insp::casemapped_equals(key, "index"))
- throw ModuleException(this, "<{}:key> is set to \"index\" which is reserved at {}", tag->name, tag->source.str());
+ throw ModuleException(weak_from_this(), "<{}:key> is set to \"index\" which is reserved at {}", tag->name, tag->source.str());
else if (key.length() > longestkey)
longestkey = key.length();
// Attempt to read the help value.
std::string value;
if (!tag->readString("value", value, true) || value.empty())
- throw ModuleException(this, "<{}:value> is empty at {}", tag->name, tag->source.str());
+ throw ModuleException(weak_from_this(), "<{}:value> is empty at {}", tag->name, tag->source.str());
// Parse the help body. Empty lines are replaced with a single
// space because some clients are unable to show blank lines.
@@ -138,7 +138,7 @@ public:
const std::string title = tag->getString("title", FMT::format("*** Help for {}", key), 1);
if (!newhelp.emplace(key, HelpTopic(helpmsg, title)).second)
{
- throw ModuleException(this, "<{}> tag with duplicate key '{}' at {}",
+ throw ModuleException(weak_from_this(), "<{}> tag with duplicate key '{}' at {}",
tag->name, key, tag->source.str());
}
}