From e0c606816d97bab923ca3aa6fa3ce86e2ca97f1e Mon Sep 17 00:00:00 2001 From: Nicolas Coevoet Date: Sun, 4 Jul 2021 08:26:17 +0000 Subject: [PATCH] added cautoexpire and few rewording of configuration helper commands --- config.py | 2 +- plugin.py | 36 +++++++++++++++++++++++++++--------- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/config.py b/config.py index 35c300c..7adeb02 100644 --- a/config.py +++ b/config.py @@ -49,7 +49,7 @@ conf.registerGlobalValue(ChanTracker, 'pool', Note, check is also based on irc activity, so removal may be delayed a bit, -1 to disable delay""")) conf.registerGlobalValue(ChanTracker, 'logsSize', - registry.PositiveInteger(60, """number of messages to keep in logs. Note, this is per nick - not per nick per channel""")) + registry.PositiveInteger(1, """number of messages to keep in logs. Note, this is per nick - not per nick per channel""")) conf.registerGlobalValue(ChanTracker, 'quietCommand', registry.String("PRIVMSG ChanServ :QUIET $channel $hostmask", diff --git a/plugin.py b/plugin.py index 5fed0ff..5654ccf 100644 --- a/plugin.py +++ b/plugin.py @@ -2371,10 +2371,26 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler): self._tickle(irc) addtmp = wrap(addtmp, ['op', 'text']) + def cautoexpire(self, irc, msg, args, channel, autoexpire): + """[] [] + + display or set the configuration of auto expiration for new items (-1 to disable, in seconds)""" + cap = ircdb.canonicalCapability('owner') + if self.registryValue('allowOpToConfig', channel=channel) \ + or ircdb.checkCapability(msg.prefix, cap): + results = ['for %s' % channel] + if not autoexpire is None: + self.setRegistryValue('autoExpire', autoexpire, channel=channel) + results.append('autoExpire: %s' % self.registryValue('autoExpire', channel=channel)) + irc.replies(results, None, None, False) + return + irc.reply("Operators aren't allowed to see or change protection configuration in %s" % channel) + cautoexpire = wrap(cautoexpire, ['op', optional('int')]) + def cflood(self, irc, msg, args, channel, permit, life, mode, duration): """[] [] [] [] [] - return channel protection configuration""" + display or set the configuration of flood control ( -1 to disable)""" cap = ircdb.canonicalCapability('owner') if self.registryValue('allowOpToConfig', channel=channel) \ or ircdb.checkCapability(msg.prefix, cap): @@ -2397,7 +2413,7 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler): def crepeat(self, irc, msg, args, channel, permit, life, mode, duration, minimum, probability, count, patternLength, patternLife): """[] [] [] [] [] [] [] [] [] [] - return channel protection configuration; is a float between 0 and 1""" + display or set the configuration of repeat control ( -1 to disable, -1 to disable pattern creation); is a float between 0 and 1""" cap = ircdb.canonicalCapability('owner') if self.registryValue('allowOpToConfig', channel=channel) \ or ircdb.checkCapability(msg.prefix, cap): @@ -2433,7 +2449,7 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler): def ccap(self, irc, msg, args, channel, permit, life, mode, duration, probability): """[] [] [] [] [] [] - return channel protection configuration; is a float between 0 and 1""" + display or set the configuration of caplocks control; -1 to disable, is a float between 0 and 1""" cap = ircdb.canonicalCapability('owner') if self.registryValue('allowOpToConfig', channel=channel) \ or ircdb.checkCapability(msg.prefix, cap): @@ -2459,7 +2475,7 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler): def chl(self, irc, msg, args, channel, permit, life, mode, duration): """[] [] [] [] - return channel protection configuration""" + display or set hilight control for a given channel -1 to disable""" cap = ircdb.canonicalCapability('owner') if self.registryValue('allowOpToConfig', channel=channel) \ or ircdb.checkCapability(msg.prefix, cap): @@ -2479,7 +2495,7 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler): def cclone(self, irc, msg, args, channel, permit, life, mode, duration): """[] [] [] [] - return channel protection configuration""" + display or set clone control for a given channel -1 to disable""" cap = ircdb.canonicalCapability('owner') if self.registryValue('allowOpToConfig', channel=channel) \ or ircdb.checkCapability(msg.prefix, cap): @@ -2499,7 +2515,7 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler): def cnotice(self, irc, msg, args, channel, permit, life, mode, duration): """[] [] [] [] [] - return channel protection configuration""" + display or set channel's notice control -1 to disable""" cap = ircdb.canonicalCapability('owner') if self.registryValue('allowOpToConfig', channel=channel) \ or ircdb.checkCapability(msg.prefix, cap): @@ -2522,7 +2538,7 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler): def ccycle(self, irc, msg, args, channel, permit, life, mode, duration): """[] [] [] [] [] - return channel protection configuration""" + display or set join/part control -1 to disable""" cap = ircdb.canonicalCapability('owner') if self.registryValue('allowOpToConfig', channel=channel) \ or ircdb.checkCapability(msg.prefix, cap): @@ -2545,7 +2561,7 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler): def cnick(self, irc, msg, args, channel, permit, life, mode, duration): """[] [] [] [] [] - return channel protection configuration""" + display or set nick changes control -1 to disable""" cap = ircdb.canonicalCapability('owner') if self.registryValue('allowOpToConfig', channel=channel) \ or ircdb.checkCapability(msg.prefix, cap): @@ -2568,7 +2584,7 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler): def cbad(self, irc, msg, args, channel, permit, life, mode, duration): """[] [] [] [] [] - return channel protection configuration""" + display or set bad control for a given channel -1 to disable""" cap = ircdb.canonicalCapability('owner') if self.registryValue('allowOpToConfig', channel=channel) \ or ircdb.checkCapability(msg.prefix, cap): @@ -4596,6 +4612,8 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler): else: self._logChan(irc, channel, '[%s] debug %s %s %s %s' % ( channel, mode, mask, duration, reason)) + self.forceTickle = True + self._tickle(irc) return if mode in self.registryValue('modesToAsk', channel=channel) \ or mode in self.registryValue('modesToAskWhenOpped', channel=channel):