]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_spanningtree/num.cpp
047dba4322b9826528f3e5c02190ea8e18875a3c
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / num.cpp
1 /*
2  * InspIRCd -- Internet Relay Chat Daemon
3  *
4  *   Copyright (C) 2016 Attila Molnar <attilamolnar@hush.com>
5  *
6  * This file is part of InspIRCd.  InspIRCd is free software: you can
7  * redistribute it and/or modify it under the terms of the GNU General Public
8  * License as published by the Free Software Foundation, version 2.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
13  * details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  */
18
19
20 #include "inspircd.h"
21
22 #include "utils.h"
23 #include "commands.h"
24
25 CmdResult CommandNum::HandleServer(TreeServer* server, std::vector<std::string>& params)
26 {
27         User* const target = ServerInstance->FindUUID(params[1]);
28         if (!target)
29                 return CMD_FAILURE;
30
31         LocalUser* const localtarget = IS_LOCAL(target);
32         if (!localtarget)
33                 return CMD_SUCCESS;
34
35         Numeric::Numeric numeric(ConvToInt(params[2]));
36         // Passing NULL is ok, in that case the numeric source becomes this server
37         numeric.SetServer(Utils->FindServerID(params[0]));
38         numeric.GetParams().insert(numeric.GetParams().end(), params.begin()+3, params.end());
39
40         localtarget->WriteNumeric(numeric);
41         return CMD_SUCCESS;
42 }
43
44 RouteDescriptor CommandNum::GetRouting(User* user, const std::vector<std::string>& params)
45 {
46         return ROUTE_UNICAST(params[1]);
47 }