From ff6e64ec0f57b11cce18f1e5efa55abfb929b592 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Wed, 30 Dec 2015 13:22:01 +0100 Subject: core_ison Simplify handler --- src/coremods/core_ison.cpp | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/coremods/core_ison.cpp b/src/coremods/core_ison.cpp index ebb43bdf9..3f05720ff 100644 --- a/src/coremods/core_ison.cpp +++ b/src/coremods/core_ison.cpp @@ -68,26 +68,19 @@ CmdResult CommandIson::Handle (const std::vector& parameters, User std::string reply = "303 " + user->nick + " :"; const std::string::size_type pos = reply.size(); - for (std::vector::const_iterator i = parameters.begin(); i != parameters.end(); ++i) + for (std::vector::const_iterator i = parameters.begin(); i != parameters.end()-1; ++i) { const std::string& targetstr = *i; User* const u = ServerInstance->FindNickOnly(targetstr); - if (!AddNick(user, u, reply, pos)) - { - if ((i == parameters.end() - 1) && (targetstr.find(' ') != std::string::npos)) - { - /* Its a space seperated list of nicks (RFC1459 says to support this) - */ - irc::spacesepstream list(targetstr); - std::string item; - - while (list.GetToken(item)) - AddNick(user, ServerInstance->FindNickOnly(item), reply, pos); - } - } + AddNick(user, u, reply, pos); } + // Last parameter can be a space separated list + irc::spacesepstream ss(parameters.back()); + for (std::string token; ss.GetToken(token); ) + AddNick(user, ServerInstance->FindNickOnly(token), reply, pos); + user->WriteServ(reply); return CMD_SUCCESS; } -- cgit v1.2.3