From d9d9cbe025f94523265daa72de7596467d71f5c8 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Mon, 19 Aug 2013 19:11:02 +0200 Subject: m_spanningtree Allow server-to-server command handlers to specify whether they accept servers, remote users or both as the command source To make life easier for handlers accepting servers only as source, pass them a TreeServer* so they don't have to call FindServer() --- src/modules/m_spanningtree/idle.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 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 57692ddf5..679948a51 100644 --- a/src/modules/m_spanningtree/idle.cpp +++ b/src/modules/m_spanningtree/idle.cpp @@ -21,17 +21,19 @@ #include "utils.h" #include "commands.h" -CmdResult CommandIdle::Handle(User* issuer, std::vector& params) +CmdResult CommandIdle::HandleRemote(RemoteUser* issuer, std::vector& params) { - /* 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] + /** + * There are two forms of IDLE: request and reply. Requests have one parameter, + * replies have more than one. + * + * If this is a request, 'issuer' did a /whois and its server wants to learn the + * idle time of the user in params[0]. + * + * If this is a reply, params[0] is the user who did the whois and params.back() is + * the number of seconds 'issuer' has been idle. */ - 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 CMD_FAILURE; -- cgit v1.3.1-10-gc9f91