aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/m_spanningtree/main.cpp
diff options
context:
space:
mode:
authorGravatar Attila Molnar2014-09-03 14:26:40 +0200
committerGravatar Attila Molnar2014-09-03 14:26:40 +0200
commite7e315fc9dbd37218d55a6673ba65503c0bbcc1b (patch)
treef65d4ea644952b183bd2c231a14002d8cebd9a0e /src/modules/m_spanningtree/main.cpp
parentm_spanningtree Add function to serialize parameters in a Modes::ChangeList::L... (diff)
downloadinspircd++-e7e315fc9dbd37218d55a6673ba65503c0bbcc1b.tar.gz
inspircd++-e7e315fc9dbd37218d55a6673ba65503c0bbcc1b.tar.bz2
inspircd++-e7e315fc9dbd37218d55a6673ba65503c0bbcc1b.zip
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/m_spanningtree/main.cpp')
-rw-r--r--src/modules/m_spanningtree/main.cpp28
1 files changed, 28 insertions, 0 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)