mirror of
https://github.com/ncoevoet/ChanTracker.git
synced 2025-04-29 06:51:09 -05:00
Merge branch 'master' of https://github.com/ncoevoet/ChanTracker
This commit is contained in:
commit
c84efa30c2
@ -138,6 +138,9 @@ conf.registerChannelValue(ChanTracker, 'kickMode',
|
|||||||
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"""))
|
||||||
|
|
||||||
|
conf.registerChannelValue(ChanTracker, 'addKickMessageInComment',
|
||||||
|
registry.Boolean(False, """add kick message to mode comment"""))
|
||||||
|
|
||||||
conf.registerChannelValue(ChanTracker, 'askOpAboutMode',
|
conf.registerChannelValue(ChanTracker, 'askOpAboutMode',
|
||||||
registry.Boolean(False,"""Ask the op who added a mode changes in pm about duration and comment"""))
|
registry.Boolean(False,"""Ask the op who added a mode changes in pm about duration and comment"""))
|
||||||
|
|
||||||
|
26
plugin.py
26
plugin.py
@ -60,7 +60,7 @@ def matchHostmask (pattern,n):
|
|||||||
(nick,ident,host) = ircutils.splitHostmask(n.prefix)
|
(nick,ident,host) = ircutils.splitHostmask(n.prefix)
|
||||||
if host.find('/') != -1:
|
if host.find('/') != -1:
|
||||||
# cloaks
|
# cloaks
|
||||||
if n.ip == None and host.startswith('gateway/web/freenode/ip.'):
|
if host.startswith('gateway/web/freenode/ip.'):
|
||||||
n.ip = cache[host] = host.split('ip.')[1]
|
n.ip = cache[host] = host.split('ip.')[1]
|
||||||
else:
|
else:
|
||||||
# trying to get ip
|
# trying to get ip
|
||||||
@ -87,6 +87,7 @@ def matchHostmask (pattern,n):
|
|||||||
cache[host] = None
|
cache[host] = None
|
||||||
except:
|
except:
|
||||||
cache[host] = None
|
cache[host] = None
|
||||||
|
self.log.debug('checking %s / %s' % (pattern,n))
|
||||||
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):
|
||||||
@ -404,7 +405,8 @@ class Ircd (object):
|
|||||||
results.append(s)
|
results.append(s)
|
||||||
else:
|
else:
|
||||||
s = 'was active %s and ended on [%s]' % (utils.timeElapsed(removed_at-begin_at),floatToGMT(removed_at))
|
s = 'was active %s and ended on [%s]' % (utils.timeElapsed(removed_at-begin_at),floatToGMT(removed_at))
|
||||||
s = s + ' for %s' % utils.timeElapsed(end_at-begin_at)
|
if end_at != begin_at:
|
||||||
|
s = s + ' ,initialy for %s' % utils.timeElapsed(end_at-begin_at)
|
||||||
results.append(s)
|
results.append(s)
|
||||||
c.execute("""SELECT oper, comment FROM comments WHERE ban_id=? ORDER BY at DESC""",(uid,))
|
c.execute("""SELECT oper, comment FROM comments WHERE ban_id=? ORDER BY at DESC""",(uid,))
|
||||||
L = c.fetchall()
|
L = c.fetchall()
|
||||||
@ -967,7 +969,7 @@ class Nick (object):
|
|||||||
return self
|
return self
|
||||||
|
|
||||||
def setIp (self,ip):
|
def setIp (self,ip):
|
||||||
if ip != None and not ip == self.ip and not ip == '255.255.255.255' and utils.net.isIP(ip):
|
if not ip == self.ip and not ip == '255.255.255.255' and utils.net.isIP(ip):
|
||||||
self.ip = ip
|
self.ip = ip
|
||||||
return self
|
return self
|
||||||
|
|
||||||
@ -1976,6 +1978,24 @@ class ChanTracker(callbacks.Plugin,plugins.ChannelDBHandler):
|
|||||||
n.addLog(channel,'kicked by %s (%s)' % (msg.prefix,reason))
|
n.addLog(channel,'kicked by %s (%s)' % (msg.prefix,reason))
|
||||||
if self.registryValue('announceKick',channel=channel):
|
if self.registryValue('announceKick',channel=channel):
|
||||||
self._logChan(irc,channel,'[%s] %s kicked by %s (%s)' % (channel,n.prefix,msg.prefix,reason))
|
self._logChan(irc,channel,'[%s] %s kicked by %s (%s)' % (channel,n.prefix,msg.prefix,reason))
|
||||||
|
if len(reason) and msg.prefix != irc.prefix and self.registryValue('addKickMessageInComment',channel=channel):
|
||||||
|
chan = self.getChan(irc,channel)
|
||||||
|
found = None
|
||||||
|
for mode in self.registryValue('modesToAsk',channel=channel):
|
||||||
|
items = chan.getItemsFor(mode)
|
||||||
|
for k in items:
|
||||||
|
item = items[k]
|
||||||
|
f = match(item.value,n,irc)
|
||||||
|
if f:
|
||||||
|
found = item
|
||||||
|
break
|
||||||
|
if found:
|
||||||
|
break
|
||||||
|
if found:
|
||||||
|
f = None
|
||||||
|
if self.registryValue('announceBotMark',channel=channel):
|
||||||
|
f = self._logChan
|
||||||
|
i.mark(irc,found.uid,'kicked by %s (%s)' % (msg.nick,reason),irc.prefix,self.getDb(irc.network),f)
|
||||||
self._tickle(irc)
|
self._tickle(irc)
|
||||||
|
|
||||||
def _rmNick (self,irc,n):
|
def _rmNick (self,irc,n):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user