summaryrefslogtreecommitdiff
path: root/modules/extra/stats/m_chanstats.cpp
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2024-11-11 16:46:56 +0000
committerSadie Powell <sadie@witchery.services>2024-11-11 16:46:56 +0000
commit96ccfe4cbe9948206ac2d6854778f9a268d2476f (patch)
tree1e2059a204088051b0155b58de56bacaa2bfd58e /modules/extra/stats/m_chanstats.cpp
parentee160842b3ccab37f005c16a8657781e0e0412fd (diff)
Fix using User::Account where User::IsIdentified should be used.
The former causes a dereference which cause a database update. This is not good for performance with db_sql_live on bigger networks.
Diffstat (limited to 'modules/extra/stats/m_chanstats.cpp')
-rw-r--r--modules/extra/stats/m_chanstats.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/extra/stats/m_chanstats.cpp b/modules/extra/stats/m_chanstats.cpp
index cccf4021b..f5b01dde0 100644
--- a/modules/extra/stats/m_chanstats.cpp
+++ b/modules/extra/stats/m_chanstats.cpp
@@ -207,7 +207,7 @@ class MChanstats : public Module
const Anope::string GetDisplay(User *u)
{
- if (u && u->Account() && ns_stats.HasExt(u->Account()))
+ if (u && u->IsIdentified() && ns_stats.HasExt(u->Account()))
return u->Account()->display;
else
return "";
@@ -527,7 +527,7 @@ class MChanstats : public Module
void OnTopicUpdated(User *source, Channel *c, const Anope::string &user, const Anope::string &topic) anope_override
{
- if (!source || !source->Account() || !c->ci || !cs_stats.HasExt(c->ci))
+ if (!source || !source->IsIdentified() || !c->ci || !cs_stats.HasExt(c->ci))
return;
query = "CALL " + prefix + "chanstats_proc_update(@channel@, @nick@, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);";
query.SetValue("channel", c->name);
@@ -550,7 +550,7 @@ class MChanstats : public Module
private:
void OnModeChange(Channel *c, User *u)
{
- if (!u || !u->Account() || !c->ci || !cs_stats.HasExt(c->ci))
+ if (!u || !u->IsIdentified() || !c->ci || !cs_stats.HasExt(c->ci))
return;
query = "CALL " + prefix + "chanstats_proc_update(@channel@, @nick@, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0);";