]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/cmd_names.cpp
Holy christ that was a LOT OF SPACES. TABS, USE THEM, LOVE THEM, APPRECIATE THEM...
[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 using namespace std;
18
19 #include "inspircd_config.h"
20 #include "inspircd.h"
21 #include "inspircd_io.h"
22 #include <time.h>
23 #include <string>
24 #ifdef GCC3
25 #include <ext/hash_map>
26 #else
27 #include <hash_map>
28 #endif
29 #include <map>
30 #include <sstream>
31 #include <vector>
32 #include <deque>
33 #include "users.h"
34 #include "ctables.h"
35 #include "globals.h"
36 #include "modules.h"
37 #include "dynamic.h"
38 #include "wildcard.h"
39 #include "message.h"
40 #include "commands.h"
41 #include "mode.h"
42 #include "xline.h"
43 #include "inspstring.h"
44 #include "dnsqueue.h"
45 #include "helperfuncs.h"
46 #include "hashcomp.h"
47 #include "socketengine.h"
48 #include "typedefs.h"
49 #include "command_parse.h"
50 #include "cmd_names.h"
51
52 extern ServerConfig* Config;
53 extern InspIRCd* ServerInstance;
54 extern int MODCOUNT;
55 extern std::vector<Module*> modules;
56 extern std::vector<ircd_module*> factory;
57 extern time_t TIME;
58 extern user_hash clientlist;
59 extern chan_hash chanlist;
60 extern std::vector<userrec*> all_opers;
61 extern std::vector<userrec*> local_users;
62 extern userrec* fd_ref_table[MAX_DESCRIPTORS];
63
64 void cmd_names::Handle (char **parameters, int pcnt, userrec *user)
65 {
66         chanrec* c;
67
68         if (!pcnt)
69         {
70                 WriteServ(user->fd,"366 %s * :End of /NAMES list.",user->nick);
71                 return;
72         }
73
74         if (ServerInstance->Parser->LoopCall(this,parameters,pcnt,user,0,pcnt-1,0))
75                 return;
76         c = FindChan(parameters[0]);
77         if (c)
78         {
79                 if ((c->modes[CM_SECRET]) && (!c->HasUser(user)))
80                 {
81                       WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, c->name);
82                       return;
83                 }
84                 userlist(user,c);
85                 WriteServ(user->fd,"366 %s %s :End of /NAMES list.", user->nick, c->name);
86         }
87         else
88         {
89                 WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, parameters[0]);
90         }
91 }
92
93