mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 02:59:01 -04:00
Replace the deprecated MAXBANS token with MAXLIST.
This commit is contained in:
parent
d2b5c7d1fc
commit
60658d0bdb
@ -126,6 +126,10 @@ class CoreExport ListModeBase : public ModeHandler
|
|||||||
*/
|
*/
|
||||||
unsigned int GetLimit(Channel* channel);
|
unsigned int GetLimit(Channel* channel);
|
||||||
|
|
||||||
|
/** Gets the lower list limit for this listmode.
|
||||||
|
*/
|
||||||
|
unsigned int GetLowerLimit();
|
||||||
|
|
||||||
/** Retrieves the list of all modes set on the given channel
|
/** Retrieves the list of all modes set on the given channel
|
||||||
* @param channel Channel to get the list from
|
* @param channel Channel to get the list from
|
||||||
* @return A list with all modes of this type set on the given channel, can be NULL
|
* @return A list with all modes of this type set on the given channel, can be NULL
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include "inspircd.h"
|
#include "inspircd.h"
|
||||||
#include "core_channel.h"
|
#include "core_channel.h"
|
||||||
#include "invite.h"
|
#include "invite.h"
|
||||||
|
#include "listmode.h"
|
||||||
|
|
||||||
class CoreModChannel : public Module
|
class CoreModChannel : public Module
|
||||||
{
|
{
|
||||||
@ -58,6 +59,30 @@ class CoreModChannel : public Module
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE
|
||||||
|
{
|
||||||
|
// Build a map of limits to their mode character.
|
||||||
|
insp::flat_map<int, std::string> limits;
|
||||||
|
const ModeParser::ListModeList& listmodes = ServerInstance->Modes->GetListModes();
|
||||||
|
for (ModeParser::ListModeList::const_iterator iter = listmodes.begin(); iter != listmodes.end(); ++iter)
|
||||||
|
{
|
||||||
|
const unsigned int limit = (*iter)->GetLowerLimit();
|
||||||
|
limits[limit].push_back((*iter)->GetModeChar());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate the MAXLIST token from the limits map.
|
||||||
|
std::string& buffer = tokens["MAXLIST"];
|
||||||
|
for (insp::flat_map<int, std::string>::const_iterator iter = limits.begin(); iter != limits.end(); ++iter)
|
||||||
|
{
|
||||||
|
if (!buffer.empty())
|
||||||
|
buffer.push_back(',');
|
||||||
|
|
||||||
|
buffer.append(iter->second);
|
||||||
|
buffer.push_back(':');
|
||||||
|
buffer.append(ConvToStr(iter->first));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void OnPostJoin(Membership* memb) CXX11_OVERRIDE
|
void OnPostJoin(Membership* memb) CXX11_OVERRIDE
|
||||||
{
|
{
|
||||||
Channel* const chan = memb->chan;
|
Channel* const chan = memb->chan;
|
||||||
|
@ -121,6 +121,17 @@ unsigned int ListModeBase::GetLimit(Channel* channel)
|
|||||||
return GetLimitInternal(channel->name, cd);
|
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)
|
ModeAction ListModeBase::OnModeChange(User* source, User*, Channel* channel, std::string ¶meter, bool adding)
|
||||||
{
|
{
|
||||||
// Try and grab the list
|
// Try and grab the list
|
||||||
|
@ -171,7 +171,6 @@ void ISupportManager::Build()
|
|||||||
tokens["CHANTYPES"] = "#";
|
tokens["CHANTYPES"] = "#";
|
||||||
tokens["ELIST"] = "MU";
|
tokens["ELIST"] = "MU";
|
||||||
tokens["KICKLEN"] = ConvToStr(ServerInstance->Config->Limits.MaxKick);
|
tokens["KICKLEN"] = ConvToStr(ServerInstance->Config->Limits.MaxKick);
|
||||||
tokens["MAXBANS"] = "64"; // TODO: make this a config setting.
|
|
||||||
tokens["MAXTARGETS"] = ConvToStr(ServerInstance->Config->MaxTargets);
|
tokens["MAXTARGETS"] = ConvToStr(ServerInstance->Config->MaxTargets);
|
||||||
tokens["MODES"] = ConvToStr(ServerInstance->Config->Limits.MaxModes);
|
tokens["MODES"] = ConvToStr(ServerInstance->Config->Limits.MaxModes);
|
||||||
tokens["NETWORK"] = ServerInstance->Config->Network;
|
tokens["NETWORK"] = ServerInstance->Config->Network;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user