From b14ebbccf08ec34a73e1ba271e67da80d9fe805c Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Mon, 15 Jul 2013 13:40:22 +0200 Subject: 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. --- src/modules/m_spanningtree/encap.cpp | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) (limited to 'src/modules/m_spanningtree/encap.cpp') diff --git a/src/modules/m_spanningtree/encap.cpp b/src/modules/m_spanningtree/encap.cpp index fedadedb5..12ab2b664 100644 --- a/src/modules/m_spanningtree/encap.cpp +++ b/src/modules/m_spanningtree/encap.cpp @@ -18,31 +18,24 @@ #include "inspircd.h" -#include "xline.h" -#include "treesocket.h" -#include "utils.h" +#include "commands.h" /** ENCAP */ -void TreeSocket::Encap(User* who, parameterlist ¶ms) +CmdResult CommandEncap::Handle(User* user, std::vector& params) { - if (params.size() > 1) + if (ServerInstance->Config->GetSID() == params[0] || InspIRCd::Match(ServerInstance->Config->ServerName, params[0])) { - if (ServerInstance->Config->GetSID() == params[0] || InspIRCd::Match(ServerInstance->Config->ServerName, params[0])) - { - parameterlist plist(params.begin() + 2, params.end()); - ServerInstance->Parser->CallHandler(params[1], plist, who); - // discard return value, ENCAP shall succeed even if the command does not exist - } - - params[params.size() - 1] = ":" + params[params.size() - 1]; - - if (params[0].find_first_of("*?") != std::string::npos) - { - Utils->DoOneToAllButSender(who->uuid, "ENCAP", params, who->server); - } - else - Utils->DoOneToOne(who->uuid, "ENCAP", params, params[0]); + parameterlist plist(params.begin() + 2, params.end()); + ServerInstance->Parser->CallHandler(params[1], plist, user); + // Discard return value, ENCAP shall succeed even if the command does not exist } + return CMD_SUCCESS; } +RouteDescriptor CommandEncap::GetRouting(User* user, const std::vector& params) +{ + if (params[0].find_first_of("*?") != std::string::npos) + return ROUTE_BROADCAST; + return ROUTE_UNICAST(params[0]); +} -- cgit v1.3.1-10-gc9f91