From e71a9e289441fd78ffa1bd3d8c20ea2cb8542426 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Mon, 3 Jun 2024 15:51:29 +0100 Subject: Avoid NickAlias lookups by storing a pointer in the NickCore. --- modules/hostserv/hostserv.cpp | 2 +- modules/hostserv/hs_off.cpp | 2 +- modules/hostserv/hs_on.cpp | 2 +- modules/nickserv/ns_register.cpp | 2 +- modules/sasl.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'modules') diff --git a/modules/hostserv/hostserv.cpp b/modules/hostserv/hostserv.cpp index 81257cf4f..39b49ec29 100644 --- a/modules/hostserv/hostserv.cpp +++ b/modules/hostserv/hostserv.cpp @@ -43,7 +43,7 @@ public: const NickAlias *na = NickAlias::Find(u->nick); if (!na || na->nc != u->Account() || !na->HasVHost()) - na = NickAlias::Find(u->Account()->display); + na = u->AccountNick(); if (!na || !na->HasVHost()) return; diff --git a/modules/hostserv/hs_off.cpp b/modules/hostserv/hs_off.cpp index 8689ff919..b5978582f 100644 --- a/modules/hostserv/hs_off.cpp +++ b/modules/hostserv/hs_off.cpp @@ -27,7 +27,7 @@ public: const NickAlias *na = NickAlias::Find(u->nick); if (!na || na->nc != u->Account() || !na->HasVHost()) - na = NickAlias::Find(u->Account()->display); + na = u->AccountNick(); if (!na || !na->HasVHost()) source.Reply(HOST_NOT_ASSIGNED); diff --git a/modules/hostserv/hs_on.cpp b/modules/hostserv/hs_on.cpp index d61975b0b..6d4904042 100644 --- a/modules/hostserv/hs_on.cpp +++ b/modules/hostserv/hs_on.cpp @@ -29,7 +29,7 @@ public: User *u = source.GetUser(); const NickAlias *na = NickAlias::Find(u->nick); if (!na || na->nc != u->Account() || !na->HasVHost()) - na = NickAlias::Find(u->Account()->display); + na = u->AccountNick(); if (na && u->Account() == na->nc && na->HasVHost()) { source.Reply(_("Your vhost of \002%s\002 is now activated."), na->GetVHostMask().c_str()); diff --git a/modules/nickserv/ns_register.cpp b/modules/nickserv/ns_register.cpp index 28582a7ab..277cc43a2 100644 --- a/modules/nickserv/ns_register.cpp +++ b/modules/nickserv/ns_register.cpp @@ -401,7 +401,7 @@ public: u->SendMessage(NickServ, _("All new accounts must be validated by an administrator. Please wait for your registration to be confirmed.")); else u->SendMessage(NickServ, _("Your email address is not confirmed. To confirm it, follow the instructions that were emailed to you.")); - const NickAlias *this_na = NickAlias::Find(u->Account()->display); + const NickAlias *this_na = u->AccountNick(); time_t time_registered = Anope::CurTime - this_na->time_registered; time_t unconfirmed_expire = Config->GetModule(this)->Get("unconfirmedexpire", "1d"); if (unconfirmed_expire > time_registered) diff --git a/modules/sasl.cpp b/modules/sasl.cpp index f9be602b8..d84d08624 100644 --- a/modules/sasl.cpp +++ b/modules/sasl.cpp @@ -302,7 +302,7 @@ public: // If the user is already introduced then we log them in now. // Otherwise, we send an SVSLOGIN to log them in later. User *user = User::Find(session->uid); - NickAlias *na = nc ? NickAlias::Find(nc->display) : nullptr; + NickAlias *na = nc ? nc->na : nullptr; if (user) { if (na) -- cgit