aboutsummaryrefslogtreecommitdiff
path: root/modules/operprefix.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/operprefix.cpp
parentMove service code from base to its own header. (diff)
Switch modules from reference<> to shared_ptr<> and weak_ptr<>.
Diffstat (limited to 'modules/operprefix.cpp')
-rw-r--r--modules/operprefix.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/modules/operprefix.cpp b/modules/operprefix.cpp
index e122b8572..f171a850b 100644
--- a/modules/operprefix.cpp
+++ b/modules/operprefix.cpp
@@ -35,7 +35,7 @@ class OperPrefixMode final
: public PrefixMode
{
public:
- OperPrefixMode(Module* Creator)
+ OperPrefixMode(const WeakModulePtr& Creator)
: PrefixMode(Creator, "operprefix", 'y', OPERPREFIX_VALUE)
{
prefix = ServerInstance->Config->ConfValue("operprefix")->getCharacter("prefix", '!', true);
@@ -44,13 +44,13 @@ public:
};
class ModuleOperPrefixMode;
+ModuleOperPrefixMode* parentmod;
+
class HideOperWatcher final
: public ModeWatcher
{
- ModuleOperPrefixMode* parentmod;
-
public:
- HideOperWatcher(ModuleOperPrefixMode* parent);
+ HideOperWatcher(const WeakModulePtr& parent);
void AfterMode(User* source, User* dest, Channel* channel, const Modes::Change& change) override;
};
@@ -65,10 +65,11 @@ private:
public:
ModuleOperPrefixMode()
: Module(VF_VENDOR, "Adds the server operator-only y (operprefix) channel prefix mode.")
- , opm(this)
- , hideoperwatcher(this)
- , hideopermode(this, "hideoper")
+ , opm(weak_from_this())
+ , hideoperwatcher(weak_from_this())
+ , hideopermode(weak_from_this(), "hideoper")
{
+ parentmod = this;
/* To give clients a chance to learn about the new prefix we don't give +y to opers
* right now. That means if the module was loaded after opers have joined channels
* they need to rejoin them in order to get the oper prefix.
@@ -113,13 +114,12 @@ public:
void Prioritize() override
{
// m_opermodes may set +H on the oper to hide him, we don't want to set the oper prefix in that case
- ServerInstance->Modules.SetPriority(this, I_OnPostOperLogin, PRIORITY_AFTER, "opermodes");
+ ServerInstance->Modules.SetPriority(shared_from_this(), I_OnPostOperLogin, PRIORITY_AFTER, "opermodes");
}
};
-HideOperWatcher::HideOperWatcher(ModuleOperPrefixMode* parent)
+HideOperWatcher::HideOperWatcher(const WeakModulePtr& parent)
: ModeWatcher(parent, "hideoper", MODETYPE_USER)
- , parentmod(parent)
{
}