Allow rmode to remove all modes matching a specific user.

This commit is contained in:
Sadie Powell 2024-03-24 17:06:55 +00:00
parent eb05259378
commit 4e52832bff
2 changed files with 6 additions and 3 deletions

View File

@ -148,8 +148,10 @@ a message stating they were removed from the channel and by whom.
">
<helptopic key="rmode" title="/RMODE <channel> <mode> [<pattern>]" value="
Removes listmodes from a channel, optionally matching a glob-based pattern.
E.g. '/RMODE #channel b m:*' will remove all mute extbans on the channel.
Removes list and prefix modes from the specified channel. If a pattern is
specified then all modes matching the specified pattern will be removed. If
removing a list mode and the pattern is the nick of an online user then all
modes in the list matching the specified user will be removed.
">
<helptopic key="hexip" title="/HEXIP <hex-ip|raw-ip>" value="

View File

@ -91,9 +91,10 @@ public:
}
else if ((lm = mh->IsListModeBase()) && ((ml = lm->GetList(chan)) != nullptr))
{
auto* targuser = parameters.size() > 2 ? ServerInstance->Users.FindNick(parameters[2]) : nullptr;
for (const auto& entry : *ml)
{
if (InspIRCd::Match(entry.mask, pattern))
if (targuser ? chan->CheckBan(targuser, entry.mask) : InspIRCd::Match(entry.mask, pattern))
changelist.push_remove(mh, entry.mask);
}
}