diff options
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_spanningtree/encap.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_spanningtree/protocolinterface.cpp | 11 | ||||
-rw-r--r-- | src/modules/m_spanningtree/protocolinterface.h | 1 |
3 files changed, 17 insertions, 1 deletions
diff --git a/src/modules/m_spanningtree/encap.cpp b/src/modules/m_spanningtree/encap.cpp index 12ab2b664..566f15da8 100644 --- a/src/modules/m_spanningtree/encap.cpp +++ b/src/modules/m_spanningtree/encap.cpp @@ -27,8 +27,12 @@ CmdResult CommandEncap::Handle(User* user, std::vector<std::string>& params) if (ServerInstance->Config->GetSID() == params[0] || InspIRCd::Match(ServerInstance->Config->ServerName, params[0])) { parameterlist plist(params.begin() + 2, params.end()); - ServerInstance->Parser->CallHandler(params[1], plist, user); + Command* cmd = NULL; + ServerInstance->Parser->CallHandler(params[1], plist, user, &cmd); // Discard return value, ENCAP shall succeed even if the command does not exist + + if ((cmd) && (cmd->force_manual_route)) + return CMD_FAILURE; } return CMD_SUCCESS; } diff --git a/src/modules/m_spanningtree/protocolinterface.cpp b/src/modules/m_spanningtree/protocolinterface.cpp index ee5e31984..192f7cff2 100644 --- a/src/modules/m_spanningtree/protocolinterface.cpp +++ b/src/modules/m_spanningtree/protocolinterface.cpp @@ -71,6 +71,17 @@ bool SpanningTreeProtocolInterface::SendEncapsulatedData(const std::string& targ return true; } +void SpanningTreeProtocolInterface::BroadcastEncap(const std::string& cmd, const parameterlist& params, User* source, User* omit) +{ + if (!source) + source = ServerInstance->FakeClient; + + // If omit is non-NULL we pass the route belonging to the user to Forward(), + // otherwise we pass NULL, which is equivalent to Broadcast() + TreeServer* server = (omit ? TreeServer::Get(omit)->GetRoute() : NULL); + CmdBuilder(source, "ENCAP * ").push_raw(cmd).insert(params).Forward(server); +} + void SpanningTreeProtocolInterface::SendMetaData(User* u, const std::string& key, const std::string& data) { CommandMetadata::Builder(u, key, data).Broadcast(); diff --git a/src/modules/m_spanningtree/protocolinterface.h b/src/modules/m_spanningtree/protocolinterface.h index 04b56c181..97648f4b4 100644 --- a/src/modules/m_spanningtree/protocolinterface.h +++ b/src/modules/m_spanningtree/protocolinterface.h @@ -32,6 +32,7 @@ class SpanningTreeProtocolInterface : public ProtocolInterface }; bool SendEncapsulatedData(const std::string& targetmask, const std::string& cmd, const parameterlist& params, User* source) CXX11_OVERRIDE; + void BroadcastEncap(const std::string& cmd, const parameterlist& params, User* source, User* omit) CXX11_OVERRIDE; void SendMetaData(User* user, const std::string& key, const std::string& data) CXX11_OVERRIDE; void SendMetaData(Channel* chan, const std::string& key, const std::string& data) CXX11_OVERRIDE; void SendMetaData(const std::string& key, const std::string& data) CXX11_OVERRIDE; |