1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
19 #include "commands/cmd_list.h"
24 extern "C" command_t* init_command(InspIRCd* Instance)
26 return new cmd_list(Instance);
29 CmdResult cmd_list::Handle (const char** parameters, int pcnt, userrec *user)
31 user->WriteServ("321 %s Channel :Users Name",user->nick);
33 /* Work around mIRC suckyness. YOU SUCK, KHALED! */
34 if ((pcnt == 1) && (*parameters[0] == '<'))
37 for (chan_hash::const_iterator i = ServerInstance->chanlist.begin(); i != ServerInstance->chanlist.end(); i++)
39 // attempt to match a glob pattern
40 if (pcnt && !match(i->second->name, parameters[0]))
42 // if the channel is not private/secret, OR the user is on the channel anyway
43 bool n = i->second->HasUser(user);
44 if (((!(i->second->modes[CM_PRIVATE])) && (!(i->second->modes[CM_SECRET]))) || (n))
46 long users = i->second->GetUserCounter();
48 user->WriteServ("322 %s %s %d :[+%s] %s",user->nick,i->second->name,users,i->second->ChanModes(n),i->second->topic);
51 user->WriteServ("323 %s :End of channel list.",user->nick);