diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-03-07 12:11:25 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-03-07 12:11:25 +0000 |
commit | 8f79485a75bfc6e1da9a65a81b7688514187b57b (patch) | |
tree | 325c9f61630fa5469a1b696ca7fe87f2bf60d2dc /src/modules | |
parent | 34b0ca01b6da7fc039ecdf4d0bc8bbb5bb3f64bf (diff) |
Took strlen's out of fjoin
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3515 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_spanningtree.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index 2ecfdc696..d164bef27 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -1133,15 +1133,19 @@ 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; - snprintf(list,MAXBUF,":%s FJOIN %s %lu",Srv->GetServerName().c_str(),c->name,(unsigned long)c->age); + size_t counter = snprintf(list,MAXBUF,":%s FJOIN %s %lu",Srv->GetServerName().c_str(),c->name,(unsigned long)c->age); + size_t initial = counter; + std::map<char*,char*> *ulist = c->GetUsers(); std::vector<userrec*> specific_halfop; std::vector<userrec*> specific_voice; + for (std::map<char*,char*>::iterator i = ulist->begin(); i != ulist->end(); i++) { char* o = i->second; userrec* otheruser = (userrec*)o; charlcat(list,' ',MAXBUF); + counter++; int x = cflags(otheruser,c); if ((x & UCMODE_HOP) && (x & UCMODE_OP)) { @@ -1167,14 +1171,18 @@ class TreeSocket : public InspSocket } if (n) + { charlcat(list,n,MAXBUF); + counter++; + } + + counter += strlcat(list,otheruser->nick,MAXBUF); - strlcat(list,otheruser->nick,MAXBUF); - if (strlen(list)>(480-NICKMAX)) + if (counter > (480-NICKMAX)) { log(DEBUG,"FJOIN line wrapped"); this->WriteLine(list); - snprintf(list,MAXBUF,":%s FJOIN %s %lu",Srv->GetServerName().c_str(),c->name,(unsigned long)c->age); + counter = snprintf(list,MAXBUF,":%s FJOIN %s %lu",Srv->GetServerName().c_str(),c->name,(unsigned long)c->age); for (unsigned int y = 0; y < specific_voice.size(); y++) { this->WriteLine(":"+Srv->GetServerName()+" FMODE "+c->name+" +v "+specific_voice[y]->nick); @@ -1185,7 +1193,7 @@ class TreeSocket : public InspSocket } } } - if (list[strlen(list)-1] != ':') + if (counter != initial) { log(DEBUG,"Final FJOIN line"); this->WriteLine(list); |