diff options
author | attilamolnar <attilamolnar@hush.com> | 2013-07-15 13:40:22 +0200 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2013-08-18 15:11:02 +0200 |
commit | b14ebbccf08ec34a73e1ba271e67da80d9fe805c (patch) | |
tree | 012640699b3960940af3756ef1e881747b0aa8d1 /src/modules/m_spanningtree/idle.cpp | |
parent | 153179b574dccd6df9c5c5f3e68f3c1725e26843 (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/idle.cpp')
-rw-r--r-- | src/modules/m_spanningtree/idle.cpp | 21 |
1 files changed, 8 insertions, 13 deletions
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<std::string>& 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; } |