- char list[MAXBUF];
- size_t dlen, curlen;
-
- if (!IS_LOCAL(user))
- return;
-
- if (this->IsModeSet('s') && !this->HasUser(user) && !user->HasPrivPermission("channels/auspex"))
- {
- user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel",user->nick.c_str(), this->name.c_str());
- return;
- }
-
- dlen = curlen = snprintf(list,MAXBUF,"%s %c %s :", user->nick.c_str(), this->IsModeSet('s') ? '@' : this->IsModeSet('p') ? '*' : '=', this->name.c_str());
-
- int numusers = 0;
- char* ptr = list + dlen;
-
- /* Improvement by Brain - this doesnt change in value, so why was it inside
- * the loop?
- */
- bool has_user = this->HasUser(user);
-
- for (UserMembIter i = userlist.begin(); i != userlist.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;
- }
-
- std::string prefixlist = this->GetPrefixChar(i->first);
- std::string nick = i->first->nick;
-
- FOREACH_MOD(I_OnNamesListItem, OnNamesListItem(user, i->second, prefixlist, nick));
-
- /* Nick was nuked, a module wants us to skip it */
- if (nick.empty())
- continue;
-
- size_t ptrlen = 0;
-
- if (curlen + prefixlist.length() + nick.length() + 1 > 480)
- {
- /* list overflowed into multiple numerics */
- user->WriteNumeric(RPL_NAMREPLY, std::string(list));
-
- /* reset our lengths */
- dlen = curlen = snprintf(list,MAXBUF,"%s %c %s :", user->nick.c_str(), this->IsModeSet('s') ? '@' : this->IsModeSet('p') ? '*' : '=', this->name.c_str());
- ptr = list + dlen;
-
- ptrlen = 0;
- numusers = 0;
- }
-
- ptrlen = snprintf(ptr, MAXBUF, "%s%s ", prefixlist.c_str(), nick.c_str());
-
- curlen += ptrlen;
- ptr += ptrlen;
-
- numusers++;
- }
-
- /* if whats left in the list isnt empty, send it */
- if (numusers)
- {
- user->WriteNumeric(RPL_NAMREPLY, std::string(list));
- }
-
- user->WriteNumeric(RPL_ENDOFNAMES, "%s %s :End of /NAMES list.", user->nick.c_str(), this->name.c_str());
-}
-
-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 (InspIRCd::Match(this->name, n->first, NULL))
- {
- this->maxbans = n->second;
- return n->second;
- }
- }
-
- /* Screw it, just return the default of 64 */
- this->maxbans = 64;
- return this->maxbans;
-}
-
-void Channel::ResetMaxBans()
-{
- this->maxbans = 0;