1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2009 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
15 #include "commands/cmd_ison.h"
17 extern "C" DllExport Command* init_command(InspIRCd* Instance)
19 return new CommandIson(Instance);
24 CmdResult CommandIson::Handle (const std::vector<std::string>& parameters, User *user)
26 std::map<User*,User*> ison_already;
28 std::string reply = std::string("303 ") + user->nick + " :";
30 for (unsigned int i = 0; i < parameters.size(); i++)
32 u = ServerInstance->FindNick(parameters[i]);
33 if (ison_already.find(u) != ison_already.end())
38 reply.append(u->nick).append(" ");
39 if (reply.length() > 450)
41 user->WriteServ(reply);
42 reply = std::string("303 ") + user->nick + " :";
48 if ((i == parameters.size() - 1) && (parameters[i].find(' ') != std::string::npos))
50 /* Its a space seperated list of nicks (RFC1459 says to support this)
52 irc::spacesepstream list(parameters[i]);
55 while (list.GetToken(item))
57 u = ServerInstance->FindNick(item);
58 if (ison_already.find(u) != ison_already.end())
63 reply.append(u->nick).append(" ");
64 if (reply.length() > 450)
66 user->WriteServ(reply);
67 reply = std::string("303 ") + user->nick + " :";
77 user->WriteServ(reply);