- char list[MAXBUF];
- size_t dlen, curlen;
- int MOD_RESULT = 0;
-
- if (!IS_LOCAL(user))
- return;
-
- FOREACH_RESULT(I_OnUserList,OnUserList(user, this, ulist));
- if (MOD_RESULT == 1)
- return;
- if (MOD_RESULT != -1)
- {
- if ((this->IsModeSet('s')) && (!this->HasUser(user)))
- {
- user->WriteServ("401 %s %s :No such nick/channel",user->nick, this->name);
- return;
- }
- }
-
- dlen = curlen = snprintf(list,MAXBUF,"353 %s %c %s :", user->nick, this->IsModeSet('s') ? '@' : this->IsModeSet('p') ? '*' : '=', this->name);
-
- int numusers = 0;
- char* ptr = list + dlen;
-
- if (!ulist)
- ulist = this->GetUsers();
-
- /* Improvement by Brain - this doesnt change in value, so why was it inside
- * the loop?
- */
- bool has_user = this->HasUser(user);
-
- for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
- {
- if ((!has_user) && (i->first->IsModeSet('i')))
- {
- /*
- * user is +i, and source not on the channel, does not show
- * nick in NAMES list
- */
- continue;
- }
-
- 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());
- /* OnUserList can change this - reset it back to normal */
- i->second = i->first->nick;
-
- curlen += ptrlen;
- ptr += ptrlen;
-
- numusers++;
-
- if (curlen > (480-NICKMAX))
- {
- /* list overflowed into multiple numerics */
- user->WriteServ(std::string(list));
-
- /* reset our lengths */
- dlen = curlen = snprintf(list,MAXBUF,"353 %s %c %s :", user->nick, this->IsModeSet('s') ? '@' : this->IsModeSet('p') ? '*' : '=', this->name);
- ptr = list + dlen;
-
- ptrlen = 0;
- numusers = 0;
- }
- }
-
- /* if whats left in the list isnt empty, send it */
- if (numusers)
- {
- user->WriteServ(std::string(list));
- }
-
- user->WriteServ("366 %s %s :End of /NAMES list.", user->nick, this->name);
-}
-
-long Channel::GetMaxBans()
-{
- /* Return the cached value if there is one */
- if (this->maxbans)
- return this->maxbans;
-
- /* If there isnt one, we have to do some O(n) hax to find it the first time. (ick) */
- for (std::map<std::string,int>::iterator n = ServerInstance->Config->maxbans.begin(); n != ServerInstance->Config->maxbans.end(); n++)
- {
- if (match(this->name,n->first.c_str()))
- {
- this->maxbans = n->second;
- return n->second;
- }
- }
-
- /* Screw it, just return the default of 64 */
- this->maxbans = 64;
- return this->maxbans;