diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-02-25 00:18:32 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-02-25 00:18:32 +0000 |
commit | c2df23d941f7741be13d8fad277ef3cca9abd7b0 (patch) | |
tree | c0230096f8f914c32654b17613933a5947fdb405 /src/modules | |
parent | ad8705d3f051e98b24ba404fcdd888acd30e13db (diff) |
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
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_spanningtree/treesocket1.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
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)); |