summaryrefslogtreecommitdiff
path: root/src/modules/m_codepage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/m_codepage.cpp')
-rw-r--r--src/modules/m_codepage.cpp16
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();