1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 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 * ---------------------------------------------------
16 #include "commands/cmd_ison.h"
18 extern "C" DllExport command_t* init_command(InspIRCd* Instance)
20 return new cmd_ison(Instance);
25 CmdResult cmd_ison::Handle (const char** parameters, int pcnt, userrec *user)
27 std::map<userrec*,userrec*> ison_already;
29 std::string reply = std::string("303 ") + user->nick + " :";
31 for (int i = 0; i < pcnt; i++)
33 u = ServerInstance->FindNick(parameters[i]);
34 if (ison_already.find(u) != ison_already.end())
39 if (u->Visibility && !u->Visibility->VisibleTo(user))
42 reply.append(u->nick).append(" ");
43 if (reply.length() > 450)
45 user->WriteServ(reply);
46 reply = std::string("303 ") + user->nick + " :";
52 if ((i == pcnt-1) && (strchr(parameters[i],' ')))
54 /* Its a space seperated list of nicks (RFC1459 says to support this)
56 irc::spacesepstream list(parameters[i]);
59 while (list.GetToken(item))
61 u = ServerInstance->FindNick(item);
62 if (ison_already.find(u) != ison_already.end())
67 if (u->Visibility && !u->Visibility->VisibleTo(user))
70 reply.append(u->nick).append(" ");
71 if (reply.length() > 450)
73 user->WriteServ(reply);
74 reply = std::string("303 ") + user->nick + " :";
84 user->WriteServ(reply);