summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-09-03 14:26:40 +0200
committerAttila Molnar <attilamolnar@hush.com>2014-09-03 14:26:40 +0200
commite7e315fc9dbd37218d55a6673ba65503c0bbcc1b (patch)
treef65d4ea644952b183bd2c231a14002d8cebd9a0e /src/modules
parent2f9dda9b8e6842850ec6b986d23cb6a56e9af547 (diff)
m_spanningtree Send MODE/FMODE from the OnMode hook
If the MODE_LOCALONLY flag is set the mode change is not propagated
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_spanningtree/main.cpp28
-rw-r--r--src/modules/m_spanningtree/main.h1
-rw-r--r--src/modules/m_spanningtree/protocolinterface.cpp18
3 files changed, 29 insertions, 18 deletions
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)