X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_spanningtree%2Fidle.cpp;h=ad58e52f08f9eb871a9b062923d4c4e844a7d603;hb=1e4b53a286e428e78bd5650815048970d345f7e3;hp=57692ddf53c8790b43cb5b8ef3f07706bd76571c;hpb=b14ebbccf08ec34a73e1ba271e67da80d9fe805c;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_spanningtree/idle.cpp b/src/modules/m_spanningtree/idle.cpp index 57692ddf5..ad58e52f0 100644 --- a/src/modules/m_spanningtree/idle.cpp +++ b/src/modules/m_spanningtree/idle.cpp @@ -21,19 +21,21 @@ #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))) + if ((!target) || (target->registered != REG_ALL)) return CMD_FAILURE; LocalUser* localtarget = IS_LOCAL(target); @@ -45,7 +47,7 @@ CmdResult CommandIdle::Handle(User* issuer, std::vector& params) if (params.size() >= 2) { - ServerInstance->Parser->CallHandler("WHOIS", params, issuer); + ServerInstance->Parser.CallHandler("WHOIS", params, issuer); } else { @@ -57,11 +59,11 @@ CmdResult CommandIdle::Handle(User* issuer, std::vector& params) else idle = ((unsigned int) (ServerInstance->Time() - localtarget->idle_lastmsg)); - parameterlist reply; + CmdBuilder reply(params[0], "IDLE"); reply.push_back(issuer->uuid); reply.push_back(ConvToStr(target->signon)); reply.push_back(ConvToStr(idle)); - Utils->DoOneToOne(params[0], "IDLE", reply, issuer->server); + reply.Unicast(issuer); } return CMD_SUCCESS;