diff options
author | Attila Molnar <attilamolnar@hush.com> | 2016-03-29 16:28:01 +0200 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2016-03-29 16:28:01 +0200 |
commit | a7dedb347b7dcd26ce93d4af81e77cfa3cf82d0f (patch) | |
tree | 391004f3fcf9eab6486a9758f38254b0b9cb828d /src/modules/m_spanningtree/num.cpp | |
parent | ccc99fa8f4766d60e87bb0ac58be2ce8e77e34ef (diff) |
m_spanningtree Add NUM command handler
Diffstat (limited to 'src/modules/m_spanningtree/num.cpp')
-rw-r--r-- | src/modules/m_spanningtree/num.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/modules/m_spanningtree/num.cpp b/src/modules/m_spanningtree/num.cpp new file mode 100644 index 000000000..047dba432 --- /dev/null +++ b/src/modules/m_spanningtree/num.cpp @@ -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]); +} |