diff options
author | Attila Molnar <attilamolnar@hush.com> | 2014-07-03 12:27:24 +0200 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2014-07-03 12:27:24 +0200 |
commit | 393cc8f9d65aefd92628115edae341562ea440e7 (patch) | |
tree | 65265c2c1e162cf228c0ea55ce5081c27bf1645f | |
parent | bee8625fbe375f55053d3709b72a2972fbf6ba84 (diff) |
Remove now needless User::ForceNickChange()
Change call sites to call ChangeNick()
-rw-r--r-- | include/users.h | 12 | ||||
-rw-r--r-- | src/coremods/core_user/cmd_nick.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_nicklock.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_sanick.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/nick.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/nickcollide.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_spanningtree/save.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/svsnick.cpp | 4 | ||||
-rw-r--r-- | src/users.cpp | 2 | ||||
-rw-r--r-- | src/xline.cpp | 2 |
10 files changed, 12 insertions, 22 deletions
diff --git a/include/users.h b/include/users.h index 0f8154bef..4029daa53 100644 --- a/include/users.h +++ b/include/users.h @@ -462,15 +462,6 @@ class CoreExport User : public Extensible */ void Oper(OperInfo* info); - /** Force a nickname change. - * If the nickname change fails (for example, because the nick in question - * already exists) this function will return false, and you must then either - * output an error message, or quit the user for nickname collision. - * @param newnick The nickname to change to - * @return True if the nickchange was successful. - */ - bool ForceNickChange(const std::string& newnick, time_t newts = 0) { return ChangeNick(newnick, true, newts); } - /** Oper down. * This will clear the +o usermode and unset the user's oper type */ @@ -598,10 +589,9 @@ class CoreExport User : public Extensible /** Change a user's nick * @param newnick The new nick - * @param force True if the change is being forced (should not be blocked by modes like +N) * @return True if the change succeeded */ - bool ChangeNick(const std::string& newnick, bool force = false, time_t newts = 0); + bool ChangeNick(const std::string& newnick, time_t newts = 0); /** Remove this user from all channels they are on, and delete any that are now empty. * This is used by QUIT, and will not send part messages! diff --git a/src/coremods/core_user/cmd_nick.cpp b/src/coremods/core_user/cmd_nick.cpp index a28c40451..1d14ca703 100644 --- a/src/coremods/core_user/cmd_nick.cpp +++ b/src/coremods/core_user/cmd_nick.cpp @@ -83,7 +83,7 @@ CmdResult CommandNick::HandleLocal(const std::vector<std::string>& parameters, L } } - if (!user->ChangeNick(newnick, false)) + if (!user->ChangeNick(newnick)) return CMD_FAILURE; if (user->registered < REG_NICKUSER) diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp index 21f02fe11..9bf16498a 100644 --- a/src/modules/m_nicklock.cpp +++ b/src/modules/m_nicklock.cpp @@ -64,7 +64,7 @@ class CommandNicklock : public Command locked.set(target, 1); std::string oldnick = target->nick; - if (target->ForceNickChange(parameters[1])) + if (target->ChangeNick(parameters[1])) ServerInstance->SNO->WriteGlobalSno('a', user->nick+" used NICKLOCK to change and hold "+oldnick+" to "+parameters[1]); else { diff --git a/src/modules/m_sanick.cpp b/src/modules/m_sanick.cpp index ca6be2211..ba265fddd 100644 --- a/src/modules/m_sanick.cpp +++ b/src/modules/m_sanick.cpp @@ -64,7 +64,7 @@ class CommandSanick : public Command { std::string oldnick = user->nick; std::string newnick = target->nick; - if (target->ChangeNick(parameters[1], true)) + if (target->ChangeNick(parameters[1])) { ServerInstance->SNO->WriteGlobalSno('a', oldnick+" used SANICK to change "+newnick+" to "+parameters[1]); } diff --git a/src/modules/m_spanningtree/nick.cpp b/src/modules/m_spanningtree/nick.cpp index 733901632..ecec849ee 100644 --- a/src/modules/m_spanningtree/nick.cpp +++ b/src/modules/m_spanningtree/nick.cpp @@ -57,6 +57,6 @@ CmdResult CommandNick::HandleRemote(RemoteUser* user, std::vector<std::string>& return CMD_FAILURE; } } - user->ForceNickChange(params[0], newts); + user->ChangeNick(params[0], newts); return CMD_SUCCESS; } diff --git a/src/modules/m_spanningtree/nickcollide.cpp b/src/modules/m_spanningtree/nickcollide.cpp index 30be98fb5..935ccd6bd 100644 --- a/src/modules/m_spanningtree/nickcollide.cpp +++ b/src/modules/m_spanningtree/nickcollide.cpp @@ -114,7 +114,7 @@ int SpanningTreeUtilities::DoCollision(User* u, TreeServer* server, time_t remot params.push_back(ConvToStr(u->age)); params.Broadcast(); - u->ForceNickChange(u->uuid); + u->ChangeNick(u->uuid); if (!bChangeRemote) return 1; @@ -133,7 +133,7 @@ int SpanningTreeUtilities::DoCollision(User* u, TreeServer* server, time_t remot if (remote) { /* nick change collide. Force change their nick. */ - remote->ForceNickChange(remoteuid); + remote->ChangeNick(remoteuid); } if (!bChangeLocal) diff --git a/src/modules/m_spanningtree/save.cpp b/src/modules/m_spanningtree/save.cpp index 03d401211..dd9e866a9 100644 --- a/src/modules/m_spanningtree/save.cpp +++ b/src/modules/m_spanningtree/save.cpp @@ -36,7 +36,7 @@ CmdResult CommandSave::Handle(User* user, std::vector<std::string>& params) if (u->age == ts) { - if (!u->ForceNickChange(u->uuid)) + if (!u->ChangeNick(u->uuid)) { ServerInstance->Users->QuitUser(u, "Nickname collision"); } diff --git a/src/modules/m_spanningtree/svsnick.cpp b/src/modules/m_spanningtree/svsnick.cpp index 43fa0f296..de1331640 100644 --- a/src/modules/m_spanningtree/svsnick.cpp +++ b/src/modules/m_spanningtree/svsnick.cpp @@ -37,10 +37,10 @@ CmdResult CommandSVSNick::Handle(User* user, std::vector<std::string>& parameter if (NickTS <= 0) return CMD_FAILURE; - if (!u->ForceNickChange(nick, NickTS)) + if (!u->ChangeNick(nick, NickTS)) { /* buh. UID them */ - if (!u->ForceNickChange(u->uuid)) + if (!u->ChangeNick(u->uuid)) { ServerInstance->Users->QuitUser(u, "Nickname collision"); } diff --git a/src/users.cpp b/src/users.cpp index 47dbd2d22..3c2043ac1 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -611,7 +611,7 @@ void User::InvalidateCache() cached_fullrealhost.clear(); } -bool User::ChangeNick(const std::string& newnick, bool force, time_t newts) +bool User::ChangeNick(const std::string& newnick, time_t newts) { if (quitting) { diff --git a/src/xline.cpp b/src/xline.cpp index c48db51b1..b74fda3cf 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -641,7 +641,7 @@ bool QLine::Matches(User *u) void QLine::Apply(User* u) { /* Force to uuid on apply of qline, no need to disconnect any more :) */ - u->ForceNickChange(u->uuid); + u->ChangeNick(u->uuid); } |