]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/cmd_list.cpp
ded20d077bc9bbcc34652a531ab80470f93c8bad
[user/henk/code/inspircd.git] / src / cmd_list.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
6  *                       E-mail:
7  *                <brain@chatspike.net>
8  *                <Craig@chatspike.net>
9  *
10  * Written by Craig Edwards, Craig McLure, and others.
11  * This program is free but copyrighted software; see
12  *            the file COPYING for details.
13  *
14  * ---------------------------------------------------
15  */
16
17 #include "users.h"
18 #include "ctables.h"
19 #include "commands.h"
20 #include "helperfuncs.h"
21 #include "inspircd.h"
22 #include "commands/cmd_list.h"
23
24 extern InspIRCd* ServerInstance;
25
26 void cmd_list::Handle (const char** parameters, int pcnt, userrec *user)
27 {
28         user->WriteServ("321 %s Channel :Users Name",user->nick);
29         for (chan_hash::const_iterator i = ServerInstance->chanlist.begin(); i != ServerInstance->chanlist.end(); i++)
30         {
31                 // if the channel is not private/secret, OR the user is on the channel anyway
32                 bool n = i->second->HasUser(user);
33                 if (((!(i->second->modes[CM_PRIVATE])) && (!(i->second->modes[CM_SECRET]))) || (n))
34                 {
35                         long users = i->second->GetUserCounter();
36                         if (users)
37                                 user->WriteServ("322 %s %s %d :[+%s] %s",user->nick,i->second->name,users,i->second->ChanModes(n),i->second->topic);
38                 }
39         }
40         user->WriteServ("323 %s :End of channel list.",user->nick);
41 }