diff options
| author | 2021-01-07 13:13:58 +0000 | |
|---|---|---|
| committer | 2021-01-07 13:13:58 +0000 | |
| commit | 4f68d162cc55a8e35f9800a2ab85274876061861 (patch) | |
| tree | 8de0f196ab3447614a6481f9b356e5dc2bae5a27 /src/modules/m_codepage.cpp | |
| parent | Add a function for shrinking module names. (diff) | |
| parent | Implement support for more XML and IRC colour code escapes. (diff) | |
Merge branch 'insp3' into master.
Diffstat (limited to 'src/modules/m_codepage.cpp')
| -rw-r--r-- | src/modules/m_codepage.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/modules/m_codepage.cpp b/src/modules/m_codepage.cpp index 3507b41a5..3ce821418 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(); @@ -83,7 +98,10 @@ class ModuleCodepage { LocalUser* user = *iter; if (user->nick != user->uuid && !ServerInstance->IsNick(user->nick)) + { + user->WriteNumeric(RPL_SAVENICK, user->uuid, "Your nickname is no longer valid."); user->ChangeNick(user->uuid); + } } } @@ -113,6 +131,7 @@ class ModuleCodepage ServerInstance->Config->CaseMapping = origcasemapname; national_case_insensitive_map = origcasemap; + CheckDuplicateNick(); CheckRehash(casemap); } |
