Add Bantracker search option to include or ignore marks.

This commit is contained in:
Robert Wall 2014-04-14 21:08:43 -07:00
parent 2cef319400
commit 7105e74996

View File

@ -304,6 +304,7 @@ print '<div style="float:left">'
makeInput("kicks", "Kicks") makeInput("kicks", "Kicks")
makeInput("bans", "Bans") makeInput("bans", "Bans")
makeInput("oldbans", "Removed bans") makeInput("oldbans", "Removed bans")
makeInput("marks", "Marks")
print '</div>' print '</div>'
print '<div style="float:left">' print '<div style="float:left">'
@ -324,7 +325,7 @@ if not haveQuery:
send_page('bans.tmpl') send_page('bans.tmpl')
# Select and filter bans # Select and filter bans
def getBans(id=None, mask=None, kicks=True, oldbans=True, bans=True, floodbots=True, operator=None, def getBans(id=None, mask=None, kicks=True, oldbans=True, bans=True, marks=True, floodbots=True, operator=None,
channel=None, limit=None, offset=0, withCount=False): channel=None, limit=None, offset=0, withCount=False):
sql = "SELECT channel, mask, operator, time, removal, removal_op, id FROM bans" sql = "SELECT channel, mask, operator, time, removal, removal_op, id FROM bans"
args = [] args = []
@ -343,6 +344,8 @@ def getBans(id=None, mask=None, kicks=True, oldbans=True, bans=True, floodbots=T
if channel: if channel:
where.append("channel LIKE %s") where.append("channel LIKE %s")
args.append(channel) args.append(channel)
if not marks:
where.append("id NOT IN (SELECT ban_id FROM comments WHERE comment LIKE '**MARK**%%')")
if not kicks: if not kicks:
where.append("mask LIKE '%%!%%'") where.append("mask LIKE '%%!%%'")
if not (oldbans or bans): if not (oldbans or bans):
@ -424,6 +427,7 @@ if not bans:
bans, ban_count = getBans(mask=query, kicks=isOn('kicks'), bans, ban_count = getBans(mask=query, kicks=isOn('kicks'),
oldbans=isOn('oldbans') or isOn('oldmutes'), oldbans=isOn('oldbans') or isOn('oldmutes'),
bans=isOn('bans') or isOn('mutes'), bans=isOn('bans') or isOn('mutes'),
marks=isOn('marks'),
floodbots=isOn('floodbots'), floodbots=isOn('floodbots'),
operator=oper, operator=oper,
channel=chan, channel=chan,