mirror of
https://github.com/ncoevoet/ChanTracker.git
synced 2025-04-26 04:51:07 -05:00
fix #31
This commit is contained in:
parent
9c53e66bf8
commit
e43d2c999e
@ -102,6 +102,8 @@ conf.registerChannelValue(ChanTracker, 'autoExpire',
|
|||||||
registry.Integer(-1, """default expiration time for newly placed bans; -1 disables auto-expiration, otherwise it's in seconds"""))
|
registry.Integer(-1, """default expiration time for newly placed bans; -1 disables auto-expiration, otherwise it's in seconds"""))
|
||||||
conf.registerChannelValue(ChanTracker, 'autoRemoveUnregisteredQuiets',
|
conf.registerChannelValue(ChanTracker, 'autoRemoveUnregisteredQuiets',
|
||||||
registry.Boolean(True, """auto remove from database unregistered quiets once expired -q $~a"""))
|
registry.Boolean(True, """auto remove from database unregistered quiets once expired -q $~a"""))
|
||||||
|
conf.registerChannelValue(ChanTracker, 'allowPublicInfo',
|
||||||
|
registry.Boolean(False, """allow !info to be returned in where it was called if True"""))
|
||||||
|
|
||||||
conf.registerChannelValue(ChanTracker, 'removeAllBans',
|
conf.registerChannelValue(ChanTracker, 'removeAllBans',
|
||||||
registry.Boolean(False, """prevent accidental removal of all bans"""))
|
registry.Boolean(False, """prevent accidental removal of all bans"""))
|
||||||
|
26
plugin.py
26
plugin.py
@ -399,29 +399,29 @@ class Ircd(object):
|
|||||||
return []
|
return []
|
||||||
results = []
|
results = []
|
||||||
current = time.time()
|
current = time.time()
|
||||||
results.append('[%s] [%s] %s sets +%s %s' % (
|
results.append([channel, '[%s] [%s] %s sets +%s %s' % (
|
||||||
channel, floatToGMT(begin_at), oper, kind, mask))
|
channel, floatToGMT(begin_at), oper, kind, mask)])
|
||||||
if not removed_at:
|
if not removed_at:
|
||||||
if begin_at == end_at:
|
if begin_at == end_at:
|
||||||
results.append('set forever')
|
results.append([channel, 'set forever'])
|
||||||
else:
|
else:
|
||||||
s = 'set for %s' % utils.timeElapsed(end_at-begin_at)
|
s = 'set for %s' % utils.timeElapsed(end_at-begin_at)
|
||||||
s = s + ' with %s more' % utils.timeElapsed(end_at-current)
|
s = s + ' with %s more' % utils.timeElapsed(end_at-current)
|
||||||
s = s + ' and ends at [%s]' % floatToGMT(end_at)
|
s = s + ' and ends at [%s]' % floatToGMT(end_at)
|
||||||
results.append(s)
|
results.append([channel, s])
|
||||||
else:
|
else:
|
||||||
s = 'was active %s and ended on [%s]' % (
|
s = 'was active %s and ended on [%s]' % (
|
||||||
utils.timeElapsed(removed_at-begin_at), floatToGMT(removed_at))
|
utils.timeElapsed(removed_at-begin_at), floatToGMT(removed_at))
|
||||||
if end_at != begin_at:
|
if end_at != begin_at:
|
||||||
s = s + ', initially for %s' % utils.timeElapsed(end_at-begin_at)
|
s = s + ', initially for %s' % utils.timeElapsed(end_at-begin_at)
|
||||||
s = s + ', removed by %s' % removed_by
|
s = s + ', removed by %s' % removed_by
|
||||||
results.append(s)
|
results.append([channel,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()
|
||||||
if len(L):
|
if len(L):
|
||||||
for com in L:
|
for com in L:
|
||||||
(oper, comment) = com
|
(oper, comment) = com
|
||||||
results.append('"%s" by %s' % (comment, oper))
|
results.append([channel,'"%s" by %s' % (comment, oper)])
|
||||||
c.execute("""SELECT full,log FROM nicks WHERE ban_id=?""", (uid,))
|
c.execute("""SELECT full,log FROM nicks WHERE ban_id=?""", (uid,))
|
||||||
L = c.fetchall()
|
L = c.fetchall()
|
||||||
if len(L) == 1:
|
if len(L) == 1:
|
||||||
@ -431,9 +431,9 @@ class Ircd(object):
|
|||||||
for line in log.split('\n'):
|
for line in log.split('\n'):
|
||||||
message = '%s' % line
|
message = '%s' % line
|
||||||
break
|
break
|
||||||
results.append(message)
|
results.append([channel,message])
|
||||||
elif len(L) > 1:
|
elif len(L) > 1:
|
||||||
results.append('affects %s users' % len(L))
|
results.append([channel,'affects %s users' % len(L)])
|
||||||
# if len(L):
|
# if len(L):
|
||||||
# for affected in L:
|
# for affected in L:
|
||||||
# (full, log) = affected
|
# (full, log) = affected
|
||||||
@ -1676,8 +1676,14 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler):
|
|||||||
i = self.getIrc(irc)
|
i = self.getIrc(irc)
|
||||||
results = i.info(irc, uid, msg.prefix, self.getDb(irc.network))
|
results = i.info(irc, uid, msg.prefix, self.getDb(irc.network))
|
||||||
if len(results):
|
if len(results):
|
||||||
for message in results:
|
if self.registryValue('allowPublicInfo', channel=results[0][0], network=irc.network):
|
||||||
irc.queueMsg(ircmsgs.privmsg(msg.nick, message))
|
msgs = []
|
||||||
|
for message in results:
|
||||||
|
msgs.append(message[1])
|
||||||
|
irc.replies(msgs, None, None, True, None)
|
||||||
|
else:
|
||||||
|
for message in results:
|
||||||
|
irc.queueMsg(ircmsgs.privmsg(msg.nick, message[1]))
|
||||||
else:
|
else:
|
||||||
irc.reply('item not found or not enough rights to see information')
|
irc.reply('item not found or not enough rights to see information')
|
||||||
self.forceTickle = True
|
self.forceTickle = True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user