summaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree/netburst.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-05-25 17:30:43 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-05-25 17:30:43 +0000
commit7d7250484c352c13830e63ae41ee8faae40a9bd5 (patch)
tree0fdf4941b4d72469a18eec97506f06f6e94e86e9 /src/modules/m_spanningtree/netburst.cpp
parente7b837ec5f120f928a0dc321fa918bdd01ab0c02 (diff)
First phase of conversion to dynamic limits on all the lengths, configured via the <limits> 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
Diffstat (limited to 'src/modules/m_spanningtree/netburst.cpp')
-rw-r--r--src/modules/m_spanningtree/netburst.cpp24
1 files changed, 13 insertions, 11 deletions
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");