]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/cmd_list.cpp
388aead673f0b259cb31e05d124d2cbfb110ff78
[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 "cmd_list.h"
22
23 extern chan_hash chanlist;
24
25 void cmd_list::Handle (char **parameters, int pcnt, userrec *user)
26 {
27         WriteServ(user->fd,"321 %s Channel :Users Name",user->nick);
28         for (chan_hash::const_iterator i = chanlist.begin(); i != chanlist.end(); i++)
29         {
30                 // if the channel is not private/secret, OR the user is on the channel anyway
31                 bool n = i->second->HasUser(user);
32                 if (((!(i->second->modes[CM_PRIVATE])) && (!(i->second->modes[CM_SECRET]))) || (n))
33                 {
34                         long users = usercount(i->second);
35                         if (users)
36                                 WriteServ(user->fd,"322 %s %s %d :[+%s] %s",user->nick,i->second->name,users,chanmodes(i->second,n),i->second->topic);
37                 }
38         }
39         WriteServ(user->fd,"323 %s :End of channel list.",user->nick);
40 }