From 0c3b041d1b36d1515913da5230399b379a802b81 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Fri, 30 Dec 2016 18:44:39 +0100 Subject: Deduplicate nickname overruling code Create LocalUser::OverruleNick(), call it from User::ChangeNick() and the UID handler in spanningtree --- src/modules/m_spanningtree/uid.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/modules/m_spanningtree/uid.cpp') 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::vectorWriteFrom(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(collideswith); + localuser->OverruleNick(); } else if (collideswith) { -- cgit v1.2.3