mirror of
https://github.com/ncoevoet/ChanTracker.git
synced 2025-04-27 05:21:10 -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',
|
conf.registerChannelValue(ChanTracker, 'autoExpire',
|
||||||
registry.Integer(-1, """default expiration time for newly placed bans; -1 disables auto-expiration, otherwise it's in seconds"""))
|
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',
|
conf.registerChannelValue(ChanTracker, 'removeAllBans',
|
||||||
registry.Boolean(False, """prevent accidental removal of all bans"""))
|
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')))
|
ircutils.mircColor(mask, 'light blue')))
|
||||||
else:
|
else:
|
||||||
msgs.append('[#%s %s]' % (uid, mask))
|
msgs.append('[#%s %s]' % (uid, mask))
|
||||||
|
self.verifyRemoval(irc, channel, mode, mask, db, ct, uid)
|
||||||
if commits > 0:
|
if commits > 0:
|
||||||
db.commit()
|
db.commit()
|
||||||
if logFunction:
|
if logFunction:
|
||||||
@ -971,6 +972,10 @@ class Ircd(object):
|
|||||||
int(regexp) == 1, trigger, life, mode, duration)
|
int(regexp) == 1, trigger, life, mode, duration)
|
||||||
c.close()
|
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):
|
class Chan(object):
|
||||||
__slots__ = ('ircd', 'name', '_lists', 'queue', 'update', 'mark', 'action', 'dones', 'syn', 'opAsked',
|
__slots__ = ('ircd', 'name', '_lists', 'queue', 'update', 'mark', 'action', 'dones', 'syn', 'opAsked',
|
||||||
@ -4308,6 +4313,7 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler):
|
|||||||
toCommit = False
|
toCommit = False
|
||||||
toexpire = []
|
toexpire = []
|
||||||
tolift = []
|
tolift = []
|
||||||
|
toremove = []
|
||||||
if irc.isChannel(channel) and msg.args[1:] and channel in irc.state.channels:
|
if irc.isChannel(channel) and msg.args[1:] and channel in irc.state.channels:
|
||||||
modes = ircutils.separateModes(msg.args[1:])
|
modes = ircutils.separateModes(msg.args[1:])
|
||||||
chan = self.getChan(irc, channel)
|
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):
|
or m in self.registryValue('modesToAskWhenOpped', channel=channel, network=irc.network):
|
||||||
toCommit = True
|
toCommit = True
|
||||||
item = chan.removeItem(m, value, msg.prefix, c)
|
item = chan.removeItem(m, value, msg.prefix, c)
|
||||||
|
toremove.append(item)
|
||||||
if n:
|
if n:
|
||||||
n.addLog(channel, 'sets %s %s' % (mode, value))
|
n.addLog(channel, 'sets %s %s' % (mode, value))
|
||||||
if item:
|
if item:
|
||||||
@ -4552,7 +4559,9 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler):
|
|||||||
msgs.append(mode)
|
msgs.append(mode)
|
||||||
if toCommit:
|
if toCommit:
|
||||||
db.commit()
|
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) \
|
if irc.state.channels[channel].isHalfopPlus(irc.nick) \
|
||||||
and not self.registryValue('keepOp', channel=channel, network=irc.network):
|
and not self.registryValue('keepOp', channel=channel, network=irc.network):
|
||||||
self.forceTickle = True
|
self.forceTickle = True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user