From 7d7250484c352c13830e63ae41ee8faae40a9bd5 Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 25 May 2008 17:30:43 +0000 Subject: First phase of conversion to dynamic limits on all the lengths, configured via the tag (the tag isnt there yet, these all just run on defaults in the class constructor) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9802 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree/netburst.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'src/modules/m_spanningtree/netburst.cpp') diff --git a/src/modules/m_spanningtree/netburst.cpp b/src/modules/m_spanningtree/netburst.cpp index 8444bbec6..793a3cf9a 100644 --- a/src/modules/m_spanningtree/netburst.cpp +++ b/src/modules/m_spanningtree/netburst.cpp @@ -96,8 +96,19 @@ void TreeSocket::SendFJoins(TreeServer* Current, Channel* c) for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++) { + size_t ptrlen = 0; + std::string modestr = this->Instance->Modes->ModeString(i->first, c, false); + + if ((curlen + modestr.length() + i->first->uuid.length() + 4) > 480) + { + buffer.append(list).append("\r\n"); + dlen = curlen = snprintf(list, MAXBUF, ":%s FJOIN %s %lu +%s", this->Instance->Config->GetSID().c_str(), c->name.c_str(), (unsigned long)c->age, c->ChanModes(true)); + ptr = list + dlen; + numusers = 0; + } + // The first parameter gets a : before it - size_t ptrlen = snprintf(ptr, MAXBUF, " %s%s,%s", !numusers ? ":" : "", this->Instance->Modes->ModeString(i->first, c, false).c_str(), i->first->uuid.c_str()); + ptrlen = snprintf(ptr, MAXBUF, " %s%s,%s", !numusers ? ":" : "", modestr.c_str(), i->first->uuid.c_str()); looped_once = true; @@ -105,15 +116,6 @@ void TreeSocket::SendFJoins(TreeServer* Current, Channel* c) ptr += ptrlen; numusers++; - - if (curlen > (480-NICKMAX)) - { - buffer.append(list).append("\r\n"); - dlen = curlen = snprintf(list,MAXBUF,":%s FJOIN %s %lu +%s", this->Instance->Config->GetSID().c_str(), c->name.c_str(), (unsigned long)c->age, c->ChanModes(true)); - ptr = list + dlen; - ptrlen = 0; - numusers = 0; - } } // Okay, permanent channels will (of course) need this \r\n anyway, numusers check is if there @@ -132,7 +134,7 @@ void TreeSocket::SendFJoins(TreeServer* Current, Channel* c) params.append(" ").append(b->data); linesize += size; } - if ((params.length() >= MAXMODES) || (currsize > 350)) + if ((params.length() >= Instance->Config->Limits.MaxModes) || (currsize > 350)) { /* Wrap at MAXMODES */ buffer.append(":").append(this->Instance->Config->GetSID()).append(" FMODE ").append(c->name).append(" ").append(ConvToStr(c->age)).append(" +").append(modes).append(params).append("\r\n"); -- cgit v1.3.1-10-gc9f91