diff options
author | Sadie Powell <sadie@witchery.services> | 2024-11-15 15:12:50 +0000 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2024-11-15 15:12:50 +0000 |
commit | bc44195a3dc1dfa19cdb4621e0dddc3278277fa9 (patch) | |
tree | 09d8725b37a786f18df0fed6f87a220442ac793f | |
parent | a7cbe2a139a6c4f0e8691fb7cc42f478d9f21938 (diff) |
Make the account id map also use a checker.
-rw-r--r-- | include/account.h | 2 | ||||
-rw-r--r-- | src/nickcore.cpp | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/include/account.h b/include/account.h index 57ca5b506..4bd8371ff 100644 --- a/include/account.h +++ b/include/account.h @@ -23,7 +23,7 @@ typedef std::unordered_map<uint64_t, NickCore *> nickcoreid_map; extern CoreExport Serialize::Checker<nickalias_map> NickAliasList; extern CoreExport Serialize::Checker<nickcore_map> NickCoreList; -extern CoreExport nickcoreid_map NickCoreIdList; +extern CoreExport Serialize::Checker<nickcoreid_map> NickCoreIdList; /* A registered nickname. * It matters that Base is here before Extensible (it is inherited by Serializable) diff --git a/src/nickcore.cpp b/src/nickcore.cpp index 253f81c7a..38b2de223 100644 --- a/src/nickcore.cpp +++ b/src/nickcore.cpp @@ -16,7 +16,7 @@ #include <climits> Serialize::Checker<nickcore_map> NickCoreList("NickCore"); -nickcoreid_map NickCoreIdList; +Serialize::Checker<nickcoreid_map> NickCoreIdList("NickCore"); NickCore::NickCore(const Anope::string &coredisplay, uint64_t coreid) : Serializable("NickCore") @@ -32,7 +32,7 @@ NickCore::NickCore(const Anope::string &coredisplay, uint64_t coreid) Log(LOG_DEBUG) << "Duplicate account " << this->display << " in NickCore table"; // Upgrading users may not have an account identifier. - if (this->id && !NickCoreIdList.insert_or_assign(this->id, this).second) + if (this->id && !NickCoreIdList->insert_or_assign(this->id, this).second) Log(LOG_DEBUG) << "Duplicate account id " << this->id << " in NickCore table"; FOREACH_MOD(OnNickCoreCreate, (this)); @@ -56,7 +56,7 @@ NickCore::~NickCore() NickCoreList->erase(this->display); if (this->id) - NickCoreIdList.erase(this->id); + NickCoreIdList->erase(this->id); if (!this->memos.memos->empty()) { @@ -222,7 +222,7 @@ uint64_t NickCore::GetId() { const auto newidstr = this->display + "\0" + Anope::ToString(this->time_registered) + "\0" + Anope::ToString(attempt++); const auto newid = Anope::hash_cs()(newidstr); - if (NickCoreIdList.emplace(newid, this).second) + if (NickCoreIdList->emplace(newid, this).second) { this->id = newid; this->QueueUpdate(); |