mirror of
https://github.com/anope/anope.git
synced 2026-07-05 01:53:13 +02:00
Make the account id map also use a checker.
This commit is contained in:
+1
-1
@@ -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)
|
||||
|
||||
+4
-4
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user