/*
* InspIRCd -- Internet Relay Chat Daemon
*
+ * Copyright (C) 2018-2019 Sadie Powell <sadie@witchery.services>
+ * Copyright (C) 2013 Attila Molnar <attilamolnar@hush.com>
+ * Copyright (C) 2012 Robby <robby@chatbelgie.be>
+ * Copyright (C) 2010 Craig Edwards <brain@inspircd.org>
+ * Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
* Copyright (C) 2008 Robin Burchell <robin+git@viroteck.net>
*
* This file is part of InspIRCd. InspIRCd is free software: you can
#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 ¶ms)
+CmdResult CommandPing::Handle(User* user, Params& 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;
+ CmdBuilder reply("PONG");
+ reply.push(user->uuid);
if (params.size() >= 2)
// If there is a second parameter, append it
- reply.append(" :").append(params[1]);
+ reply.push(params[1]);
- this->WriteLine(reply);
+ reply.Unicast(user);
}
- else
- {
- // not for us, pass it on :)
- Utils->DoOneToOne(prefix,"PING",params,forwardto);
- }
- return true;
+ return CMD_SUCCESS;
}
-
-