list regexp id in listall (to be used for showing/removing regexp by id)

This commit is contained in:
Daniel F 2010-03-19 13:24:45 -04:00
parent e2d16cb3a7
commit 92389f69ef

View File

@ -275,11 +275,11 @@ class MessageParser(callbacks.Plugin, plugins.ChannelDBHandler):
Lists regexps present in the triggers database. Lists regexps present in the triggers database.
<channel> is only necessary if the message isn't sent in the channel <channel> is only necessary if the message isn't sent in the channel
itself. itself. Regexp ID listed in paretheses.
""" """
db = self.getDb(channel) db = self.getDb(channel)
cursor = db.cursor() cursor = db.cursor()
cursor.execute("SELECT regexp FROM triggers") cursor.execute("SELECT regexp, id FROM triggers")
results = cursor.fetchall() results = cursor.fetchall()
if len(results) != 0: if len(results) != 0:
regexps = results regexps = results
@ -287,7 +287,7 @@ class MessageParser(callbacks.Plugin, plugins.ChannelDBHandler):
irc.reply('There are no regexp triggers in the database.') irc.reply('There are no regexp triggers in the database.')
return return
s = [ regexp[0] for regexp in regexps ] s = [ "%s (%d)" % (regexp[0], regexp[1]) for regexp in regexps ]
irc.reply('"' + '","'.join(s) + '"') irc.reply('"' + '","'.join(s) + '"')
listall = wrap(listall, ['channel']) listall = wrap(listall, ['channel'])