]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_spanningtree/svsjoin.cpp
...because every now and again, i have to do a massive commit.
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / svsjoin.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2010 InspIRCd Development Team
6  * See: http://wiki.inspircd.org/Credits
7  *
8  * This program is free but copyrighted software; see
9  *            the file COPYING for details.
10  *
11  * ---------------------------------------------------
12  */
13
14 #include "inspircd.h"
15 #include "socket.h"
16 #include "xline.h"
17 #include "socketengine.h"
18
19 #include "main.h"
20 #include "utils.h"
21 #include "treeserver.h"
22 #include "commands.h"
23
24 CmdResult CommandSVSJoin::Handle(const std::vector<std::string>& parameters, User *user)
25 {
26         // Check for valid channel name
27         if (!ServerInstance->IsChannel(parameters[1].c_str(), ServerInstance->Config->Limits.ChanMax))
28                 return CMD_FAILURE;
29
30         // Check target exists
31         User* u = ServerInstance->FindNick(parameters[0]);
32         if (!u)
33                 return CMD_FAILURE;
34
35         /* only join if it's local, otherwise just pass it on! */
36         if (IS_LOCAL(u))
37                 Channel::JoinUser(u, parameters[1].c_str(), false, "", false, ServerInstance->Time());
38         return CMD_SUCCESS;
39 }
40
41 RouteDescriptor CommandSVSJoin::GetRouting(User* user, const std::vector<std::string>& parameters)
42 {
43         User* u = ServerInstance->FindNick(parameters[0]);
44         if (u)
45                 return ROUTE_OPT_UCAST(u->server);
46         return ROUTE_LOCALONLY;
47 }