From 3b35199a538d498250c863ca2bfffea51f9289ad Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sat, 15 Mar 2025 21:08:26 +0000 Subject: [PATCH] Add NickCore::FindId for finding an account by its id. --- include/account.h | 1 + src/nickcore.cpp | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/include/account.h b/include/account.h index 02e71ac38..c4351ed73 100644 --- a/include/account.h +++ b/include/account.h @@ -194,6 +194,7 @@ public: * @return The account, if it exists */ static NickCore *Find(const Anope::string &nick); + static NickCore *FindId(uint64_t id); void AddChannelReference(ChannelInfo *ci); void RemoveChannelReference(ChannelInfo *ci); diff --git a/src/nickcore.cpp b/src/nickcore.cpp index e44ddb746..f971375cb 100644 --- a/src/nickcore.cpp +++ b/src/nickcore.cpp @@ -236,6 +236,17 @@ NickCore *NickCore::Find(const Anope::string &nick) return NULL; } +NickCore *NickCore::FindId(uint64_t id) +{ + auto it = NickCoreIdList->find(id); + if (it != NickCoreIdList->end()) + { + it->second->QueueUpdate(); + return it->second; + } + return nullptr; +} + uint64_t NickCore::GetId() { if (this->id)