diff options
-rw-r--r-- | include/mode.h | 4 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.cpp | 28 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.h | 1 | ||||
-rw-r--r-- | src/modules/m_spanningtree/protocolinterface.cpp | 18 |
4 files changed, 31 insertions, 20 deletions
diff --git a/include/mode.h b/include/mode.h index 981c29a27..5bf8dc204 100644 --- a/include/mode.h +++ b/include/mode.h @@ -608,8 +608,8 @@ class CoreExport ModeParser : public fakederef<ModeParser> */ MODE_MERGE = 1, - /** If this flag is set then the mode change won't be handed over to - * the linking module to be sent to other servers, but will be processed + /** If this flag is set then the linking module will ignore the mode change + * and not send it to other servers. The mode change will be processed * locally and sent to local user(s) as usual. */ MODE_LOCALONLY = 2 diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 74bbf0b8a..c21064683 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -33,6 +33,7 @@ #include "link.h" #include "treesocket.h" #include "commands.h" +#include "translate.h" ModuleSpanningTree::ModuleSpanningTree() : rconnect(this), rsquit(this), map(this) @@ -751,6 +752,33 @@ ModResult ModuleSpanningTree::OnSetAway(User* user, const std::string &awaymsg) return MOD_RES_PASSTHRU; } +void ModuleSpanningTree::OnMode(User* source, User* u, Channel* c, const Modes::ChangeList& modes, ModeParser::ModeProcessFlag processflags, const std::string& output_mode) +{ + if (processflags & ModeParser::MODE_LOCALONLY) + return; + + if (u) + { + if (u->registered != REG_ALL) + return; + + CmdBuilder params(source, "MODE"); + params.push(u->uuid); + params.push(output_mode); + params.push_raw(Translate::ModeChangeListToParams(modes.getlist())); + params.Broadcast(); + } + else + { + CmdBuilder params(source, "FMODE"); + params.push(c->name); + params.push_int(c->age); + params.push(output_mode); + params.push_raw(Translate::ModeChangeListToParams(modes.getlist())); + params.Broadcast(); + } +} + CullResult ModuleSpanningTree::cull() { if (Utils) diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h index 09a42ff0d..c81eb2d0b 100644 --- a/src/modules/m_spanningtree/main.h +++ b/src/modules/m_spanningtree/main.h @@ -168,6 +168,7 @@ class ModuleSpanningTree : public Module void OnLoadModule(Module* mod) CXX11_OVERRIDE; void OnUnloadModule(Module* mod) CXX11_OVERRIDE; ModResult OnAcceptConnection(int newsock, ListenSocket* from, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server) CXX11_OVERRIDE; + void OnMode(User* source, User* u, Channel* c, const Modes::ChangeList& modes, ModeParser::ModeProcessFlag processflags, const std::string& output_mode) CXX11_OVERRIDE; CullResult cull(); ~ModuleSpanningTree(); Version GetVersion() CXX11_OVERRIDE; diff --git a/src/modules/m_spanningtree/protocolinterface.cpp b/src/modules/m_spanningtree/protocolinterface.cpp index 192f7cff2..3ad75a430 100644 --- a/src/modules/m_spanningtree/protocolinterface.cpp +++ b/src/modules/m_spanningtree/protocolinterface.cpp @@ -109,24 +109,6 @@ void SpanningTreeProtocolInterface::SendTopic(Channel* channel, std::string &top void SpanningTreeProtocolInterface::SendMode(User* source, User* u, Channel* c, const std::vector<std::string>& modedata, const std::vector<TranslateType>& translate) { - if (u) - { - if (u->registered != REG_ALL) - return; - - CmdBuilder params(source, "MODE"); - params.push_back(u->uuid); - params.insert(modedata); - params.Broadcast(); - } - else - { - CmdBuilder params(source, "FMODE"); - params.push_back(c->name); - params.push_back(ConvToStr(c->age)); - params.push_back(CommandParser::TranslateUIDs(translate, modedata)); - params.Broadcast(); - } } void SpanningTreeProtocolInterface::SendSNONotice(char snomask, const std::string &text) |