Added hostmask and added_at to the 'get' command, to reveal impostors!

This commit is contained in:
Daniel DiPaolo 2003-11-06 21:50:23 +00:00
parent abbe99fd8c
commit 54aec8d3b2
2 changed files with 8 additions and 5 deletions

View File

@ -210,13 +210,15 @@ class QuoteGrabs(plugins.ChannelDBHandler,
channel = privmsgs.getChannel(msg, args)
db = self.getDb(channel)
cursor = db.cursor()
cursor.execute("""SELECT quote FROM quotegrabs
WHERE id = %s""", id)
cursor.execute("""SELECT quote, hostmask, added_at
FROM quotegrabs WHERE id = %s""", id)
if cursor.rowcount == 0:
irc.error(msg, 'No quotegrab for id %r' % id)
return
quote = cursor.fetchone()[0]
irc.reply(msg, quote)
quote, hostmask, timestamp = cursor.fetchone()
time_str = time.strftime(conf.humanTimestampFormat,
time.localtime(float(timestamp)))
irc.reply(msg, '%s (Said by: %s on %s)' % (quote, hostmask, time_str))
Class = QuoteGrabs

View File

@ -91,7 +91,8 @@ class QuoteGrabsTestCase(ChannelPluginTestCase, PluginDocumentation):
self.irc.feedMsg(ircmsgs.privmsg(self.channel, 'test',
prefix=testPrefix))
self.assertNotError('grab foo')
self.assertResponse('quotegrabs get 1', '<foo> test')
self.assertRegexp('quotegrabs get 1',
'<foo> test \(Said by: foo!bar@baz on .*?\)')
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: