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_list.h"
21 extern "C" command_t* init_command(InspIRCd* Instance)
23 return new cmd_list(Instance);
26 CmdResult cmd_list::Handle (const char** parameters, int pcnt, userrec *user)
28 user->WriteServ("321 %s Channel :Users Name",user->nick);
30 /* Work around mIRC suckyness. YOU SUCK, KHALED! */
31 if ((pcnt == 1) && (*parameters[0] == '<'))
34 for (chan_hash::const_iterator i = ServerInstance->chanlist->begin(); i != ServerInstance->chanlist->end(); i++)
36 // attempt to match a glob pattern
37 if (pcnt && !match(i->second->name, parameters[0]))
39 // if the channel is not private/secret, OR the user is on the channel anyway
40 bool n = i->second->HasUser(user);
41 if ((i->second->modes[CM_PRIVATE]) && (!n))
43 long users = i->second->GetUserCounter();
45 user->WriteServ("322 %s *",user->nick,i->second->name);
49 if (((!(i->second->modes[CM_PRIVATE])) && (!(i->second->modes[CM_SECRET]))) || (n))
51 long users = i->second->GetUserCounter();
53 user->WriteServ("322 %s %s %d :[+%s] %s",user->nick,i->second->name,users,i->second->ChanModes(n),i->second->topic);
57 user->WriteServ("323 %s :End of channel list.",user->nick);