From 66797de4bfdf64bb79202d220c7914b620e9b52d Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Mon, 3 Nov 2003 06:36:18 +0000 Subject: [PATCH] Changed the name of the quote command to get. --- plugins/Quotes.py | 8 +++++--- test/test_Quotes.py | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/plugins/Quotes.py b/plugins/Quotes.py index e4c77fbc8..1a5c64799 100644 --- a/plugins/Quotes.py +++ b/plugins/Quotes.py @@ -48,7 +48,7 @@ import ircdb import privmsgs import callbacks -class Quotes(plugins.ChannelDBHandler, callbacks.Privmsg): +class Quotes(plugins.ChannelDBHandler, callbacks.Privmsg, plugins.Toggleable): def __init__(self): plugins.ChannelDBHandler.__init__(self) callbacks.Privmsg.__init__(self) @@ -69,7 +69,9 @@ class Quotes(plugins.ChannelDBHandler, callbacks.Privmsg): cursor.execute("""CREATE TABLE quotegrabs ( id INTEGER PRIMARY KEY, nick TEXT, + hostmask TEXT, added_by TEXT, + added_at TIMESTAMP, quote TEXT );""") db.commit() @@ -114,7 +116,7 @@ class Quotes(plugins.ChannelDBHandler, callbacks.Privmsg): s = 'There %s %s %s in my database.' % (utils.be(maxid), maxid, QUOTE) irc.reply(msg, s) - def quote(self, irc, msg, args): + def get(self, irc, msg, args): """[] --{id,regexp,from,with}= ] Returns quote(s) matching the given criteria. --from is who added the @@ -205,7 +207,7 @@ class Quotes(plugins.ChannelDBHandler, callbacks.Privmsg): irc.error(msg, 'It seems that quote database is empty.') return (id,) = cursor.fetchone() - self.quote(irc, msg, [channel, '--id', str(id)]) + self.get(irc, msg, [channel, '--id', str(id)]) def info(self, irc, msg, args): """[] diff --git a/test/test_Quotes.py b/test/test_Quotes.py index 820b1933c..55b58ad6a 100644 --- a/test/test_Quotes.py +++ b/test/test_Quotes.py @@ -43,23 +43,23 @@ if sqlite is not None: self.assertRegexp('num #foo', '0') self.assertRegexp('add #foo foo', 'Quote #1 added') self.assertRegexp('num #foo', '1') - self.assertResponse('quote #foo --id 1', '#1: foo') - self.assertResponse('quote #foo 1', '#1: foo') + self.assertResponse('get #foo --id 1', '#1: foo') + self.assertResponse('get #foo 1', '#1: foo') self.assertRegexp('add #foo bar','Quote #2 added') - self.assertResponse('quote #foo 2', '#2: bar') - self.assertResponse('quote #foo --id 2', '#2: bar') + self.assertResponse('get #foo 2', '#2: bar') + self.assertResponse('get #foo --id 2', '#2: bar') self.assertRegexp('add #foo baz','Quote #3 added') self.assertRegexp('num #foo', '3') - self.assertResponse('quote #foo 3', '#3: baz') - self.assertRegexp('quote #foo --regexp m/ba/', 'bar.*baz') - self.assertRegexp('quote #foo --regexp ba', 'bar.*baz') - self.assertRegexp('quote #foo --with bar', '#2: bar') - self.assertRegexp('quote #foo bar', '#2: bar') + self.assertResponse('get #foo 3', '#3: baz') + self.assertRegexp('get #foo --regexp m/ba/', 'bar.*baz') + self.assertRegexp('get #foo --regexp ba', 'bar.*baz') + self.assertRegexp('get #foo --with bar', '#2: bar') + self.assertRegexp('get #foo bar', '#2: bar') self.assertNotError('info #foo 1') self.assertNotError('random #foo') self.assertError('remove #foo 4') self.assertError('info #foo 4') - self.assertNotError('quote #foo 3') + self.assertNotError('get #foo 3') self.assertNotError('remove #foo 3') self.assertRegexp('num #foo', '2') self.assertNotError('remove #foo 1')