Made --url into --fancy and made simple URL responses the default.

This commit is contained in:
Jeremy Fincher 2003-09-10 18:15:28 +00:00
parent 176b9b30b6
commit d46f6494e7
2 changed files with 10 additions and 8 deletions

View File

@ -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.
<channel> is only necessary if the
many URLs as can fit in the message. --fancy returns information in
addition to just the URL. <channel> 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)

View File

@ -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')