summaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2021-06-04 01:58:33 +0100
committerSadie Powell <sadie@witchery.services>2021-06-04 02:03:52 +0100
commit722c63ad53dea99829cf010786354e21016aadef (patch)
treefef353397be82e774f387ca15db407a13b16d65b /src/modules/m_spanningtree
parent8ef5c350f08aed38b2d64f8770298baf74f03afe (diff)
Broadcast the limits for list modes on server link.
This allows services to not overflow the limit.
Diffstat (limited to 'src/modules/m_spanningtree')
-rw-r--r--src/modules/m_spanningtree/main.cpp1
-rw-r--r--src/modules/m_spanningtree/netburst.cpp1
-rw-r--r--src/modules/m_spanningtree/utils.cpp22
-rw-r--r--src/modules/m_spanningtree/utils.h3
4 files changed, 27 insertions, 0 deletions
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index 507897a4e..a2a9173eb 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -511,6 +511,7 @@ void ModuleSpanningTree::OnUserJoin(Membership* memb, bool sync, bool created_by
params.add(memb);
params.finalize();
params.Broadcast();
+ Utils->SendListLimits(memb->chan, NULL);
}
else
{
diff --git a/src/modules/m_spanningtree/netburst.cpp b/src/modules/m_spanningtree/netburst.cpp
index ac68efb96..d8ea30060 100644
--- a/src/modules/m_spanningtree/netburst.cpp
+++ b/src/modules/m_spanningtree/netburst.cpp
@@ -258,6 +258,7 @@ void TreeSocket::SyncChannel(Channel* chan, BurstState& bs)
if (chan->topicset != 0)
this->WriteLine(CommandFTopic::Builder(chan));
+ Utils->SendListLimits(chan, this);
SendListModes(chan);
for (Extensible::ExtensibleStore::const_iterator i = chan->GetExtList().begin(); i != chan->GetExtList().end(); i++)
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp
index 809963625..84d96e098 100644
--- a/src/modules/m_spanningtree/utils.cpp
+++ b/src/modules/m_spanningtree/utils.cpp
@@ -25,6 +25,7 @@
#include "inspircd.h"
+#include "listmode.h"
#include "main.h"
#include "utils.h"
@@ -374,3 +375,24 @@ void SpanningTreeUtilities::SendChannelMessage(User* source, Channel* target, co
Sock->WriteLine(msg);
}
}
+
+void SpanningTreeUtilities::SendListLimits(Channel* chan, TreeSocket* sock)
+{
+ std::stringstream buffer;
+ const ModeParser::ListModeList& listmodes = ServerInstance->Modes->GetListModes();
+ for (ModeParser::ListModeList::const_iterator i = listmodes.begin(); i != listmodes.end(); ++i)
+ {
+ ListModeBase* lm = *i;
+ buffer << lm->GetModeChar() << " " << lm->GetLimit(chan) << " ";
+ }
+
+ std::string bufferstr = buffer.str();
+ if (bufferstr.empty())
+ return; // Should never happen.
+
+ bufferstr.erase(bufferstr.end() - 1);
+ if (sock)
+ sock->WriteLine(CommandMetadata::Builder(chan, "maxlist", bufferstr));
+ else
+ CommandMetadata::Builder(chan, "maxlist", bufferstr).Broadcast();
+}
diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h
index 26e6e7c22..262c285ef 100644
--- a/src/modules/m_spanningtree/utils.h
+++ b/src/modules/m_spanningtree/utils.h
@@ -176,6 +176,9 @@ class SpanningTreeUtilities : public classbase
/** Sends a PRIVMSG or a NOTICE to a channel obeying an exempt list and an optional prefix
*/
void SendChannelMessage(User* source, Channel* target, const std::string& text, char status, const ClientProtocol::TagMap& tags, const CUList& exempt_list, const char* message_type, TreeSocket* omit = NULL);
+
+ /** Send the channel list mode limits to either the specified server or all servers if NULL. */
+ void SendListLimits(Channel* chan, TreeSocket* sock = NULL);
};
inline void SpanningTreeUtilities::DoOneToMany(const CmdBuilder& params)