aboutsummaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree/ping.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/ping.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/ping.cpp')
-rw-r--r--src/modules/m_spanningtree/ping.cpp26
1 files changed, 10 insertions, 16 deletions
diff --git a/src/modules/m_spanningtree/ping.cpp b/src/modules/m_spanningtree/ping.cpp
index 92eee2666..537efe964 100644
--- a/src/modules/m_spanningtree/ping.cpp
+++ b/src/modules/m_spanningtree/ping.cpp
@@ -20,30 +20,24 @@
#include "inspircd.h"
#include "utils.h"
-#include "treesocket.h"
+#include "treeserver.h"
+#include "commands.h"
+#include "utils.h"
-bool TreeSocket::LocalPing(const std::string &prefix, parameterlist &params)
+CmdResult CommandPing::Handle(User* user, std::vector<std::string>& params)
{
- if (params.size() < 1)
- return true;
-
- const std::string& forwardto = params[0];
- if (forwardto == ServerInstance->Config->GetSID())
+ if (params[0] == ServerInstance->Config->GetSID())
{
// PING for us, reply with a PONG
- std::string reply = ":" + forwardto + " PONG " + prefix;
+ parameterlist reply;
+ reply.push_back(user->uuid);
if (params.size() >= 2)
// If there is a second parameter, append it
- reply.append(" :").append(params[1]);
+ reply.push_back(params[1]);
- this->WriteLine(reply);
- }
- else
- {
- // not for us, pass it on :)
- Utils->DoOneToOne(prefix,"PING",params,forwardto);
+ Utils->DoOneToOne(params[0], "PONG", reply, user->server);
}
- return true;
+ return CMD_SUCCESS;
}