aboutsummaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree/save.cpp
diff options
context:
space:
mode:
authorGravatar attilamolnar2013-07-15 13:40:22 +0200
committerGravatar attilamolnar2013-08-18 15:11:02 +0200
commitb14ebbccf08ec34a73e1ba271e67da80d9fe805c (patch)
tree012640699b3960940af3756ef1e881747b0aa8d1 /src/modules/m_spanningtree/save.cpp
parentCreate the CommandBase class from Command (diff)
m_spanningtree Move all server-to-server command handlers into handler classes
These commands are not registered in or called by the core. When looking for the handler of a command a new command table is searched first which contains all server-to-server commands. If a handler cannot be found in there, the core command table is consulted.
Diffstat (limited to 'src/modules/m_spanningtree/save.cpp')
-rw-r--r--src/modules/m_spanningtree/save.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/modules/m_spanningtree/save.cpp b/src/modules/m_spanningtree/save.cpp
index 42d909be7..8f0eced73 100644
--- a/src/modules/m_spanningtree/save.cpp
+++ b/src/modules/m_spanningtree/save.cpp
@@ -21,28 +21,27 @@
#include "utils.h"
#include "treesocket.h"
+#include "commands.h"
/**
* SAVE command - force nick change to UID on timestamp match
*/
-bool TreeSocket::ForceNick(const std::string &prefix, parameterlist &params)
+CmdResult CommandSave::Handle(User* user, std::vector<std::string>& params)
{
- if (params.size() < 2)
- return true;
-
User* u = ServerInstance->FindNick(params[0]);
+ if ((!u) || (IS_SERVER(u)))
+ return CMD_FAILURE;
+
time_t ts = atol(params[1].c_str());
- if ((u) && (!IS_SERVER(u)) && (u->age == ts))
+ if (u->age == ts)
{
- Utils->DoOneToAllButSender(prefix,"SAVE",params,prefix);
-
if (!u->ForceNickChange(u->uuid))
{
ServerInstance->Users->QuitUser(u, "Nickname collision");
}
}
- return true;
+ return CMD_SUCCESS;
}