]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/cmd_join.cpp
Passing invalid instance to dns isnt a good idea
[user/henk/code/inspircd.git] / src / cmd_join.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_join.h"
22
23 extern InspIRCd* ServerInstance;
24
25 void cmd_join::Handle (const char** parameters, int pcnt, userrec *user)
26 {
27         if (pcnt > 1)
28         {
29                 if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0, 1))
30                         return;
31
32                 if (IsValidChannelName(parameters[0]))
33                 {
34                         chanrec::JoinUser(ServerInstance, user, parameters[0], false, parameters[1]);
35                         return;
36                 }
37         }
38         else
39         {
40                 if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0))
41                         return;
42
43                 if (IsValidChannelName(parameters[0]))
44                 {
45                         chanrec::JoinUser(ServerInstance, user, parameters[0], false);
46                         return;
47                 }
48         }
49
50         user->WriteServ("403 %s %s :Invalid channel name",user->nick, parameters[0]);
51 }