mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 11:09:04 -04:00
m_spanningtree Add NUM command handler
This commit is contained in:
parent
ccc99fa8f4
commit
a7dedb347b
@ -369,6 +369,14 @@ class CommandSInfo : public ServerOnlyServerCommand<CommandSInfo>
|
||||
};
|
||||
};
|
||||
|
||||
class CommandNum : public ServerOnlyServerCommand<CommandNum>
|
||||
{
|
||||
public:
|
||||
CommandNum(Module* Creator) : ServerOnlyServerCommand<CommandNum>(Creator, "NUM", 3) { }
|
||||
CmdResult HandleServer(TreeServer* server, std::vector<std::string>& parameters);
|
||||
RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters);
|
||||
};
|
||||
|
||||
class SpanningTreeCommands
|
||||
{
|
||||
public:
|
||||
@ -401,5 +409,6 @@ class SpanningTreeCommands
|
||||
CommandSNONotice snonotice;
|
||||
CommandEndBurst endburst;
|
||||
CommandSInfo sinfo;
|
||||
CommandNum num;
|
||||
SpanningTreeCommands(ModuleSpanningTree* module);
|
||||
};
|
||||
|
@ -52,7 +52,7 @@ SpanningTreeCommands::SpanningTreeCommands(ModuleSpanningTree* module)
|
||||
away(module), addline(module), delline(module), encap(module), idle(module),
|
||||
nick(module), ping(module), pong(module), push(module), save(module),
|
||||
server(module), squit(module), snonotice(module),
|
||||
endburst(module), sinfo(module)
|
||||
endburst(module), sinfo(module), num(module)
|
||||
{
|
||||
}
|
||||
|
||||
|
47
src/modules/m_spanningtree/num.cpp
Normal file
47
src/modules/m_spanningtree/num.cpp
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* InspIRCd -- Internet Relay Chat Daemon
|
||||
*
|
||||
* Copyright (C) 2016 Attila Molnar <attilamolnar@hush.com>
|
||||
*
|
||||
* This file is part of InspIRCd. InspIRCd is free software: you can
|
||||
* redistribute it and/or modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation, version 2.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "inspircd.h"
|
||||
|
||||
#include "utils.h"
|
||||
#include "commands.h"
|
||||
|
||||
CmdResult CommandNum::HandleServer(TreeServer* server, std::vector<std::string>& params)
|
||||
{
|
||||
User* const target = ServerInstance->FindUUID(params[1]);
|
||||
if (!target)
|
||||
return CMD_FAILURE;
|
||||
|
||||
LocalUser* const localtarget = IS_LOCAL(target);
|
||||
if (!localtarget)
|
||||
return CMD_SUCCESS;
|
||||
|
||||
Numeric::Numeric numeric(ConvToInt(params[2]));
|
||||
// Passing NULL is ok, in that case the numeric source becomes this server
|
||||
numeric.SetServer(Utils->FindServerID(params[0]));
|
||||
numeric.GetParams().insert(numeric.GetParams().end(), params.begin()+3, params.end());
|
||||
|
||||
localtarget->WriteNumeric(numeric);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
RouteDescriptor CommandNum::GetRouting(User* user, const std::vector<std::string>& params)
|
||||
{
|
||||
return ROUTE_UNICAST(params[1]);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user