From c2df23d941f7741be13d8fad277ef3cca9abd7b0 Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 25 Feb 2007 00:18:32 +0000 Subject: Bans are bursted using a large string buffer to save on write() calls, so the way we handle clamping the ban sending to 350 chars is slightly different than the changes just made to modestacker. works he same though. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6610 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree/treesocket1.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp index c17f8d0f6..81fbda871 100644 --- a/src/modules/m_spanningtree/treesocket1.cpp +++ b/src/modules/m_spanningtree/treesocket1.cpp @@ -1256,16 +1256,24 @@ void TreeSocket::SendFJoins(TreeServer* Current, chanrec* c) modes.append("+"); } + int linesize = 1; for (BanList::iterator b = c->bans.begin(); b != c->bans.end(); b++) { - modes.append("b"); - params.append(" ").append(b->data); - if (params.length() >= MAXMODES) + int size = strlen(b->data) + 2; + int currsize = linesize + size; + if (currsize <= 350) + { + modes.append("b"); + params.append(" ").append(b->data); + linesize += size; + } + if ((params.length() >= MAXMODES) || (currsize > 350)) { /* Wrap at MAXMODES */ buffer.append(":").append(this->Instance->Config->ServerName).append(" FMODE ").append(c->name).append(" ").append(ConvToStr(c->age)).append(" +").append(modes).append(params).append("\r\n"); modes = ""; params = ""; + linesize = 1; } } buffer.append(":").append(this->Instance->Config->ServerName).append(" FMODE ").append(c->name).append(" ").append(ConvToStr(c->age)).append(" +").append(c->ChanModes(true)); -- cgit v1.2.3