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) channel = privmsgs.getChannel(msg, args)
db = self.getDb(channel) db = self.getDb(channel)
cursor = db.cursor() cursor = db.cursor()
cursor.execute("""SELECT quote FROM quotegrabs cursor.execute("""SELECT quote, hostmask, added_at
WHERE id = %s""", id) FROM quotegrabs WHERE id = %s""", id)
if cursor.rowcount == 0: if cursor.rowcount == 0:
irc.error(msg, 'No quotegrab for id %r' % id) irc.error(msg, 'No quotegrab for id %r' % id)
return return
quote = cursor.fetchone()[0] quote, hostmask, timestamp = cursor.fetchone()
irc.reply(msg, quote) 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 Class = QuoteGrabs

View File

@ -91,7 +91,8 @@ class QuoteGrabsTestCase(ChannelPluginTestCase, PluginDocumentation):
self.irc.feedMsg(ircmsgs.privmsg(self.channel, 'test', self.irc.feedMsg(ircmsgs.privmsg(self.channel, 'test',
prefix=testPrefix)) prefix=testPrefix))
self.assertNotError('grab foo') 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: # vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: