]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/ping.cpp
m_spanningtree Remove duplicate code for sending channel messages from RouteCommand()
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / ping.cpp
index badcc340162ed1f09645745ee8ec1637bc522463..537efe96466488af37948961335f9ae38d6c42ca 100644 (file)
 #include "inspircd.h"
 
 #include "utils.h"
-#include "treesocket.h"
-
-/* $ModDep: m_spanningtree/utils.h m_spanningtree/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;
 }