summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2016-08-02 10:16:24 +0200
committerGitHub <noreply@github.com>2016-08-02 10:16:24 +0200
commit57b01bc95833f29c660f92d13645e088b0df0df2 (patch)
treec8757af50729c31567d77f73a0166cc68ee0e0e2 /src
parent18fd234f73188f400169cc1473085cfc91c2d170 (diff)
parent5f29158a5b7a892bde7dff26d87f94aacc8beadb (diff)
Merge pull request #1193 from Adam-/insp20+banburst
Fix bursting channel bans
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_spanningtree/netburst.cpp25
-rw-r--r--src/modules/m_spanningtree/treesocket.h2
2 files changed, 16 insertions, 11 deletions
diff --git a/src/modules/m_spanningtree/netburst.cpp b/src/modules/m_spanningtree/netburst.cpp
index d508c092d..3bce90eda 100644
--- a/src/modules/m_spanningtree/netburst.cpp
+++ b/src/modules/m_spanningtree/netburst.cpp
@@ -140,25 +140,28 @@ void TreeSocket::SendFJoins(Channel* c)
buffer.append(list).append("\r\n");
}
- int linesize = 1;
+ unsigned int linesize = 1;
for (BanList::iterator b = c->bans.begin(); b != c->bans.end(); b++)
{
- int size = b->data.length() + 2;
- int currsize = linesize + size;
- if (currsize <= 350)
- {
- modes.append("b");
- params.append(" ").append(b->data);
- linesize += size;
- }
- if ((modes.length() >= ServerInstance->Config->Limits.MaxModes) || (currsize > 350))
+ unsigned int size = b->data.length() + 2; // "b" and " "
+ unsigned int nextsize = linesize + size;
+
+ if ((modes.length() >= ServerInstance->Config->Limits.MaxModes) || (nextsize > FMODE_MAX_LENGTH))
{
- /* Wrap at MAXMODES */
+ /* Wrap */
buffer.append(":").append(ServerInstance->Config->GetSID()).append(" FMODE ").append(c->name).append(" ").append(ConvToStr(c->age)).append(" +").append(modes).append(params).append("\r\n");
+
modes.clear();
params.clear();
linesize = 1;
}
+
+ modes.push_back('b');
+
+ params.push_back(' ');
+ params.append(b->data);
+
+ linesize += size;
}
/* Only send these if there are any */
diff --git a/src/modules/m_spanningtree/treesocket.h b/src/modules/m_spanningtree/treesocket.h
index abda28335..efcce5f7a 100644
--- a/src/modules/m_spanningtree/treesocket.h
+++ b/src/modules/m_spanningtree/treesocket.h
@@ -100,6 +100,8 @@ class TreeSocket : public BufferedSocket
int proto_version; /* Remote protocol version */
bool ConnectionFailureShown; /* Set to true if a connection failure message was shown */
+ static const unsigned int FMODE_MAX_LENGTH = 350;
+
/** Checks if the given servername and sid are both free
*/
bool CheckDuplicate(const std::string& servername, const std::string& sid);