]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/cmd_join.cpp
Add irc::dynamicbitmask class. Feel free to take a look and offer suggestions, as...
[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/cmd_join.h"
20
21 extern "C" command_t* init_command(InspIRCd* Instance)
22 {
23         return new cmd_join(Instance);
24 }
25
26 /** Handle /JOIN
27  */
28 CmdResult cmd_join::Handle (const char** parameters, int pcnt, userrec *user)
29 {
30         if (pcnt > 1)
31         {
32                 if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0, 1))
33                         return CMD_SUCCESS;
34
35                 if (ServerInstance->IsChannel(parameters[0]))
36                 {
37                         chanrec::JoinUser(ServerInstance, user, parameters[0], false, parameters[1]);
38                         return CMD_SUCCESS;
39                 }
40         }
41         else
42         {
43                 if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0))
44                         return CMD_SUCCESS;
45
46                 if (ServerInstance->IsChannel(parameters[0]))
47                 {
48                         chanrec::JoinUser(ServerInstance, user, parameters[0], false);
49                         return CMD_SUCCESS;
50                 }
51         }
52
53         user->WriteServ("403 %s %s :Invalid channel name",user->nick, parameters[0]);
54         return CMD_FAILURE;
55 }