summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_opermodes.cpp6
-rw-r--r--src/modules/m_samode.cpp15
-rw-r--r--src/modules/m_spanningtree/main.cpp4
-rw-r--r--src/modules/m_spanningtree/main.h4
-rw-r--r--src/modules/m_spanningtree/protocolinterface.cpp21
-rw-r--r--src/modules/m_spanningtree/protocolinterface.h2
6 files changed, 21 insertions, 31 deletions
diff --git a/src/modules/m_opermodes.cpp b/src/modules/m_opermodes.cpp
index 2e947809a..f72f007c4 100644
--- a/src/modules/m_opermodes.cpp
+++ b/src/modules/m_opermodes.cpp
@@ -109,10 +109,14 @@ class ModuleModesOnOper : public Module
}
std::deque<std::string> n;
+ std::deque<TranslateType> t;
for (unsigned int j = 1; j < tokens.size(); j++)
+ {
n.push_back(modes[j]);
+ t.push_back(TR_TEXT);
+ }
- ServerInstance->PI->SendMode(u->uuid, n);
+ ServerInstance->PI->SendMode(u->uuid, n, t);
ServerInstance->SendMode(modes, u);
}
};
diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp
index 82055dad3..fdc107466 100644
--- a/src/modules/m_samode.cpp
+++ b/src/modules/m_samode.cpp
@@ -37,20 +37,9 @@ class CommandSamode : public Command
{
ServerInstance->SNO->WriteToSnoMask('A', std::string(user->nick) + " used SAMODE: " + ServerInstance->Modes->GetLastParse());
- std::deque<std::string> n;
- irc::spacesepstream spaced(ServerInstance->Modes->GetLastParse());
- std::string one;
- while (spaced.GetToken(one))
- n.push_back(one);
+ std::string channel = parameters[0];
+ ServerInstance->PI->SendMode(channel, ServerInstance->Modes->GetLastParseParams(), ServerInstance->Modes->GetLastParseTranslate());
- std::string channel = n[0];
- n.pop_front();
- ServerInstance->PI->SendMode(channel, n);
-
- /* XXX: Yes, this is right. We dont want to propagate the
- * actual SAMODE command, just the MODE command generated
- * by the Protocol Interface
- */
return CMD_LOCALONLY;
}
else
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index 51a9eb025..3d2056eb6 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -800,7 +800,7 @@ void ModuleSpanningTree::OnDelLine(User* user, XLine *x)
}
}
-void ModuleSpanningTree::OnMode(User* user, void* dest, int target_type, const std::string &text, const std::vector<TranslateType> &translate)
+void ModuleSpanningTree::OnMode(User* user, void* dest, int target_type, const std::deque<std::string> &text, const std::deque<TranslateType> &translate)
{
if ((IS_LOCAL(user)) && (user->registered == REG_ALL))
{
@@ -851,7 +851,7 @@ int ModuleSpanningTree::OnSetAway(User* user, const std::string &awaymsg)
return 0;
}
-void ModuleSpanningTree::ProtoSendMode(void* opaque, TargetTypeFlags target_type, void* target, const std::string &modeline, const std::vector<TranslateType> &translate)
+void ModuleSpanningTree::ProtoSendMode(void* opaque, TargetTypeFlags target_type, void* target, const std::deque<std::string> &modeline, const std::deque<TranslateType> &translate)
{
TreeSocket* s = (TreeSocket*)opaque;
std::string output_text;
diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h
index 19ec2d43c..a0900dd33 100644
--- a/src/modules/m_spanningtree/main.h
+++ b/src/modules/m_spanningtree/main.h
@@ -174,10 +174,10 @@ class ModuleSpanningTree : public Module
void OnLine(User* source, const std::string &host, bool adding, char linetype, long duration, const std::string &reason);
virtual void OnAddLine(User *u, XLine *x);
virtual void OnDelLine(User *u, XLine *x);
- virtual void OnMode(User* user, void* dest, int target_type, const std::string &text, const std::vector<TranslateType> &translate);
+ virtual void OnMode(User* user, void* dest, int target_type, const std::deque<std::string> &text, const std::deque<TranslateType> &translate);
virtual int OnStats(char statschar, User* user, string_list &results);
virtual int OnSetAway(User* user, const std::string &awaymsg);
- virtual void ProtoSendMode(void* opaque, TargetTypeFlags target_type, void* target, const std::string &modeline, const std::vector<TranslateType> &translate);
+ virtual void ProtoSendMode(void* opaque, TargetTypeFlags target_type, void* target, const std::deque<std::string> &modeline, const std::deque<TranslateType> &translate);
virtual void ProtoSendMetaData(void* opaque, TargetTypeFlags target_type, void* target, const std::string &extname, const std::string &extdata);
virtual void OnEvent(Event* event);
virtual void OnLoadModule(Module* mod,const std::string &name);
diff --git a/src/modules/m_spanningtree/protocolinterface.cpp b/src/modules/m_spanningtree/protocolinterface.cpp
index 9f32963a0..cfc9bbea7 100644
--- a/src/modules/m_spanningtree/protocolinterface.cpp
+++ b/src/modules/m_spanningtree/protocolinterface.cpp
@@ -68,28 +68,25 @@ void SpanningTreeProtocolInterface::SendTopic(Channel* channel, std::string &top
Utils->DoOneToMany(ServerInstance->Config->GetSID(),"FTOPIC", params);
}
-void SpanningTreeProtocolInterface::SendMode(const std::string &target, parameterlist &modedata)
+void SpanningTreeProtocolInterface::SendMode(const std::string &target, const parameterlist &modedata, const std::deque<TranslateType> &translate)
{
if (modedata.empty())
return;
std::string outdata;
-
- /* Warning: in-place translation is only safe for type TR_NICK */
- for (size_t n = 0; n < modedata.size(); n++)
- {
- ServerInstance->Parser->TranslateUIDs(TR_NICK, modedata[n], outdata);
- modedata[n] = outdata;
- }
+ ServerInstance->Parser->TranslateUIDs(translate, modedata, outdata);
std::string uidtarget;
ServerInstance->Parser->TranslateUIDs(TR_NICK, target, uidtarget);
- modedata.insert(modedata.begin(), uidtarget);
+
+ parameterlist outlist;
+ outlist.push_back(uidtarget);
+ outlist.push_back(outdata);
User* a = ServerInstance->FindNick(uidtarget);
if (a)
{
- Utils->DoOneToMany(ServerInstance->Config->GetSID(),"MODE",modedata);
+ Utils->DoOneToMany(ServerInstance->Config->GetSID(),"MODE",outlist);
return;
}
else
@@ -97,8 +94,8 @@ void SpanningTreeProtocolInterface::SendMode(const std::string &target, paramete
Channel* c = ServerInstance->FindChan(target);
if (c)
{
- modedata.insert(modedata.begin() + 1, ConvToStr(c->age));
- Utils->DoOneToMany(ServerInstance->Config->GetSID(),"FMODE",modedata);
+ outlist.insert(outlist.begin() + 1, ConvToStr(c->age));
+ Utils->DoOneToMany(ServerInstance->Config->GetSID(),"FMODE",outlist);
}
}
}
diff --git a/src/modules/m_spanningtree/protocolinterface.h b/src/modules/m_spanningtree/protocolinterface.h
index 50db7bf05..24b0cee20 100644
--- a/src/modules/m_spanningtree/protocolinterface.h
+++ b/src/modules/m_spanningtree/protocolinterface.h
@@ -16,7 +16,7 @@ class SpanningTreeProtocolInterface : public ProtocolInterface
virtual void SendEncapsulatedData(parameterlist &encap);
virtual void SendMetaData(void* target, TargetTypeFlags type, const std::string &key, const std::string &data);
virtual void SendTopic(Channel* channel, std::string &topic);
- virtual void SendMode(const std::string &target, parameterlist &modedata);
+ virtual void SendMode(const std::string &target, const parameterlist &modedata, const std::deque<TranslateType> &types);
virtual void SendModeNotice(const std::string &modes, const std::string &text);
virtual void SendSNONotice(const std::string &snomask, const std::string &text);
virtual void PushToClient(User* target, const std::string &rawline);