Added new config entries, removeAllBans|Quiets|Invites|Exempts to prevent by default the mass removal with ub *

This commit is contained in:
Nicolas Coevoet 2021-06-01 20:55:02 +00:00
parent 6628af1088
commit 270b2c143f
2 changed files with 39 additions and 2 deletions

View File

@ -88,6 +88,15 @@ conf.registerChannelValue(ChanTracker, 'modesToAskWhenOpped',
conf.registerChannelValue(ChanTracker, 'autoExpire',
registry.Integer(-1, """default expiration time for newly placed bans; -1 disables auto-expiration, otherwise it's in seconds"""))
conf.registerChannelValue(ChanTracker, 'removeAllBans',
registry.Boolean(False, """prevent accidental removal of all bans"""))
conf.registerChannelValue(ChanTracker, 'removeAllQuiets',
registry.Boolean(False, """prevent accidental removal of all quiets"""))
conf.registerChannelValue(ChanTracker, 'removeAllExempts',
registry.Boolean(False, """prevent accidental removal of all exempts"""))
conf.registerChannelValue(ChanTracker, 'removeAllInvites',
registry.Boolean(False, """prevent accidental removal of all invites"""))
# announces related to logChannel
conf.registerChannelValue(ChanTracker, 'logChannel',

View File

@ -1709,6 +1709,13 @@ class ChanTracker(callbacks.Plugin,plugins.ChannelDBHandler):
"""[<channel>] <nick|hostmask|*> [<nick|hostmask|*>]
sets -q on them, if * found, remove them all"""
isMass = False
for item in items:
if item == '*':
isMass = True
if isMass and not self.registryValue('removeAllQuiets',channel=channel):
irc.reply('removal of all quiets has been disabled for %s' % channel)
return
b = self._removes(irc,msg,args,channel,'q',items,False)
if not msg.nick == irc.nick and not b:
irc.reply('nicks not found or hostmasks invalids or targets are not +q')
@ -1722,6 +1729,13 @@ class ChanTracker(callbacks.Plugin,plugins.ChannelDBHandler):
for (option, arg) in optlist:
if option == 'perm':
perm = True
isMass = False
for item in items:
if item == '*':
isMass = True
if isMass and not self.registryValue('removeAllBans',channel=channel):
irc.reply('removal of all bans has been disabled for %s' % channel)
return
b = self._removes(irc,msg,args,channel,'b',items,perm)
if not msg.nick == irc.nick and not b:
if perm:
@ -1737,6 +1751,13 @@ class ChanTracker(callbacks.Plugin,plugins.ChannelDBHandler):
"""[<channel>] <nick|hostmask|*> [<nick|hostmask|*>]
sets -I on them, if * found, remove them all"""
isMass = False
for item in items:
if item == '*':
isMass = True
if isMass and not self.registryValue('removeAllInvites',channel=channel):
irc.reply('removal of all invites has been disabled for %s' % channel)
return
b = self._removes(irc,msg,args,channel,'I',items,False)
if not msg.nick == irc.nick and not b:
irc.reply('nicks not found or hostmasks invalids or targets are not +I')
@ -1746,6 +1767,13 @@ class ChanTracker(callbacks.Plugin,plugins.ChannelDBHandler):
"""[<channel>] <nick|hostmask|*> [<nick|hostmask|*>]
sets -e on them, if * found, remove them all"""
isMass = False
for item in items:
if item == '*':
isMass = True
if isMass and not self.registryValue('removeAllExempts',channel=channel):
irc.reply('removal of all exempts has been disabled for %s' % channel)
return
b = self._removes(irc,msg,args,channel,'e',items,False)
if not msg.nick == irc.nick and not b:
irc.reply('nicks not found or hostmasks invalids or targets are not +e')