From a46476a9ca10a25e69e043ebffc7e94c4cee683c Mon Sep 17 00:00:00 2001 From: James Vega Date: Wed, 5 Nov 2003 20:37:39 +0000 Subject: [PATCH] Remove @url get. Add the snarfed url when replying with the tinyurl. Tests are updated accordingly. @random will display the corresponding tinyurl when someone decides on the display format --- plugins/URL.py | 23 +++-------------------- test/test_URL.py | 3 +-- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/plugins/URL.py b/plugins/URL.py index 6ff4c23b9..6b85d9c4a 100644 --- a/plugins/URL.py +++ b/plugins/URL.py @@ -50,6 +50,7 @@ import conf import debug import utils import ircmsgs +import ircutils import privmsgs import callbacks @@ -136,8 +137,8 @@ class URL(callbacks.Privmsg, plugins.Toggleable, plugins.ChannelDBHandler): cursor.execute("""INSERT INTO tinyurls VALUES (NULL, %s, %s)""", id, tinyurl) if self.toggles.get('tinyreply', channel=msg.args[0]): - irc.queueMsg(callbacks.reply(msg, 'TinyURL: %s' % - tinyurl, prefixName=False)) + irc.queueMsg(callbacks.reply(msg, '%s (was %s)' % + (ircutils.bold(tinyurl), url), prefixName=False)) key = (msg.nick, channel) self.nextMsgs.setdefault(key, []).append((url, added)) db.commit() @@ -202,24 +203,6 @@ class URL(callbacks.Privmsg, plugins.Toggleable, plugins.ChannelDBHandler): else: irc.reply(msg, url) - def get(self, irc, msg, args): - """[] - - Gets the URL with id from the URL database for . - is only necessary if not sent in the channel itself. - """ - channel = privmsgs.getChannel(msg, args) - db = self.getDb(channel) - cursor = db.cursor() - id = privmsgs.getArgs(args) - cursor.execute("""SELECT url, added, added_by - FROM urls - WHERE id=%s""", id) - if cursor.rowcount == 0: - irc.reply(msg, 'No URL was found with that id.') - else: - irc.reply(msg, self._formatUrl(*cursor.fetchone())) - def num(self, irc, msg, args): """[] diff --git a/test/test_URL.py b/test/test_URL.py index 5ba3d2337..0eb9c07f5 100644 --- a/test/test_URL.py +++ b/test/test_URL.py @@ -83,7 +83,6 @@ if sqlite is not None: self.assertRegexp('url num', str(counter)) self.feedMsg(url) counter += 1 - self.assertNotError('url get %s' % counter) self.assertRegexp('url num', str(counter)) self.assertRegexp('url last', re.escape(urls[-1])) @@ -128,7 +127,7 @@ if sqlite is not None: self.assertNotError('url toggle tinyreply on') self.assertRegexp('http://sourceforge.net/tracker/?'\ 'func=add&group_id=58965&atid=489447', - r'TinyURL: http://tinyurl.com/\w{4}') + r'http://tinyurl.com/\w{4}.* \(was') # vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: