]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Broadcast the limits for list modes on server link.
authorSadie Powell <sadie@witchery.services>
Fri, 4 Jun 2021 00:58:33 +0000 (01:58 +0100)
committerSadie Powell <sadie@witchery.services>
Fri, 4 Jun 2021 01:03:52 +0000 (02:03 +0100)
This allows services to not overflow the limit.

src/modules/m_spanningtree/main.cpp
src/modules/m_spanningtree/netburst.cpp
src/modules/m_spanningtree/utils.cpp
src/modules/m_spanningtree/utils.h

index 507897a4e843a4c26cfc7de3f844394ea873e13f..a2a9173eb48d124f914c96d45e31caeb56aa96dc 100644 (file)
@@ -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
        {
index ac68efb96b4ad12f8c08e601272aef8058a1d19c..d8ea300609744f66dd9d6121cd33e0f55cbac38b 100644 (file)
@@ -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++)
index 8099636251e065648b3167e4fe3cd16371010b1e..84d96e098d3f6025c85f9d8e6d240504ee5ae13f 100644 (file)
@@ -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();
+}
index 26e6e7c22aaaec8dda4b65cb7aadbaa5b9b306d0..262c285efb8811f7853f53209dadc22126d23070 100644 (file)
@@ -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)