summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_autoop.cpp2
-rw-r--r--src/modules/m_banredirect.cpp2
-rw-r--r--src/modules/m_channames.cpp2
-rw-r--r--src/modules/m_devoice.cpp2
-rw-r--r--src/modules/m_messageflood.cpp2
-rw-r--r--src/modules/m_namedmodes.cpp4
-rw-r--r--src/modules/m_ojoin.cpp2
-rw-r--r--src/modules/m_opermodes.cpp2
-rw-r--r--src/modules/m_operprefix.cpp2
-rw-r--r--src/modules/m_repeat.cpp2
-rw-r--r--src/modules/m_rmode.cpp2
-rw-r--r--src/modules/m_services_account.cpp2
-rw-r--r--src/modules/m_spanningtree/fjoin.cpp4
-rw-r--r--src/modules/m_spanningtree/fmode.cpp30
-rw-r--r--src/modules/m_spanningtree/main.cpp29
-rw-r--r--src/modules/m_spanningtree/main.h1
-rw-r--r--src/modules/m_spanningtree/protocolinterface.cpp39
-rw-r--r--src/modules/m_spanningtree/protocolinterface.h3
-rw-r--r--src/modules/m_timedbans.cpp2
19 files changed, 50 insertions, 84 deletions
diff --git a/src/modules/m_autoop.cpp b/src/modules/m_autoop.cpp
index 85b14ba7a..9620a3a06 100644
--- a/src/modules/m_autoop.cpp
+++ b/src/modules/m_autoop.cpp
@@ -123,7 +123,7 @@ class ModuleAutoOp : public Module
for(std::string::size_type i = modeline.length(); i > 1; --i) // we use "i > 1" instead of "i" so we skip the +
modechange.push_back(memb->user->nick);
if(modechange.size() >= 3)
- ServerInstance->SendGlobalMode(modechange, ServerInstance->FakeClient);
+ ServerInstance->Modes->Process(modechange, ServerInstance->FakeClient);
}
}
diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp
index 08b2244d4..a88324fe2 100644
--- a/src/modules/m_banredirect.cpp
+++ b/src/modules/m_banredirect.cpp
@@ -260,7 +260,7 @@ class ModuleBanRedirect : public Module
stackresult.push_back(chan->name);
while (modestack.GetStackedLine(stackresult))
{
- ServerInstance->Modes->Process(stackresult, ServerInstance->FakeClient);
+ ServerInstance->Modes->Process(stackresult, ServerInstance->FakeClient, ModeParser::MODE_LOCALONLY);
stackresult.erase(stackresult.begin() + 1, stackresult.end());
}
}
diff --git a/src/modules/m_channames.cpp b/src/modules/m_channames.cpp
index 52f781ae1..f1a4981c8 100644
--- a/src/modules/m_channames.cpp
+++ b/src/modules/m_channames.cpp
@@ -84,7 +84,7 @@ class ModuleChannelNames : public Module
modes.push_back(c->name);
modes.push_back("-P");
- ServerInstance->SendGlobalMode(modes, ServerInstance->FakeClient);
+ ServerInstance->Modes->Process(modes, ServerInstance->FakeClient);
}
const UserMembList* users = c->GetUsers();
for(UserMembCIter j = users->begin(); j != users->end(); )
diff --git a/src/modules/m_devoice.cpp b/src/modules/m_devoice.cpp
index 64604e90c..889658d20 100644
--- a/src/modules/m_devoice.cpp
+++ b/src/modules/m_devoice.cpp
@@ -46,7 +46,7 @@ class CommandDevoice : public Command
modes.push_back("-v");
modes.push_back(user->nick);
- ServerInstance->SendGlobalMode(modes, ServerInstance->FakeClient);
+ ServerInstance->Modes->Process(modes, ServerInstance->FakeClient);
return CMD_SUCCESS;
}
};
diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp
index 65c3354a9..86296094b 100644
--- a/src/modules/m_messageflood.cpp
+++ b/src/modules/m_messageflood.cpp
@@ -156,7 +156,7 @@ class ModuleMsgFlood : public Module
parameters.push_back(dest->name);
parameters.push_back("+b");
parameters.push_back("*!*@" + user->dhost);
- ServerInstance->SendGlobalMode(parameters, ServerInstance->FakeClient);
+ ServerInstance->Modes->Process(parameters, ServerInstance->FakeClient);
}
const std::string kickMessage = "Channel flood triggered (limit is " + ConvToStr(f->lines) +
diff --git a/src/modules/m_namedmodes.cpp b/src/modules/m_namedmodes.cpp
index 3e27092a7..26b6339a3 100644
--- a/src/modules/m_namedmodes.cpp
+++ b/src/modules/m_namedmodes.cpp
@@ -82,7 +82,7 @@ class CommandProp : public Command
}
}
}
- ServerInstance->SendGlobalMode(modes, src);
+ ServerInstance->Modes->Process(modes, src);
return CMD_SUCCESS;
}
};
@@ -196,7 +196,7 @@ class ModuleNamedModes : public Module
}
}
newparms[1] = modelist;
- ServerInstance->Modes->Process(newparms, source, false);
+ ServerInstance->Modes->Process(newparms, source);
return MOD_RES_DENY;
}
};
diff --git a/src/modules/m_ojoin.cpp b/src/modules/m_ojoin.cpp
index 999cd5b64..4aec2933a 100644
--- a/src/modules/m_ojoin.cpp
+++ b/src/modules/m_ojoin.cpp
@@ -93,7 +93,7 @@ class CommandOjoin : public SplitCommand
modes.push_back(user->nick);
if (op)
modes.push_back(user->nick);
- ServerInstance->SendGlobalMode(modes, ServerInstance->FakeClient);
+ ServerInstance->Modes->Process(modes, ServerInstance->FakeClient);
}
return CMD_SUCCESS;
}
diff --git a/src/modules/m_opermodes.cpp b/src/modules/m_opermodes.cpp
index 5752ff48d..4d4fcd998 100644
--- a/src/modules/m_opermodes.cpp
+++ b/src/modules/m_opermodes.cpp
@@ -67,7 +67,7 @@ class ModuleModesOnOper : public Module
while (ss >> buf)
modes.push_back(buf);
- ServerInstance->SendMode(modes, u);
+ ServerInstance->Modes->Process(modes, u);
}
};
diff --git a/src/modules/m_operprefix.cpp b/src/modules/m_operprefix.cpp
index 9c15cf5b2..0f4cdbea1 100644
--- a/src/modules/m_operprefix.cpp
+++ b/src/modules/m_operprefix.cpp
@@ -108,7 +108,7 @@ class ModuleOperPrefixMode : public Module
for (UCListIter v = user->chans.begin(); v != user->chans.end(); v++)
{
modechange[0] = (*v)->name;
- ServerInstance->SendGlobalMode(modechange, ServerInstance->FakeClient);
+ ServerInstance->Modes->Process(modechange, ServerInstance->FakeClient);
}
}
diff --git a/src/modules/m_repeat.cpp b/src/modules/m_repeat.cpp
index 5be0fd622..86f26016d 100644
--- a/src/modules/m_repeat.cpp
+++ b/src/modules/m_repeat.cpp
@@ -401,7 +401,7 @@ class RepeatModule : public Module
parameters.push_back(memb->chan->name);
parameters.push_back("+b");
parameters.push_back("*!*@" + user->dhost);
- ServerInstance->SendGlobalMode(parameters, ServerInstance->FakeClient);
+ ServerInstance->Modes->Process(parameters, ServerInstance->FakeClient);
}
memb->chan->KickUser(ServerInstance->FakeClient, user, "Repeat flood");
diff --git a/src/modules/m_rmode.cpp b/src/modules/m_rmode.cpp
index 8259d406c..f5e6433bf 100644
--- a/src/modules/m_rmode.cpp
+++ b/src/modules/m_rmode.cpp
@@ -100,7 +100,7 @@ class CommandRMode : public Command
stackresult.push_back(chan->name);
while (modestack.GetStackedLine(stackresult))
{
- ServerInstance->SendMode(stackresult, user);
+ ServerInstance->Modes->Process(stackresult, user);
stackresult.erase(stackresult.begin() + 1, stackresult.end());
}
diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp
index e42c02ff2..123132ca9 100644
--- a/src/modules/m_services_account.cpp
+++ b/src/modules/m_services_account.cpp
@@ -159,7 +159,7 @@ class ModuleServicesAccount : public Module
std::vector<std::string> modechange;
modechange.push_back(user->nick);
modechange.push_back("-r");
- ServerInstance->SendMode(modechange, ServerInstance->FakeClient);
+ ServerInstance->Modes->Process(modechange, ServerInstance->FakeClient, ModeParser::MODE_LOCALONLY);
}
}
diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp
index b25444cda..faf534542 100644
--- a/src/modules/m_spanningtree/fjoin.cpp
+++ b/src/modules/m_spanningtree/fjoin.cpp
@@ -130,7 +130,7 @@ CmdResult CommandFJoin::Handle(const std::vector<std::string>& params, User *src
/* Remember, params[params.size() - 1] is userlist, and we don't want to apply *that* */
modelist.insert(modelist.end(), params.begin()+2, params.end()-1);
- ServerInstance->SendMode(modelist, srcuser);
+ ServerInstance->Modes->Process(modelist, srcuser, ModeParser::MODE_LOCALONLY | ModeParser::MODE_MERGE);
}
irc::modestacker modestack(true);
@@ -222,7 +222,7 @@ void CommandFJoin::ApplyModeStack(User* srcuser, Channel* c, irc::modestacker& s
while (stack.GetStackedLine(stackresult))
{
- ServerInstance->SendMode(stackresult, srcuser);
+ ServerInstance->Modes->Process(stackresult, srcuser, ModeParser::MODE_LOCALONLY);
stackresult.erase(stackresult.begin() + 1, stackresult.end());
}
}
diff --git a/src/modules/m_spanningtree/fmode.cpp b/src/modules/m_spanningtree/fmode.cpp
index 7be904faf..9a72c5f05 100644
--- a/src/modules/m_spanningtree/fmode.cpp
+++ b/src/modules/m_spanningtree/fmode.cpp
@@ -55,23 +55,25 @@ CmdResult CommandFMode::Handle(const std::vector<std::string>& params, User *who
ourTS = user->age;
}
- /* TS is equal or less: Merge the mode changes into ours and pass on.
+ /* If the TS is greater than ours, we drop the mode and don't pass it anywhere.
*/
- if (TS <= ourTS)
- {
- std::vector<std::string> modelist;
- modelist.reserve(params.size()-1);
- /* Insert everything into modelist except the TS (params[1]) */
- modelist.push_back(params[0]);
- modelist.insert(modelist.end(), params.begin()+2, params.end());
+ if (TS > ourTS)
+ return CMD_FAILURE;
- bool merge = (TS == ourTS) && IS_SERVER(who);
- ServerInstance->Modes->Process(modelist, who, merge);
- return CMD_SUCCESS;
- }
- /* If the TS is greater than ours, we drop the mode and dont pass it anywhere.
+ /* TS is equal or less: Merge the mode changes into ours and pass on.
*/
- return CMD_FAILURE;
+ std::vector<std::string> modelist;
+ modelist.reserve(params.size()-1);
+ /* Insert everything into modelist except the TS (params[1]) */
+ modelist.push_back(params[0]);
+ modelist.insert(modelist.end(), params.begin()+2, params.end());
+
+ ModeParser::ModeProcessFlag flags = ModeParser::MODE_LOCALONLY;
+ if ((TS == ourTS) && IS_SERVER(who))
+ flags |= ModeParser::MODE_MERGE;
+
+ ServerInstance->Modes->Process(modelist, who, flags);
+ return CMD_SUCCESS;
}
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index 9af4bfd0c..8c5439fbb 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -77,7 +77,7 @@ void ModuleSpanningTree::init()
I_OnUserMessage, I_OnBackgroundTimer, I_OnUserJoin,
I_OnChangeHost, I_OnChangeName, I_OnChangeIdent, I_OnUserPart, I_OnUnloadModule,
I_OnUserQuit, I_OnUserPostNick, I_OnUserKick, I_OnRehash, I_OnPreRehash,
- I_OnOper, I_OnAddLine, I_OnDelLine, I_OnMode, I_OnLoadModule, I_OnStats,
+ I_OnOper, I_OnAddLine, I_OnDelLine, I_OnLoadModule, I_OnStats,
I_OnSetAway, I_OnPostCommand, I_OnUserConnect, I_OnAcceptConnection
};
ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
@@ -793,33 +793,6 @@ void ModuleSpanningTree::OnDelLine(User* user, XLine *x)
}
}
-void ModuleSpanningTree::OnMode(User* user, void* dest, int target_type, const parameterlist &text, const std::vector<TranslateType> &translate)
-{
- if ((IS_LOCAL(user)) && (user->registered == REG_ALL))
- {
- parameterlist params;
- std::string output_text;
-
- ServerInstance->Parser->TranslateUIDs(translate, text, output_text);
-
- if (target_type == TYPE_USER)
- {
- User* u = (User*)dest;
- params.push_back(u->uuid);
- params.push_back(output_text);
- Utils->DoOneToMany(user->uuid, "MODE", params);
- }
- else
- {
- Channel* c = (Channel*)dest;
- params.push_back(c->name);
- params.push_back(ConvToStr(c->age));
- params.push_back(output_text);
- Utils->DoOneToMany(user->uuid, "FMODE", params);
- }
- }
-}
-
ModResult ModuleSpanningTree::OnSetAway(User* user, const std::string &awaymsg)
{
if (IS_LOCAL(user))
diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h
index 22357aed4..28ebbc373 100644
--- a/src/modules/m_spanningtree/main.h
+++ b/src/modules/m_spanningtree/main.h
@@ -163,7 +163,6 @@ class ModuleSpanningTree : public Module
void OnLine(User* source, const std::string &host, bool adding, char linetype, long duration, const std::string &reason);
void OnAddLine(User *u, XLine *x) CXX11_OVERRIDE;
void OnDelLine(User *u, XLine *x) CXX11_OVERRIDE;
- void OnMode(User* user, void* dest, int target_type, const std::vector<std::string> &text, const std::vector<TranslateType> &translate) CXX11_OVERRIDE;
ModResult OnStats(char statschar, User* user, string_list &results) CXX11_OVERRIDE;
ModResult OnSetAway(User* user, const std::string &awaymsg) CXX11_OVERRIDE;
void ProtoSendMode(void* opaque, TargetTypeFlags target_type, void* target, const std::vector<std::string> &modeline, const std::vector<TranslateType> &translate);
diff --git a/src/modules/m_spanningtree/protocolinterface.cpp b/src/modules/m_spanningtree/protocolinterface.cpp
index 93a138758..ce824fef8 100644
--- a/src/modules/m_spanningtree/protocolinterface.cpp
+++ b/src/modules/m_spanningtree/protocolinterface.cpp
@@ -89,35 +89,28 @@ void SpanningTreeProtocolInterface::SendTopic(Channel* channel, std::string &top
Utils->DoOneToMany(ServerInstance->Config->GetSID(),"FTOPIC", params);
}
-void SpanningTreeProtocolInterface::SendMode(const std::string &target, const parameterlist &modedata, const std::vector<TranslateType> &translate)
+void SpanningTreeProtocolInterface::SendMode(User* source, User* u, Channel* c, const parameterlist& modedata, const std::vector<TranslateType>& translate)
{
- if (modedata.empty())
- return;
-
- std::string outdata;
- ServerInstance->Parser->TranslateUIDs(translate, modedata, outdata);
-
- std::string uidtarget;
- ServerInstance->Parser->TranslateUIDs(TR_NICK, target, uidtarget);
-
- parameterlist outlist;
- outlist.push_back(uidtarget);
- outlist.push_back(outdata);
+ parameterlist params;
- User* a = ServerInstance->FindNick(uidtarget);
- if (a)
+ if (u)
{
- Utils->DoOneToMany(ServerInstance->Config->GetSID(),"MODE",outlist);
- return;
+ if (u->registered != REG_ALL)
+ return;
+
+ params.push_back(u->uuid);
+ params.insert(params.end(), modedata.begin(), modedata.end());
+ Utils->DoOneToMany(source->uuid, "MODE", params);
}
else
{
- Channel* c = ServerInstance->FindChan(target);
- if (c)
- {
- outlist.insert(outlist.begin() + 1, ConvToStr(c->age));
- Utils->DoOneToMany(ServerInstance->Config->GetSID(),"FMODE",outlist);
- }
+ std::string output_text;
+ ServerInstance->Parser->TranslateUIDs(translate, modedata, output_text);
+
+ params.push_back(c->name);
+ params.push_back(ConvToStr(c->age));
+ params.push_back(output_text);
+ Utils->DoOneToMany(source->uuid, "FMODE", params);
}
}
diff --git a/src/modules/m_spanningtree/protocolinterface.h b/src/modules/m_spanningtree/protocolinterface.h
index 80a21c49b..2b4c4371f 100644
--- a/src/modules/m_spanningtree/protocolinterface.h
+++ b/src/modules/m_spanningtree/protocolinterface.h
@@ -25,14 +25,13 @@ class ModuleSpanningTree;
class SpanningTreeProtocolInterface : public ProtocolInterface
{
SpanningTreeUtilities* Utils;
- void SendChannel(Channel* target, char status, const std::string &text);
public:
SpanningTreeProtocolInterface(SpanningTreeUtilities* util) : Utils(util) { }
bool SendEncapsulatedData(const parameterlist &encap);
void SendMetaData(Extensible* target, const std::string &key, const std::string &data);
void SendTopic(Channel* channel, std::string &topic);
- void SendMode(const std::string &target, const parameterlist &modedata, const std::vector<TranslateType> &types);
+ void SendMode(User* source, User* usertarget, Channel* chantarget, const parameterlist& modedata, const std::vector<TranslateType>& types);
void SendSNONotice(const std::string &snomask, const std::string &text);
void PushToClient(User* target, const std::string &rawline);
void SendChannelPrivmsg(Channel* target, char status, const std::string &text);
diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp
index a76d89c82..93245432d 100644
--- a/src/modules/m_timedbans.cpp
+++ b/src/modules/m_timedbans.cpp
@@ -195,7 +195,7 @@ class ModuleTimedBans : public Module
cr->WriteAllExcept(ServerInstance->FakeClient, true, '@', empty, "NOTICE %s :%s", cr->name.c_str(), expiry.c_str());
ServerInstance->PI->SendChannelNotice(cr, '@', expiry);
- ServerInstance->SendGlobalMode(setban, ServerInstance->FakeClient);
+ ServerInstance->Modes->Process(setban, ServerInstance->FakeClient);
}
}
}