summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/modules/extra/m_rline.cpp6
-rw-r--r--src/modules/m_spanningtree/protocolinterface.cpp43
-rw-r--r--src/modules/m_spanningtree/protocolinterface.h2
3 files changed, 46 insertions, 5 deletions
diff --git a/src/modules/extra/m_rline.cpp b/src/modules/extra/m_rline.cpp
index 545757f59..88e40811b 100644
--- a/src/modules/extra/m_rline.cpp
+++ b/src/modules/extra/m_rline.cpp
@@ -224,12 +224,12 @@ class ModuleRLine : public Module
virtual void OnUserConnect(User* user)
{
// Apply lines on user connect
- XLine *r = ServerInstance->XLines->MatchesLine("R", user);
+ XLine *rl = ServerInstance->XLines->MatchesLine("R", user);
- if (r)
+ if (rl)
{
// Bang. :P
- r->Apply(user);
+ rl->Apply(user);
}
}
};
diff --git a/src/modules/m_spanningtree/protocolinterface.cpp b/src/modules/m_spanningtree/protocolinterface.cpp
index cf774d603..bbdca2305 100644
--- a/src/modules/m_spanningtree/protocolinterface.cpp
+++ b/src/modules/m_spanningtree/protocolinterface.cpp
@@ -42,23 +42,64 @@ void SpanningTreeProtocolInterface::SendTopic(Channel* channel, std::string &top
Utils->DoOneToMany(ServerInstance->Config->GetSID(),"FTOPIC", params);
}
-void SpanningTreeProtocolInterface::SendMode(const std::string &origin, const std::string &target, parameterlist &modedata)
+void SpanningTreeProtocolInterface::SendMode(const std::string &target, parameterlist &modedata)
{
+ if (modedata.empty())
+ return;
+
+ /* 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], modedata[n]);
+
+ std::string uidtarget;
+ ServerInstance->Parser->TranslateUIDs(TR_NICK, target, uidtarget);
+ modedata.insert(modedata.begin(), uidtarget);
+
+ User* a = ServerInstance->FindNick(uidtarget);
+ if (a)
+ {
+ Utils->DoOneToMany(ServerInstance->Config->GetSID(),"MODE",modedata);
+ return;
+ }
+ else
+ {
+ Channel* c = ServerInstance->FindChan(target);
+ if (c)
+ {
+ modedata.insert(modedata.begin() + 1, ConvToStr(c->age));
+ Utils->DoOneToMany(ServerInstance->Config->GetSID(),"FMODE",modedata);
+ }
+ }
}
void SpanningTreeProtocolInterface::SendOperNotice(const std::string &text)
{
+ parameterlist p;
+ p.push_back(":" + text);
+ Utils->DoOneToMany(ServerInstance->Config->GetSID(), "OPERNOTICE", p);
}
void SpanningTreeProtocolInterface::SendModeNotice(const std::string &modes, const std::string &text)
{
+ parameterlist p;
+ p.push_back(modes);
+ p.push_back(":" + text);
+ Utils->DoOneToMany(ServerInstance->Config->GetSID(), "MODENOTICE", p);
}
void SpanningTreeProtocolInterface::SendSNONotice(const std::string &snomask, const std::string &text)
{
+ parameterlist p;
+ p.push_back(snomask);
+ p.push_back(":" + text);
+ Utils->DoOneToMany(ServerInstance->Config->GetSID(), "SNONOTICE", p);
}
void SpanningTreeProtocolInterface::PushToClient(User* target, const std::string &rawline)
{
+ parameterlist p;
+ p.push_back(target->uuid);
+ p.push_back(rawline);
+ Utils->DoOneToOne(ServerInstance->Config->GetSID(), "PUSH", p, target->server);
}
diff --git a/src/modules/m_spanningtree/protocolinterface.h b/src/modules/m_spanningtree/protocolinterface.h
index 568f33463..754e1bf6f 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, int type, const std::string &key, const std::string &data);
virtual void SendTopic(Channel* channel, std::string &topic);
- virtual void SendMode(const std::string &origin, const std::string &target, parameterlist &modedata);
+ virtual void SendMode(const std::string &target, parameterlist &modedata);
virtual void SendOperNotice(const std::string &text);
virtual void SendModeNotice(const std::string &modes, const std::string &text);
virtual void SendSNONotice(const std::string &snomask, const std::string &text);