mirror of
https://github.com/ncoevoet/ChanTracker.git
synced 2025-04-27 05:21:10 -05:00
Improve upon previous commits.
This commit is contained in:
parent
3108d60f3b
commit
a6a22bfe2b
89
plugin.py
89
plugin.py
@ -2380,7 +2380,7 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler):
|
|||||||
def cautoexpire(self, irc, msg, args, channel, autoexpire):
|
def cautoexpire(self, irc, msg, args, channel, autoexpire):
|
||||||
"""[<channel>] [<autoexpire>]
|
"""[<channel>] [<autoexpire>]
|
||||||
|
|
||||||
returns channel's config or auto remove new elements after <autoexpiration> (-1 to disable, in seconds)"""
|
return channel's config or auto remove new elements after <autoexpire> (-1 to disable, in seconds)"""
|
||||||
cap = ircdb.canonicalCapability('owner')
|
cap = ircdb.canonicalCapability('owner')
|
||||||
if self.registryValue('allowOpToConfig', channel=channel) \
|
if self.registryValue('allowOpToConfig', channel=channel) \
|
||||||
or ircdb.checkCapability(msg.prefix, cap):
|
or ircdb.checkCapability(msg.prefix, cap):
|
||||||
@ -2396,8 +2396,8 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler):
|
|||||||
def cflood(self, irc, msg, args, channel, permit, life, mode, duration):
|
def cflood(self, irc, msg, args, channel, permit, life, mode, duration):
|
||||||
"""[<channel>] [<permit>] [<life>] [<mode>] [<duration>]
|
"""[<channel>] [<permit>] [<life>] [<mode>] [<duration>]
|
||||||
|
|
||||||
returns channel's config or apply <mode> (bqeIkrdD) for <duration> (in seconds) \
|
return channel's config or apply <mode> (bqeIkrdD) for <duration> (in seconds)
|
||||||
if an user send more <permit> (-1 to disable) messages during <life> (in seconds)"""
|
if a user sends more than <permit> (-1 to disable) messages during <life> (in seconds)"""
|
||||||
cap = ircdb.canonicalCapability('owner')
|
cap = ircdb.canonicalCapability('owner')
|
||||||
if self.registryValue('allowOpToConfig', channel=channel) \
|
if self.registryValue('allowOpToConfig', channel=channel) \
|
||||||
or ircdb.checkCapability(msg.prefix, cap):
|
or ircdb.checkCapability(msg.prefix, cap):
|
||||||
@ -2420,10 +2420,10 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler):
|
|||||||
def crepeat(self, irc, msg, args, channel, permit, life, mode, duration, minimum, probability, count, patternLength, patternLife):
|
def crepeat(self, irc, msg, args, channel, permit, life, mode, duration, minimum, probability, count, patternLength, patternLife):
|
||||||
"""[<channel>] [<permit>] [<life>] [<mode>] [<duration>] [<minimum>] [<probability>] [<count>] [<patternLength>] [<patternLife>]
|
"""[<channel>] [<permit>] [<life>] [<mode>] [<duration>] [<minimum>] [<probability>] [<count>] [<patternLength>] [<patternLife>]
|
||||||
|
|
||||||
returns channel's config or apply <mode> (bqeIkrdD) for <duration> (in seconds) \
|
return channel's config or apply <mode> (bqeIkrdD) for <duration> (in seconds)
|
||||||
if <permit> (-1 to disable) repetitions are found during <life> (in seconds)\
|
if <permit> (-1 to disable) repetitions are found during <life> (in seconds);
|
||||||
it creates temporary lethal patterns and reapply <mode> and <duration>,\
|
it will create a temporary lethal pattern with a mininum of <patternLength>
|
||||||
<patternLength> (-1 to disable pattern creation); <probablity> is a float between 0 and 1"""
|
(-1 to disable pattern creation); <probablity> is a float between 0 and 1"""
|
||||||
cap = ircdb.canonicalCapability('owner')
|
cap = ircdb.canonicalCapability('owner')
|
||||||
if self.registryValue('allowOpToConfig', channel=channel) \
|
if self.registryValue('allowOpToConfig', channel=channel) \
|
||||||
or ircdb.checkCapability(msg.prefix, cap):
|
or ircdb.checkCapability(msg.prefix, cap):
|
||||||
@ -2459,9 +2459,9 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler):
|
|||||||
def ccap(self, irc, msg, args, channel, permit, life, mode, duration, probability):
|
def ccap(self, irc, msg, args, channel, permit, life, mode, duration, probability):
|
||||||
"""[<channel>] [<permit>] [<life>] [<mode>] [<duration>] [<probability>]
|
"""[<channel>] [<permit>] [<life>] [<mode>] [<duration>] [<probability>]
|
||||||
|
|
||||||
returns channel's config or apply <mode> (bqeIkrdD) for <duration> (in seconds) \
|
return channel's config or apply <mode> (bqeIkrdD) for <duration> (in seconds)
|
||||||
if <permit> (-1 to disable) messages during <life> (in seconds) \
|
if <permit> (-1 to disable) messages during <life> (in seconds)
|
||||||
contains more than <probability> (float between 0-1) uppercase chars"""
|
contain more than <probability> (float between 0-1) uppercase chars"""
|
||||||
cap = ircdb.canonicalCapability('owner')
|
cap = ircdb.canonicalCapability('owner')
|
||||||
if self.registryValue('allowOpToConfig', channel=channel) \
|
if self.registryValue('allowOpToConfig', channel=channel) \
|
||||||
or ircdb.checkCapability(msg.prefix, cap):
|
or ircdb.checkCapability(msg.prefix, cap):
|
||||||
@ -2487,8 +2487,8 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler):
|
|||||||
def chl(self, irc, msg, args, channel, permit, life, mode, duration):
|
def chl(self, irc, msg, args, channel, permit, life, mode, duration):
|
||||||
"""[<channel>] [<permit>] [<mode>] [<duration>]
|
"""[<channel>] [<permit>] [<mode>] [<duration>]
|
||||||
|
|
||||||
returns channel's config or apply <mode> (bqeIkrdD) during <duration> (in seconds) \
|
return channel's config or apply <mode> (bqeIkrdD) during <duration> (in seconds)
|
||||||
if <permit> (-1 to disable) channel's nicks are found in a message"""
|
if <permit> (-1 to disable) channel nicks are found in a message"""
|
||||||
cap = ircdb.canonicalCapability('owner')
|
cap = ircdb.canonicalCapability('owner')
|
||||||
if self.registryValue('allowOpToConfig', channel=channel) \
|
if self.registryValue('allowOpToConfig', channel=channel) \
|
||||||
or ircdb.checkCapability(msg.prefix, cap):
|
or ircdb.checkCapability(msg.prefix, cap):
|
||||||
@ -2508,8 +2508,8 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler):
|
|||||||
def cclone(self, irc, msg, args, channel, permit, life, mode, duration):
|
def cclone(self, irc, msg, args, channel, permit, life, mode, duration):
|
||||||
"""[<channel>] [<permit>] [<mode>] [<duration>]
|
"""[<channel>] [<permit>] [<mode>] [<duration>]
|
||||||
|
|
||||||
returns channel's config or apply <mode> (bqeIkrdD) for <duration> (in seconds) \
|
return channel's config or apply <mode> (bqeIkrdD) for <duration> (in seconds)
|
||||||
if <permit> (-1 to disable) users with the same host joined the channel"""
|
if <permit> (-1 to disable) users with the same host join the channel"""
|
||||||
cap = ircdb.canonicalCapability('owner')
|
cap = ircdb.canonicalCapability('owner')
|
||||||
if self.registryValue('allowOpToConfig', channel=channel) \
|
if self.registryValue('allowOpToConfig', channel=channel) \
|
||||||
or ircdb.checkCapability(msg.prefix, cap):
|
or ircdb.checkCapability(msg.prefix, cap):
|
||||||
@ -2529,8 +2529,8 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler):
|
|||||||
def cnotice(self, irc, msg, args, channel, permit, life, mode, duration):
|
def cnotice(self, irc, msg, args, channel, permit, life, mode, duration):
|
||||||
"""[<channel>] [<permit>] [<life>] [<mode>] [<duration>]
|
"""[<channel>] [<permit>] [<life>] [<mode>] [<duration>]
|
||||||
|
|
||||||
returns channel's config or apply <mode> (bqeIkrdD) for <duration> (in seconds) \
|
return channel's config or apply <mode> (bqeIkrdD) for <duration> (in seconds)
|
||||||
if <permit> (-1 to disable) messages are channel's notices during <life> (in seconds)"""
|
if <permit> (-1 to disable) messages are channel notices during <life> (in seconds)"""
|
||||||
cap = ircdb.canonicalCapability('owner')
|
cap = ircdb.canonicalCapability('owner')
|
||||||
if self.registryValue('allowOpToConfig', channel=channel) \
|
if self.registryValue('allowOpToConfig', channel=channel) \
|
||||||
or ircdb.checkCapability(msg.prefix, cap):
|
or ircdb.checkCapability(msg.prefix, cap):
|
||||||
@ -2553,8 +2553,8 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler):
|
|||||||
def ccycle(self, irc, msg, args, channel, permit, life, mode, duration):
|
def ccycle(self, irc, msg, args, channel, permit, life, mode, duration):
|
||||||
"""[<channel>] [<permit>] [<life>] [<mode>] [<duration>]
|
"""[<channel>] [<permit>] [<life>] [<mode>] [<duration>]
|
||||||
|
|
||||||
returns channel's config or apply <mode> (bqeIkrdD) for <duration> (in seconds) \
|
return channel's config or apply <mode> (bqeIkrdD) for <duration> (in seconds)
|
||||||
if <permit> (-1 to disable) /part are received by a host during <life> (in seconds)"""
|
if <permit> (-1 to disable) parts/quits are received by a host during <life> (in seconds)"""
|
||||||
cap = ircdb.canonicalCapability('owner')
|
cap = ircdb.canonicalCapability('owner')
|
||||||
if self.registryValue('allowOpToConfig', channel=channel) \
|
if self.registryValue('allowOpToConfig', channel=channel) \
|
||||||
or ircdb.checkCapability(msg.prefix, cap):
|
or ircdb.checkCapability(msg.prefix, cap):
|
||||||
@ -2577,8 +2577,8 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler):
|
|||||||
def cnick(self, irc, msg, args, channel, permit, life, mode, duration):
|
def cnick(self, irc, msg, args, channel, permit, life, mode, duration):
|
||||||
"""[<channel>] [<permit>] [<life>] [<mode>] [<duration>]
|
"""[<channel>] [<permit>] [<life>] [<mode>] [<duration>]
|
||||||
|
|
||||||
returns channel's config or apply <mode> (bqeIkrdD) during <duration> (in seconds) \
|
return channel's config or apply <mode> (bqeIkrdD) during <duration> (in seconds)
|
||||||
if an user changes nick <permit> (-1 to disable) times during <life> (in seconds)"""
|
if a user changes nick <permit> (-1 to disable) times during <life> (in seconds)"""
|
||||||
cap = ircdb.canonicalCapability('owner')
|
cap = ircdb.canonicalCapability('owner')
|
||||||
if self.registryValue('allowOpToConfig', channel=channel) \
|
if self.registryValue('allowOpToConfig', channel=channel) \
|
||||||
or ircdb.checkCapability(msg.prefix, cap):
|
or ircdb.checkCapability(msg.prefix, cap):
|
||||||
@ -2601,8 +2601,8 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler):
|
|||||||
def cbad(self, irc, msg, args, channel, permit, life, mode, duration):
|
def cbad(self, irc, msg, args, channel, permit, life, mode, duration):
|
||||||
"""[<channel>] [<permit>] [<life>] [<mode>] [<duration>]
|
"""[<channel>] [<permit>] [<life>] [<mode>] [<duration>]
|
||||||
|
|
||||||
returns channel's config or apply <mode> (bqeIkrdD) for <duration> (in seconds) \
|
return channel's config or apply <mode> (bqeIkrdD) for <duration> (in seconds)
|
||||||
if an user triggers <permit> (-1 to disable) channel's protections during <life> (in seconds)"""
|
if a user triggers <permit> (-1 to disable) channel protections during <life> (in seconds)"""
|
||||||
cap = ircdb.canonicalCapability('owner')
|
cap = ircdb.canonicalCapability('owner')
|
||||||
if self.registryValue('allowOpToConfig', channel=channel) \
|
if self.registryValue('allowOpToConfig', channel=channel) \
|
||||||
or ircdb.checkCapability(msg.prefix, cap):
|
or ircdb.checkCapability(msg.prefix, cap):
|
||||||
@ -2973,7 +2973,7 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler):
|
|||||||
s = s.replace('$hostmask', value)
|
s = s.replace('$hostmask', value)
|
||||||
i.queue.enqueue(ircmsgs.IrcMsg(s))
|
i.queue.enqueue(ircmsgs.IrcMsg(s))
|
||||||
chan.queue.pop(index)
|
chan.queue.pop(index)
|
||||||
index = index + 1
|
index += 1
|
||||||
if not irc.state.channels[channel].isHalfopPlus(irc.nick):
|
if not irc.state.channels[channel].isHalfopPlus(irc.nick):
|
||||||
chan.deopAsked = False
|
chan.deopAsked = False
|
||||||
chan.deopPending = False
|
chan.deopPending = False
|
||||||
@ -3016,7 +3016,7 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler):
|
|||||||
adding = True
|
adding = True
|
||||||
if m in self.registryValue('modesToAskWhenOpped', channel=channel):
|
if m in self.registryValue('modesToAskWhenOpped', channel=channel):
|
||||||
adding = True
|
adding = True
|
||||||
index = index + 1
|
index += 1
|
||||||
# remove duplicates (should not happen, but..)
|
# remove duplicates (should not happen, but..)
|
||||||
S = set(L)
|
S = set(L)
|
||||||
r = []
|
r = []
|
||||||
@ -3063,7 +3063,7 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler):
|
|||||||
if overexpire != expire:
|
if overexpire != expire:
|
||||||
chan.update['%s%s' % (m, value)] = [
|
chan.update['%s%s' % (m, value)] = [
|
||||||
m, value, overexpire, irc.prefix]
|
m, value, overexpire, irc.prefix]
|
||||||
index = index + 1
|
index += 1
|
||||||
L = []
|
L = []
|
||||||
for update in list(chan.update.keys()):
|
for update in list(chan.update.keys()):
|
||||||
L.append(chan.update[update])
|
L.append(chan.update[update])
|
||||||
@ -4367,13 +4367,12 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler):
|
|||||||
and nick != irc.nick:
|
and nick != irc.nick:
|
||||||
km = random.choice(self.registryValue('kickMessage', channel=channel))
|
km = random.choice(self.registryValue('kickMessage', channel=channel))
|
||||||
if msg.nick in (irc.nick, 'ChanServ'):
|
if msg.nick in (irc.nick, 'ChanServ'):
|
||||||
bm = self.registryValue('banMessage', channel=channel)
|
if self.registryValue('discloseOperator', channel=channel):
|
||||||
if len(bm):
|
|
||||||
hk = '%s%s' % (m, value)
|
hk = '%s%s' % (m, value)
|
||||||
if hk in chan.update and len(chan.update[hk]) == 4:
|
if hk in chan.update and len(chan.update[hk]) == 4:
|
||||||
if ircutils.isUserHostmask(chan.update[hk][3]):
|
if ircutils.isUserHostmask(chan.update[hk][3]):
|
||||||
(nn, ii, hh) = ircutils.splitHostmask(chan.update[hk][3])
|
(nn, ii, hh) = ircutils.splitHostmask(chan.update[hk][3])
|
||||||
if nn != irc.nick and self.registryValue('discloseOperator', channel=channel):
|
if nn != irc.nick:
|
||||||
km += ' (by %s)' % nn
|
km += ' (by %s)' % nn
|
||||||
chan.action.enqueue(ircmsgs.kick(channel, nick, km))
|
chan.action.enqueue(ircmsgs.kick(channel, nick, km))
|
||||||
self.forceTickle = True
|
self.forceTickle = True
|
||||||
@ -4382,14 +4381,15 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler):
|
|||||||
if msg.nick in (irc.nick, 'ChanServ'):
|
if msg.nick in (irc.nick, 'ChanServ'):
|
||||||
bm = self.registryValue('banMessage', channel=channel)
|
bm = self.registryValue('banMessage', channel=channel)
|
||||||
if len(bm):
|
if len(bm):
|
||||||
hk = '%s%s' % (m, value)
|
if self.registryValue('discloseOperator', channel=channel):
|
||||||
if hk in chan.update and len(chan.update[hk]) == 4:
|
hk = '%s%s' % (m, value)
|
||||||
if ircutils.isUserHostmask(chan.update[hk][3]):
|
if hk in chan.update and len(chan.update[hk]) == 4:
|
||||||
(nn, ii, hh) = ircutils.splitHostmask(chan.update[hk][3])
|
if ircutils.isUserHostmask(chan.update[hk][3]):
|
||||||
if nn != irc.nick and self.registryValue('discloseOperator', channel=channel):
|
(nn, ii, hh) = ircutils.splitHostmask(chan.update[hk][3])
|
||||||
bm += ' (by %s)' % nn
|
if nn != irc.nick:
|
||||||
elif self.registryValue('proxyMsgOnly', channel=channel):
|
bm += ' (by %s)' % nn
|
||||||
bm = ''
|
elif self.registryValue('proxyMsgOnly', channel=channel):
|
||||||
|
bm = ''
|
||||||
if len(bm):
|
if len(bm):
|
||||||
bm.replace('$channel', channel)
|
bm.replace('$channel', channel)
|
||||||
log.info('[%s] warned %s with: %s' % (channel, nick, bm))
|
log.info('[%s] warned %s with: %s' % (channel, nick, bm))
|
||||||
@ -4401,14 +4401,15 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler):
|
|||||||
if msg.nick in (irc.nick, 'ChanServ'):
|
if msg.nick in (irc.nick, 'ChanServ'):
|
||||||
qm = self.registryValue('quietMessage', channel=channel)
|
qm = self.registryValue('quietMessage', channel=channel)
|
||||||
if len(qm):
|
if len(qm):
|
||||||
hk = '%s%s' % (m, value)
|
if self.registryValue('discloseOperator', channel=channel):
|
||||||
if hk in chan.update and len(chan.update[hk]) == 4:
|
hk = '%s%s' % (m, value)
|
||||||
if ircutils.isUserHostmask(chan.update[hk][3]):
|
if hk in chan.update and len(chan.update[hk]) == 4:
|
||||||
(nn, ii, hh) = ircutils.splitHostmask(chan.update[hk][3])
|
if ircutils.isUserHostmask(chan.update[hk][3]):
|
||||||
if nn != irc.nick and self.registryValue('discloseOperator', channel=channel):
|
(nn, ii, hh) = ircutils.splitHostmask(chan.update[hk][3])
|
||||||
qm += ' (by %s)' % nn
|
if nn != irc.nick:
|
||||||
elif self.registryValue('proxyMsgOnly', channel=channel):
|
qm += ' (by %s)' % nn
|
||||||
qm = ''
|
elif self.registryValue('proxyMsgOnly', channel=channel):
|
||||||
|
qm = ''
|
||||||
if len(qm):
|
if len(qm):
|
||||||
qm.replace('$channel', channel)
|
qm.replace('$channel', channel)
|
||||||
log.info('[%s] warned %s with: %s' % (channel, nick, qm))
|
log.info('[%s] warned %s with: %s' % (channel, nick, qm))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user