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/idle.cpp | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'src/modules/m_spanningtree/idle.cpp') diff --git a/src/modules/m_spanningtree/idle.cpp b/src/modules/m_spanningtree/idle.cpp index 2c95eaad1..57692ddf5 100644 --- a/src/modules/m_spanningtree/idle.cpp +++ b/src/modules/m_spanningtree/idle.cpp @@ -19,33 +19,28 @@ #include "inspircd.h" #include "utils.h" -#include "treesocket.h" +#include "commands.h" -bool TreeSocket::Whois(const std::string &prefix, parameterlist ¶ms) +CmdResult CommandIdle::Handle(User* issuer, std::vector& params) { - if (params.size() < 1) - return true; - /* If this is a request, this user did the /whois * If this is a reply, this user's information is in params[1] and params[2] */ - User* issuer = ServerInstance->FindUUID(prefix); - if ((!issuer) || (IS_SERVER(issuer))) - return true; + if (IS_SERVER(issuer)) + return CMD_FAILURE; /* If this is a request, this is the user whose idle information was requested * If this is a reply, this user did the /whois */ User* target = ServerInstance->FindUUID(params[0]); if ((!target) || (IS_SERVER(target))) - return true; + return CMD_FAILURE; LocalUser* localtarget = IS_LOCAL(target); if (!localtarget) { // Forward to target's server - Utils->DoOneToOne(prefix, "IDLE", params, target->server); - return true; + return CMD_SUCCESS; } if (params.size() >= 2) @@ -63,11 +58,11 @@ bool TreeSocket::Whois(const std::string &prefix, parameterlist ¶ms) idle = ((unsigned int) (ServerInstance->Time() - localtarget->idle_lastmsg)); parameterlist reply; - reply.push_back(prefix); + reply.push_back(issuer->uuid); reply.push_back(ConvToStr(target->signon)); reply.push_back(ConvToStr(idle)); Utils->DoOneToOne(params[0], "IDLE", reply, issuer->server); } - return true; + return CMD_SUCCESS; } -- cgit v1.3.1-10-gc9f91