diff options
| author | 2008-03-29 15:02:06 +0000 | |
|---|---|---|
| committer | 2008-03-29 15:02:06 +0000 | |
| commit | 77b933f6ecddbffd0db5a0c8fc444b4c8bfbfb11 (patch) | |
| tree | ea97d48681effbefac250bcffa4d99aa05492f05 /src/channels.cpp | |
| parent | Fix for bug #506 reported by Skip (diff) | |
We also need to re-order to make sure the length comprison comes BEFORE the append: different items may have different lengths and otherwise we'd be comparing length of the LAST item not the current
git-svn-id: http://svn.inspircd.org/repository/branches/1_1_stable@9203 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/channels.cpp')
| -rw-r--r-- | src/channels.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/channels.cpp b/src/channels.cpp index 7b268e3b3..16053aee5 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -880,16 +880,11 @@ void chanrec::UserList(userrec *user, CUList *ulist) if (i->first->Visibility && !i->first->Visibility->VisibleTo(user)) continue; - size_t ptrlen = snprintf(ptr, MAXBUF, "%s%s ", this->GetPrefixChar(i->first), i->second.c_str()); - - curlen += ptrlen; - ptr += ptrlen; - - numusers++; + size_t ptrlen = 0; /* Fix for bug #506 reported by Skip, often seen by w00t :p */ if (curlen > (480-i->second.length())) - { + { /* list overflowed into multiple numerics */ user->WriteServ(std::string(list)); @@ -901,6 +896,13 @@ void chanrec::UserList(userrec *user, CUList *ulist) numusers = 0; } + ptrlen = snprintf(ptr, MAXBUF, "%s%s ", this->GetPrefixChar(i->first), i->second.c_str()); + + curlen += ptrlen; + ptr += ptrlen; + + numusers++; + /* OnUserList can change this - reset it back to normal */ i->second = i->first->nick; } |
