diff options
author | Attila Molnar <attilamolnar@hush.com> | 2016-12-30 18:44:39 +0100 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2016-12-30 18:44:39 +0100 |
commit | 0c3b041d1b36d1515913da5230399b379a802b81 (patch) | |
tree | 0f7b33dab50fda247d8f51edb418bc3c6b5ecb55 /src/modules | |
parent | 688275707a331a94892408408eb74d7ec20c7c1f (diff) |
Deduplicate nickname overruling code
Create LocalUser::OverruleNick(), call it from User::ChangeNick() and the UID handler in spanningtree
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_spanningtree/uid.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/modules/m_spanningtree/uid.cpp b/src/modules/m_spanningtree/uid.cpp index a41fe408d..6f59fcd50 100644 --- a/src/modules/m_spanningtree/uid.cpp +++ b/src/modules/m_spanningtree/uid.cpp @@ -50,12 +50,8 @@ CmdResult CommandUID::HandleServer(TreeServer* remoteserver, std::vector<std::st { // User that the incoming user is colliding with is not fully registered, we force nick change the // unregistered user to their uuid and tell them what happened - collideswith->WriteFrom(collideswith, "NICK %s", collideswith->uuid.c_str()); - collideswith->WriteNumeric(ERR_NICKNAMEINUSE, collideswith->nick, "Nickname overruled."); - - // Clear the bit before calling User::ChangeNick() to make it NOT run the OnUserPostNick() hook - collideswith->registered &= ~REG_NICK; - collideswith->ChangeNick(collideswith->uuid); + LocalUser* const localuser = static_cast<LocalUser*>(collideswith); + localuser->OverruleNick(); } else if (collideswith) { |