summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-03-11 00:36:29 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-03-11 00:36:29 +0000
commit026cb652a9433ea057b825efb8c9fd53a024e9ff (patch)
tree5830f3c454885b756cbd548a4c1c945512b3e4ce /src
parent3ec64762d8fe2731e4403ab3d633f2bee2e3799a (diff)
Tweaked to use the same system as nenolod's NAMES patch for FJOIN
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3650 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_spanningtree.cpp31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp
index 686ec727c..2abefa974 100644
--- a/src/modules/m_spanningtree.cpp
+++ b/src/modules/m_spanningtree.cpp
@@ -1177,8 +1177,11 @@ class TreeSocket : public InspSocket
log(DEBUG,"Sending FJOINs to other server for %s",c->name);
char list[MAXBUF];
std::string individual_halfops = ":"+Srv->GetServerName()+" FMODE "+c->name;
- size_t counter = snprintf(list,MAXBUF,":%s FJOIN %s %lu",Srv->GetServerName().c_str(),c->name,(unsigned long)c->age);
- size_t initial = counter;
+
+ size_t dlen, curlen;
+ dlen = curlen = snprintf(list,MAXBUF,":%s FJOIN %s %lu",Srv->GetServerName().c_str(),c->name,(unsigned long)c->age);
+ int numusers = 0;
+ char* ptr = list + dlen;
CUList *ulist = c->GetUsers();
std::vector<userrec*> specific_halfop;
@@ -1186,8 +1189,6 @@ class TreeSocket : public InspSocket
for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
{
- charlcat(list,' ',MAXBUF);
- counter++;
int x = cflags(i->second,c);
if ((x & UCMODE_HOP) && (x & UCMODE_OP))
{
@@ -1212,19 +1213,20 @@ class TreeSocket : public InspSocket
n = '+';
}
- if (n)
- {
- charlcat(list,n,MAXBUF);
- counter++;
- }
+ size_t ptrlen = snprintf(ptr, MAXBUF, " %c%s", n, i->second->nick);
+
+ curlen += ptrlen;
+ ptr += ptrlen;
- counter += strlcat(list,i->second->nick,MAXBUF);
+ numusers++;
- if (counter > (480-NICKMAX))
+ if (curlen > (480-NICKMAX))
{
- log(DEBUG,"FJOIN line wrapped to %d %d",counter,(480-NICKMAX));
this->WriteLine(list);
- counter = snprintf(list,MAXBUF,":%s FJOIN %s %lu",Srv->GetServerName().c_str(),c->name,(unsigned long)c->age);
+ dlen = curlen = snprintf(list,MAXBUF,":%s FJOIN %s %lu",Srv->GetServerName().c_str(),c->name,(unsigned long)c->age);
+ ptr = list + dlen;
+ ptrlen = 0;
+ numusers = 0;
for (unsigned int y = 0; y < specific_voice.size(); y++)
{
this->WriteLine(":"+Srv->GetServerName()+" FMODE "+c->name+" +v "+specific_voice[y]->nick);
@@ -1235,9 +1237,8 @@ class TreeSocket : public InspSocket
}
}
}
- if (counter != initial)
+ if (numusers)
{
- log(DEBUG,"Final FJOIN line");
this->WriteLine(list);
for (unsigned int y = 0; y < specific_voice.size(); y++)
{