diff options
author | Attila Molnar <attilamolnar@hush.com> | 2015-12-30 13:22:01 +0100 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2015-12-30 13:22:01 +0100 |
commit | ff6e64ec0f57b11cce18f1e5efa55abfb929b592 (patch) | |
tree | d24e36bc2bf607de85ccaacf4c119feb0ffa03bf | |
parent | 0854edb4462ff573c307b900b6138c8fa87efa9d (diff) |
core_ison Simplify handler
-rw-r--r-- | src/coremods/core_ison.cpp | 21 |
1 files 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<std::string>& parameters, User std::string reply = "303 " + user->nick + " :"; const std::string::size_type pos = reply.size(); - for (std::vector<std::string>::const_iterator i = parameters.begin(); i != parameters.end(); ++i) + for (std::vector<std::string>::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; } |