diff --git a/plugins/QuoteGrabs.py b/plugins/QuoteGrabs.py index c816496f0..ce54e8617 100644 --- a/plugins/QuoteGrabs.py +++ b/plugins/QuoteGrabs.py @@ -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 diff --git a/test/test_QuoteGrabs.py b/test/test_QuoteGrabs.py index 95d238404..6678d8a5d 100644 --- a/test/test_QuoteGrabs.py +++ b/test/test_QuoteGrabs.py @@ -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', ' test') + self.assertRegexp('quotegrabs get 1', + ' test \(Said by: foo!bar@baz on .*?\)') # vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: