mirror of
https://github.com/ncoevoet/ChanTracker.git
synced 2025-04-26 13:01:06 -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,
|
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"""))
|
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',
|
conf.registerChannelValue(ChanTracker, 'kickMessage',
|
||||||
registry.String("You are banned from this channel", """bot kick reason"""))
|
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:
|
if host.find('/') != -1:
|
||||||
# cloaks
|
# cloaks
|
||||||
if host.startswith('gateway/web/freenode/ip.'):
|
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:
|
else:
|
||||||
# trying to get ip
|
# trying to get ip
|
||||||
if host in cache:
|
if host in cache:
|
||||||
n.ip = cache[host]
|
n.ip = cache[n.prefix]
|
||||||
else:
|
else:
|
||||||
n.setIp(host)
|
n.setIp(host)
|
||||||
if n.ip != None:
|
if n.ip != None:
|
||||||
cache[host] = n.ip
|
cache[n.prefix] = n.ip
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
r = socket.getaddrinfo(host,None)
|
r = socket.getaddrinfo(host,None)
|
||||||
@ -91,12 +91,10 @@ def matchHostmask (pattern,n):
|
|||||||
u[item[4][0]] = item[4][0]
|
u[item[4][0]] = item[4][0]
|
||||||
L.append(item[4][0])
|
L.append(item[4][0])
|
||||||
if len(L) == 1:
|
if len(L) == 1:
|
||||||
cache[host] = L[0]
|
cache[n.prefix] = L[0]
|
||||||
n.setIp(L[0])
|
n.setIp(L[0])
|
||||||
else:
|
|
||||||
cache[host] = None
|
|
||||||
except:
|
except:
|
||||||
cache[host] = None
|
t = t
|
||||||
if n.ip != None and ircutils.hostmaskPatternEqual(pattern,'%s!%s@%s' % (nick,ident,n.ip)):
|
if n.ip != None and ircutils.hostmaskPatternEqual(pattern,'%s!%s@%s' % (nick,ident,n.ip)):
|
||||||
return '%s!%s@%s' % (nick,ident,n.ip)
|
return '%s!%s@%s' % (nick,ident,n.ip)
|
||||||
if ircutils.hostmaskPatternEqual(pattern,n.prefix):
|
if ircutils.hostmaskPatternEqual(pattern,n.prefix):
|
||||||
@ -160,7 +158,7 @@ def match (pattern,n,irc):
|
|||||||
key = pattern + ' :: ' + str(n)
|
key = pattern + ' :: ' + str(n)
|
||||||
if key in cache:
|
if key in cache:
|
||||||
return cache[key]
|
return cache[key]
|
||||||
cache[key] = None
|
#cache[key] = None
|
||||||
extprefix = ''
|
extprefix = ''
|
||||||
extmodes = ''
|
extmodes = ''
|
||||||
if 'extban' in irc.state.supported:
|
if 'extban' in irc.state.supported:
|
||||||
@ -1047,6 +1045,8 @@ class Nick (object):
|
|||||||
# [float(timestamp),target,message]
|
# [float(timestamp),target,message]
|
||||||
|
|
||||||
def setPrefix (self,prefix):
|
def setPrefix (self,prefix):
|
||||||
|
if self.prefix != prefix:
|
||||||
|
self.ip = None
|
||||||
self.prefix = prefix
|
self.prefix = prefix
|
||||||
return self
|
return self
|
||||||
|
|
||||||
@ -3030,8 +3030,9 @@ class ChanTracker(callbacks.Plugin,plugins.ChannelDBHandler):
|
|||||||
if match(active.value,self.getNick(irc,nick),irc):
|
if match(active.value,self.getNick(irc,nick),irc):
|
||||||
tolift.append(active)
|
tolift.append(active)
|
||||||
kicked = False
|
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 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:
|
if nick in irc.state.channels[channel].users and nick != irc.nick:
|
||||||
chan.action.enqueue(ircmsgs.kick(channel,nick,self.registryValue('kickMessage',channel=channel)))
|
chan.action.enqueue(ircmsgs.kick(channel,nick,self.registryValue('kickMessage',channel=channel)))
|
||||||
self.forceTickle = True
|
self.forceTickle = True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user