summaryrefslogtreecommitdiff
path: root/src/coremods
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2019-10-01 12:27:17 +0100
committerPeter Powell <petpow@saberuk.com>2019-10-01 12:32:40 +0100
commit4d2391ee094553cc11ce84b7b81d39bdb89ec48e (patch)
treeccfb999be0acd0880a102f79a108bb4a52f448eb /src/coremods
parent32d96016bd21fd5dff54503df4222c10662e57e5 (diff)
Show the list modes which have variable list lengths in 005.
Diffstat (limited to 'src/coremods')
-rw-r--r--src/coremods/core_channel/core_channel.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/coremods/core_channel/core_channel.cpp b/src/coremods/core_channel/core_channel.cpp
index e95736ccc..b989f8778 100644
--- a/src/coremods/core_channel/core_channel.cpp
+++ b/src/coremods/core_channel/core_channel.cpp
@@ -205,16 +205,20 @@ class CoreModChannel : public Module, public CheckExemption::EventListener
{
tokens["KEYLEN"] = ConvToStr(ModeChannelKey::maxkeylen);
- // Build a map of limits to their mode character.
insp::flat_map<int, std::string> limits;
+ std::string vlist;
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());
+ ListModeBase* lm = *iter;
+
+ const unsigned int limit = lm->GetLowerLimit();
+ limits[limit].push_back(lm->GetModeChar());
+
+ if (lm->HasVariableLength())
+ vlist.push_back(lm->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)
{
@@ -228,6 +232,12 @@ class CoreModChannel : public Module, public CheckExemption::EventListener
buffer.push_back(':');
buffer.append(ConvToStr(iter->first));
}
+
+ if (!vlist.empty())
+ {
+ tokens["VBANLIST"]; // deprecated
+ tokens["VLIST"] = vlist;
+ }
}
ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string&, std::string&, const std::string& keygiven) CXX11_OVERRIDE