mirror of
https://github.com/ncoevoet/ChanTracker.git
synced 2025-04-26 13:01:06 -05:00
i added an optional configuration autoRemoveUnregisteredQuiets to lift from database +q $~a entries, because they appears in search and are useless
This commit is contained in:
parent
3ef7520394
commit
9c53e66bf8
@ -100,6 +100,8 @@ 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, 'autoRemoveUnregisteredQuiets',
|
||||
registry.Boolean(True, """auto remove from database unregistered quiets once expired -q $~a"""))
|
||||
|
||||
conf.registerChannelValue(ChanTracker, 'removeAllBans',
|
||||
registry.Boolean(False, """prevent accidental removal of all bans"""))
|
||||
|
11
plugin.py
11
plugin.py
@ -949,6 +949,7 @@ class Ircd(object):
|
||||
ircutils.mircColor(mask, 'light blue')))
|
||||
else:
|
||||
msgs.append('[#%s %s]' % (uid, mask))
|
||||
self.verifyRemoval(irc, channel, mode, mask, db, ct, uid)
|
||||
if commits > 0:
|
||||
db.commit()
|
||||
if logFunction:
|
||||
@ -971,6 +972,10 @@ class Ircd(object):
|
||||
int(regexp) == 1, trigger, life, mode, duration)
|
||||
c.close()
|
||||
|
||||
def verifyRemoval (self, irc, channel, mode, value, db, ct, uid):
|
||||
if ct.registryValue('autoRemoveUnregisteredQuiets', channel=channel, network=irc.network) and mode == 'q' and value == '$~a':
|
||||
self.remove(uid, db)
|
||||
|
||||
|
||||
class Chan(object):
|
||||
__slots__ = ('ircd', 'name', '_lists', 'queue', 'update', 'mark', 'action', 'dones', 'syn', 'opAsked',
|
||||
@ -4308,6 +4313,7 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler):
|
||||
toCommit = False
|
||||
toexpire = []
|
||||
tolift = []
|
||||
toremove = []
|
||||
if irc.isChannel(channel) and msg.args[1:] and channel in irc.state.channels:
|
||||
modes = ircutils.separateModes(msg.args[1:])
|
||||
chan = self.getChan(irc, channel)
|
||||
@ -4456,6 +4462,7 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler):
|
||||
or m in self.registryValue('modesToAskWhenOpped', channel=channel, network=irc.network):
|
||||
toCommit = True
|
||||
item = chan.removeItem(m, value, msg.prefix, c)
|
||||
toremove.append(item)
|
||||
if n:
|
||||
n.addLog(channel, 'sets %s %s' % (mode, value))
|
||||
if item:
|
||||
@ -4552,7 +4559,9 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler):
|
||||
msgs.append(mode)
|
||||
if toCommit:
|
||||
db.commit()
|
||||
|
||||
if len(toremove):
|
||||
for r in toremove:
|
||||
i.verifyRemoval(irc, item.channel, item.mode, item.value, db, self, item.uid)
|
||||
if irc.state.channels[channel].isHalfopPlus(irc.nick) \
|
||||
and not self.registryValue('keepOp', channel=channel, network=irc.network):
|
||||
self.forceTickle = True
|
||||
|
Loading…
x
Reference in New Issue
Block a user