*/
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
#include "link.h"
#include "treesocket.h"
#include "commands.h"
+#include "translate.h"
ModuleSpanningTree::ModuleSpanningTree()
: rconnect(this), rsquit(this), map(this)
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)
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;
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)