mirror of
https://github.com/ncoevoet/ChanTracker.git
synced 2025-04-26 04:51:07 -05:00
various fix
This commit is contained in:
parent
c408579355
commit
d8f41d45ac
@ -149,6 +149,9 @@ conf.registerChannelValue(ChanTracker, 'kickMode',
|
||||
registry.CommaSeparatedListOfStrings(['b'], """bot will kick affected users when mode is triggered,
|
||||
use if with caution, if an op bans *!*@*, bot will kick everyone on the channel"""))
|
||||
|
||||
conf.registerChannelValue(ChanTracker, 'kickMax',
|
||||
registry.Integer(-1,"""if > 0, disable kick if affected users > kickMax, avoid to cleanup entire channel with ban like *!*@*"""))
|
||||
|
||||
conf.registerChannelValue(ChanTracker, 'kickMessage',
|
||||
registry.String("You are banned from this channel", """bot kick reason"""))
|
||||
|
||||
|
19
plugin.py
19
plugin.py
@ -71,15 +71,15 @@ def matchHostmask (pattern,n):
|
||||
if host.find('/') != -1:
|
||||
# cloaks
|
||||
if host.startswith('gateway/web/freenode/ip.'):
|
||||
n.ip = cache[host] = host.split('ip.')[1]
|
||||
n.ip = cache[n.prefix] = host.split('ip.')[1]
|
||||
else:
|
||||
# trying to get ip
|
||||
if host in cache:
|
||||
n.ip = cache[host]
|
||||
n.ip = cache[n.prefix]
|
||||
else:
|
||||
n.setIp(host)
|
||||
if n.ip != None:
|
||||
cache[host] = n.ip
|
||||
cache[n.prefix] = n.ip
|
||||
else:
|
||||
try:
|
||||
r = socket.getaddrinfo(host,None)
|
||||
@ -91,12 +91,10 @@ def matchHostmask (pattern,n):
|
||||
u[item[4][0]] = item[4][0]
|
||||
L.append(item[4][0])
|
||||
if len(L) == 1:
|
||||
cache[host] = L[0]
|
||||
cache[n.prefix] = L[0]
|
||||
n.setIp(L[0])
|
||||
else:
|
||||
cache[host] = None
|
||||
except:
|
||||
cache[host] = None
|
||||
t = t
|
||||
if n.ip != None and ircutils.hostmaskPatternEqual(pattern,'%s!%s@%s' % (nick,ident,n.ip)):
|
||||
return '%s!%s@%s' % (nick,ident,n.ip)
|
||||
if ircutils.hostmaskPatternEqual(pattern,n.prefix):
|
||||
@ -160,7 +158,7 @@ def match (pattern,n,irc):
|
||||
key = pattern + ' :: ' + str(n)
|
||||
if key in cache:
|
||||
return cache[key]
|
||||
cache[key] = None
|
||||
#cache[key] = None
|
||||
extprefix = ''
|
||||
extmodes = ''
|
||||
if 'extban' in irc.state.supported:
|
||||
@ -1047,6 +1045,8 @@ class Nick (object):
|
||||
# [float(timestamp),target,message]
|
||||
|
||||
def setPrefix (self,prefix):
|
||||
if self.prefix != prefix:
|
||||
self.ip = None
|
||||
self.prefix = prefix
|
||||
return self
|
||||
|
||||
@ -3030,8 +3030,9 @@ class ChanTracker(callbacks.Plugin,plugins.ChannelDBHandler):
|
||||
if match(active.value,self.getNick(irc,nick),irc):
|
||||
tolift.append(active)
|
||||
kicked = False
|
||||
if m in self.registryValue('kickMode',channel=channel) and msg.nick == irc.nick: # and not value.startswith(self.getIrcdExtbans(irc)) works for unreal
|
||||
if m in self.registryValue('kickMode',channel=channel): # and not value.startswith(self.getIrcdExtbans(irc)) works for unreal
|
||||
if msg.nick == irc.nick or msg.nick == 'ChanServ':
|
||||
if self.registryValue('kickMax',channel=channel) < 0 or len(item.affects) < self.registryValue('kickMax',channel=channel):
|
||||
if nick in irc.state.channels[channel].users and nick != irc.nick:
|
||||
chan.action.enqueue(ircmsgs.kick(channel,nick,self.registryValue('kickMessage',channel=channel)))
|
||||
self.forceTickle = True
|
||||
|
Loading…
x
Reference in New Issue
Block a user