From d46f6494e7cc111162b3c7cc43698a866e999ec2 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Wed, 10 Sep 2003 18:15:28 +0000 Subject: [PATCH] Made --url into --fancy and made simple URL responses the default. --- plugins/URLSnarfer.py | 14 ++++++-------- test/test_URLSnarfer.py | 4 ++++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/plugins/URLSnarfer.py b/plugins/URLSnarfer.py index a7bbc0510..676492984 100644 --- a/plugins/URLSnarfer.py +++ b/plugins/URLSnarfer.py @@ -205,8 +205,6 @@ class URLSnarfer(callbacks.Privmsg, ChannelDBHandler): """ if '--nolimit' not in args: args.append('--nolimit') - while '--url' in args: - args.remove('--url') self.lasturl(irc, msg, args) def lasturl(self, irc, msg, args): @@ -216,24 +214,24 @@ class URLSnarfer(callbacks.Privmsg, ChannelDBHandler): the URL came; --at is the site of the URL; --proto is the protocol the URL used; --with is something inside the URL; --near is a string in the messages before and after the link. If --nolimit is given, returns as - many URLs as can fit in the message. --url returns just the url. - is only necessary if the + many URLs as can fit in the message. --fancy returns information in + addition to just the URL. is only necessary if the message isn't sent in the channel itself. """ channel = privmsgs.getChannel(msg, args) (optlist, rest) = getopt.getopt(args, '', ['from=', 'with=', 'at=', 'proto=', 'near=', - 'nolimit', 'url']) + 'nolimit', 'fancy']) criteria = ['1=1'] formats = [] - simple = False + simple = True nolimit = False for (option, argument) in optlist: option = option.lstrip('-') # Strip off the --. if option == 'nolimit': nolimit = True - if option == 'url': - simple = True + if option == 'fancy': + simple = False elif option == 'from': criteria.append('added_by LIKE %s') formats.append(argument) diff --git a/test/test_URLSnarfer.py b/test/test_URLSnarfer.py index f684b9df1..440ff0370 100644 --- a/test/test_URLSnarfer.py +++ b/test/test_URLSnarfer.py @@ -86,6 +86,10 @@ class URLSnarferTestCase(ChannelPluginTestCase, PluginDocumentation): self.assertRegexp('lasturl --from alsdkjf', '^No') self.assertNotError('randomurl') + def testDefaultNotFancy(self): + self.feedMsg(urls[0]) + self.assertResponse('lasturl', urls[0]) + def testAction(self): self.irc.feedMsg(ircmsgs.action(self.channel, urls[1])) self.assertNotRegexp('lasturl', '\\x01')