diff options
author | Sadie Powell <sadie@witchery.services> | 2020-12-22 04:10:07 +0000 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2020-12-22 04:13:56 +0000 |
commit | 79cc3caeb8f485ab0bdc405ab4ead54a25ab097c (patch) | |
tree | 4d60f41fbf656dbd0f1277306c0d30a4abd086b8 /src/modules/m_codepage.cpp | |
parent | 96befc58f073b4f96771b57d728b16742294c2fe (diff) |
After changing the codepage rename duplicate users to their UUID.
Diffstat (limited to 'src/modules/m_codepage.cpp')
-rw-r--r-- | src/modules/m_codepage.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/modules/m_codepage.cpp b/src/modules/m_codepage.cpp index 4054c72c1..45fdb3d83 100644 --- a/src/modules/m_codepage.cpp +++ b/src/modules/m_codepage.cpp @@ -76,6 +76,21 @@ class ModuleCodepage hashmap.swap(newhash); } + void CheckDuplicateNick() + { + insp::flat_set<std::string, irc::insensitive_swo> duplicates; + const UserManager::LocalList& list = ServerInstance->Users.GetLocalUsers(); + for (UserManager::LocalList::const_iterator iter = list.begin(); iter != list.end(); ++iter) + { + LocalUser* user = *iter; + if (user->nick != user->uuid && !duplicates.insert(user->nick).second) + { + user->WriteNumeric(RPL_SAVENICK, user->uuid, "Your nickname is no longer available."); + user->ChangeNick(user->uuid); + } + } + } + void CheckInvalidNick() { const UserManager::LocalList& list = ServerInstance->Users.GetLocalUsers(); @@ -115,6 +130,7 @@ class ModuleCodepage ServerInstance->Config->CaseMapping = origcasemapname; national_case_insensitive_map = origcasemap; + CheckDuplicateNick(); CheckRehash(casemap); ServerInstance->ISupport.Build(); |