1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2008 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/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 if (u->Visibility && !u->Visibility->VisibleTo(user))
41 reply.append(u->nick).append(" ");
42 if (reply.length() > 450)
44 user->WriteServ(reply);
45 reply = std::string("303 ") + user->nick + " :";
51 if ((i == parameters.size() - 1) && (parameters[i].find(' ') != std::string::npos))
53 /* Its a space seperated list of nicks (RFC1459 says to support this)
55 irc::spacesepstream list(parameters[i]);
58 while (list.GetToken(item))
60 u = ServerInstance->FindNick(item);
61 if (ison_already.find(u) != ison_already.end())
66 if (u->Visibility && !u->Visibility->VisibleTo(user))
69 reply.append(u->nick).append(" ");
70 if (reply.length() > 450)
72 user->WriteServ(reply);
73 reply = std::string("303 ") + user->nick + " :";
83 user->WriteServ(reply);