aboutsummaryrefslogtreecommitdiff
path: root/modules/sqloper.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/sqloper.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/sqloper.cpp')
-rw-r--r--modules/sqloper.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/modules/sqloper.cpp b/modules/sqloper.cpp
index 8ebf7d4cd..ce56a5218 100644
--- a/modules/sqloper.cpp
+++ b/modules/sqloper.cpp
@@ -37,7 +37,7 @@ public:
* Note: uid will be empty if this DB update was not called as a result of a user command (i.e. /REHASH)
*/
const std::string uid, username, password;
- OperQuery(Module* me, std::vector<std::string>& mb, const std::string& u, const std::string& un, const std::string& pw)
+ OperQuery(const WeakModulePtr& me, std::vector<std::string>& mb, const std::string& u, const std::string& un, const std::string& pw)
: SQL::Query(me)
, my_blocks(mb)
, uid(u)
@@ -45,7 +45,7 @@ public:
, password(pw)
{
}
- OperQuery(Module* me, std::vector<std::string>& mb)
+ OperQuery(const WeakModulePtr& me, std::vector<std::string>& mb)
: SQL::Query(me)
, my_blocks(mb)
{
@@ -163,7 +163,7 @@ private:
public:
ModuleSQLOper()
: Module(VF_VENDOR, "Allows server operators to be authenticated against an SQL table.")
- , SQL(this, "SQL::Provider")
+ , SQL(weak_from_this(), "SQL::Provider")
{
}
@@ -214,13 +214,13 @@ public:
// The one w/o params is for non-/OPER DB updates, such as a rehash.
void GetOperBlocks()
{
- SQL->Submit(new OperQuery(this, my_blocks), query);
+ SQL->Submit(new OperQuery(weak_from_this(), my_blocks), query);
}
void GetOperBlocks(const std::string& u, const std::string& un, const std::string& pw)
{
active = true;
// Call to SQL query to fetch oper list from SQL table.
- SQL->Submit(new OperQuery(this, my_blocks, u, un, pw), query);
+ SQL->Submit(new OperQuery(weak_from_this(), my_blocks, u, un, pw), query);
}
void Prioritize() override
@@ -228,7 +228,7 @@ public:
/** Run before other /OPER hooks that expect populated blocks, i.e. sslinfo or a TOTP module.
* We issue a DENY first, and will re-run OnPreCommand later to trigger the other hooks post-DB update.
*/
- ServerInstance->Modules.SetPriority(this, I_OnPreCommand, PRIORITY_FIRST);
+ ServerInstance->Modules.SetPriority(shared_from_this(), I_OnPreCommand, PRIORITY_FIRST);
}
};