]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/cmd_names.cpp
FindNick, FindChan, ChanModes, UserList, CountInvisible, PurgeEmptyChannels, GetClass...
[user/henk/code/inspircd.git] / src / cmd_names.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 "inspircd.h"
18 #include "users.h"
19 #include "commands.h"
20 #include "helperfuncs.h"
21 #include "commands/cmd_names.h"
22
23 extern InspIRCd* ServerInstance;
24
25 void cmd_names::Handle (const char** parameters, int pcnt, userrec *user)
26 {
27         chanrec* c;
28
29         if (!pcnt)
30         {
31                 user->WriteServ("366 %s * :End of /NAMES list.",user->nick);
32                 return;
33         }
34
35         if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0))
36                 return;
37
38         c = ServerInstance->FindChan(parameters[0]);
39         if (c)
40         {
41                 if ((c->modes[CM_SECRET]) && (!c->HasUser(user)))
42                 {
43                       user->WriteServ("401 %s %s :No such nick/channel",user->nick, c->name);
44                       return;
45                 }
46                 c->UserList(user);
47                 user->WriteServ("366 %s %s :End of /NAMES list.", user->nick, c->name);
48         }
49         else
50         {
51                 user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]);
52         }
53 }