2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2018-2019 Sadie Powell <sadie@witchery.services>
5 * Copyright (C) 2016 Attila Molnar <attilamolnar@hush.com>
7 * This file is part of InspIRCd. InspIRCd is free software: you can
8 * redistribute it and/or modify it under the terms of the GNU General Public
9 * License as published by the Free Software Foundation, version 2.
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25 #include "remoteuser.h"
27 CmdResult CommandNum::HandleServer(TreeServer* server, CommandBase::Params& params)
29 User* const target = ServerInstance->FindUUID(params[1]);
33 LocalUser* const localtarget = IS_LOCAL(target);
37 Numeric::Numeric numeric(ConvToNum<unsigned int>(params[2]));
38 // Passing NULL is ok, in that case the numeric source becomes this server
39 numeric.SetServer(Utils->FindServerID(params[0]));
40 numeric.GetParams().insert(numeric.GetParams().end(), params.begin()+3, params.end());
42 localtarget->WriteNumeric(numeric);
46 RouteDescriptor CommandNum::GetRouting(User* user, const Params& params)
48 return ROUTE_UNICAST(params[1]);
51 CommandNum::Builder::Builder(SpanningTree::RemoteUser* target, const Numeric::Numeric& numeric)
54 TreeServer* const server = (numeric.GetServer() ? (static_cast<TreeServer*>(numeric.GetServer())) : Utils->TreeRoot);
55 push(server->GetId()).push(target->uuid).push(InspIRCd::Format("%03u", numeric.GetNumeric()));
56 const CommandBase::Params& params = numeric.GetParams();
59 for (CommandBase::Params::const_iterator i = params.begin(); i != params.end()-1; ++i)
61 push_last(params.back());