From 77b933f6ecddbffd0db5a0c8fc444b4c8bfbfb11 Mon Sep 17 00:00:00 2001 From: brain Date: Sat, 29 Mar 2008 15:02:06 +0000 Subject: 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 --- src/modules/m_namesx.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/modules/m_namesx.cpp') diff --git a/src/modules/m_namesx.cpp b/src/modules/m_namesx.cpp index 4118d2101..cd56ea52c 100644 --- a/src/modules/m_namesx.cpp +++ b/src/modules/m_namesx.cpp @@ -95,11 +95,7 @@ class ModuleNamesX : public Module if (i->first->Visibility && !i->first->Visibility->VisibleTo(user)) continue; - size_t ptrlen = snprintf(ptr, MAXBUF, "%s%s ", Ptr->GetAllPrefixChars(i->first), i->second.c_str()); - /* OnUserList can change this - reset it back to normal */ - 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())) @@ -113,6 +109,14 @@ class ModuleNamesX : public Module numusers = 0; } + ptrlen = snprintf(ptr, MAXBUF, "%s%s ", Ptr->GetAllPrefixChars(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; } /* if whats left in the list isnt empty, send it */ -- cgit v1.3.1-10-gc9f91