summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-02-09 22:12:27 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-02-09 22:12:27 +0000
commit98d8252abdd0cad70d90e0cdcf50629b6e02b464 (patch)
treec9013591ddd2ccff5a63ad1e3a77d35a4948a54f /src
parent16ba90f0c61c810a900a1d630416d1d24914e134 (diff)
Remove space before first user in FJOIN; also call c->ChanModes less for large channels
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11079 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_spanningtree/netburst.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/modules/m_spanningtree/netburst.cpp b/src/modules/m_spanningtree/netburst.cpp
index 297950792..d53b07258 100644
--- a/src/modules/m_spanningtree/netburst.cpp
+++ b/src/modules/m_spanningtree/netburst.cpp
@@ -84,10 +84,11 @@ void TreeSocket::SendFJoins(TreeServer* Current, Channel* c)
std::string buffer;
char list[MAXBUF];
- size_t dlen, curlen;
- dlen = curlen = snprintf(list,MAXBUF,":%s FJOIN %s %lu +%s :", this->ServerInstance->Config->GetSID().c_str(), c->name.c_str(),(unsigned long)c->age, c->ChanModes(true));
+ size_t curlen, headlen;
+ curlen = headlen = snprintf(list,MAXBUF,":%s FJOIN %s %lu +%s :",
+ this->ServerInstance->Config->GetSID().c_str(), c->name.c_str(), (unsigned long)c->age, c->ChanModes(true));
int numusers = 0;
- char* ptr = list + dlen;
+ char* ptr = list + curlen;
bool looped_once = false;
CUList *ulist = c->GetUsers();
@@ -101,14 +102,16 @@ void TreeSocket::SendFJoins(TreeServer* Current, Channel* c)
if ((curlen + modestr.length() + i->first->uuid.length() + 4) > 480)
{
+ // remove the final space
+ if (ptr[-1] == ' ')
+ ptr[-1] = '\0';
buffer.append(list).append("\r\n");
- dlen = curlen = snprintf(list, MAXBUF, ":%s FJOIN %s %lu +%s :", this->ServerInstance->Config->GetSID().c_str(), c->name.c_str(), (unsigned long)c->age, c->ChanModes(true));
- ptr = list + dlen;
+ curlen = headlen;
+ ptr = list + headlen;
numusers = 0;
}
- // The first parameter gets a : before it
- ptrlen = snprintf(ptr, MAXBUF, " %s,%s", modestr.c_str(), i->first->uuid.c_str());
+ ptrlen = snprintf(ptr, MAXBUF-curlen, "%s,%s ", modestr.c_str(), i->first->uuid.c_str());
looped_once = true;
@@ -121,7 +124,12 @@ void TreeSocket::SendFJoins(TreeServer* Current, Channel* c)
// Okay, permanent channels will (of course) need this \r\n anyway, numusers check is if there
// actually were people in the channel (looped_once == true)
if (!looped_once || numusers > 0)
+ {
+ // remove the final space
+ if (ptr[-1] == ' ')
+ ptr[-1] = '\0';
buffer.append(list).append("\r\n");
+ }
int linesize = 1;
for (BanList::iterator b = c->bans.begin(); b != c->bans.end(); b++)