X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Flistmode.cpp;h=23f98bf3fb616ed56347f895edd2b9f42220fccf;hb=ff3b706b2506d7614bce5e54bc88657bd62ebd4d;hp=35964dfb3396d9f893f78e63aa2d682d0c39e53d;hpb=8f5efbc7aa33b792e02d01e3288f553e6e98ccaa;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/listmode.cpp b/src/listmode.cpp index 35964dfb3..23f98bf3f 100644 --- a/src/listmode.cpp +++ b/src/listmode.cpp @@ -35,15 +35,15 @@ void ListModeBase::DisplayList(User* user, Channel* channel) { for (ModeList::const_iterator it = cd->list.begin(); it != cd->list.end(); ++it) { - user->WriteNumeric(listnumeric, "%s %s %s %lu", channel->name.c_str(), it->mask.c_str(), it->setter.c_str(), (unsigned long) it->time); + user->WriteNumeric(listnumeric, channel->name, it->mask, it->setter, (unsigned long) it->time); } } - user->WriteNumeric(endoflistnumeric, "%s :%s", channel->name.c_str(), endofliststring.c_str()); + user->WriteNumeric(endoflistnumeric, channel->name, endofliststring); } void ListModeBase::DisplayEmptyList(User* user, Channel* channel) { - user->WriteNumeric(endoflistnumeric, "%s :%s", channel->name.c_str(), endofliststring.c_str()); + user->WriteNumeric(endoflistnumeric, channel->name, endofliststring); } void ListModeBase::RemoveMode(Channel* channel, Modes::ChangeList& changelist) @@ -77,7 +77,7 @@ void ListModeBase::DoRehash() // Add the default entry. This is inserted last so if the user specifies a // wildcard record in the config it will take precedence over this entry. - chanlimits.push_back(ListLimit("*", 64)); + chanlimits.push_back(ListLimit("*", DEFAULT_LIST_SIZE)); // Most of the time our settings are unchanged, so we can avoid iterating the chanlist if (oldlimits == chanlimits) @@ -102,7 +102,7 @@ unsigned int ListModeBase::FindLimit(const std::string& channame) return it->limit; } } - return 64; + return DEFAULT_LIST_SIZE; } unsigned int ListModeBase::GetLimitInternal(const std::string& channame, ChanData* cd) @@ -121,6 +121,17 @@ unsigned int ListModeBase::GetLimit(Channel* channel) return GetLimitInternal(channel->name, cd); } +unsigned int ListModeBase::GetLowerLimit() +{ + unsigned int limit = UINT_MAX; + for (limitlist::iterator iter = chanlimits.begin(); iter != chanlimits.end(); ++iter) + { + if (iter->limit < limit) + limit = iter->limit; + } + return limit == UINT_MAX ? DEFAULT_LIST_SIZE : limit; +} + ModeAction ListModeBase::OnModeChange(User* source, User*, Channel* channel, std::string ¶meter, bool adding) { // Try and grab the list @@ -212,7 +223,7 @@ bool ListModeBase::ValidateParam(User*, Channel*, std::string&) void ListModeBase::TellListTooLong(User* source, Channel* channel, std::string& parameter) { - source->WriteNumeric(ERR_BANLISTFULL, "%s %s :Channel ban list is full", channel->name.c_str(), parameter.c_str()); + source->WriteNumeric(ERR_BANLISTFULL, channel->name, parameter, "Channel ban list is full"); } void ListModeBase::TellAlreadyOnList(User*, Channel*, std::string&)