2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2016 Attila Molnar <attilamolnar@hush.com>
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.
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
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/>.
24 #include "remoteuser.h"
26 CmdResult CommandNum::HandleServer(TreeServer* server, std::vector<std::string>& params)
28 User* const target = ServerInstance->FindUUID(params[1]);
32 LocalUser* const localtarget = IS_LOCAL(target);
36 Numeric::Numeric numeric(ConvToInt(params[2]));
37 // Passing NULL is ok, in that case the numeric source becomes this server
38 numeric.SetServer(Utils->FindServerID(params[0]));
39 numeric.GetParams().insert(numeric.GetParams().end(), params.begin()+3, params.end());
41 localtarget->WriteNumeric(numeric);
45 RouteDescriptor CommandNum::GetRouting(User* user, const std::vector<std::string>& params)
47 return ROUTE_UNICAST(params[1]);
50 CommandNum::Builder::Builder(SpanningTree::RemoteUser* target, const Numeric::Numeric& numeric)
53 TreeServer* const server = (numeric.GetServer() ? (static_cast<TreeServer*>(numeric.GetServer())) : Utils->TreeRoot);
54 push(server->GetID()).push(target->uuid).push(InspIRCd::Format("%03u", numeric.GetNumeric()));
55 const std::vector<std::string>& params = numeric.GetParams();
58 for (std::vector<std::string>::const_iterator i = params.begin(); i != params.end()-1; ++i)
60 push_last(params.back());