mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-17 06:00:42 +01:00
Made --url into --fancy and made simple URL responses the default.
This commit is contained in:
parent
176b9b30b6
commit
d46f6494e7
@ -205,8 +205,6 @@ class URLSnarfer(callbacks.Privmsg, ChannelDBHandler):
|
|||||||
"""
|
"""
|
||||||
if '--nolimit' not in args:
|
if '--nolimit' not in args:
|
||||||
args.append('--nolimit')
|
args.append('--nolimit')
|
||||||
while '--url' in args:
|
|
||||||
args.remove('--url')
|
|
||||||
self.lasturl(irc, msg, args)
|
self.lasturl(irc, msg, args)
|
||||||
|
|
||||||
def lasturl(self, 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
|
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
|
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
|
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.
|
many URLs as can fit in the message. --fancy returns information in
|
||||||
<channel> is only necessary if the
|
addition to just the URL. <channel> is only necessary if the
|
||||||
message isn't sent in the channel itself.
|
message isn't sent in the channel itself.
|
||||||
"""
|
"""
|
||||||
channel = privmsgs.getChannel(msg, args)
|
channel = privmsgs.getChannel(msg, args)
|
||||||
(optlist, rest) = getopt.getopt(args, '', ['from=', 'with=', 'at=',
|
(optlist, rest) = getopt.getopt(args, '', ['from=', 'with=', 'at=',
|
||||||
'proto=', 'near=',
|
'proto=', 'near=',
|
||||||
'nolimit', 'url'])
|
'nolimit', 'fancy'])
|
||||||
criteria = ['1=1']
|
criteria = ['1=1']
|
||||||
formats = []
|
formats = []
|
||||||
simple = False
|
simple = True
|
||||||
nolimit = False
|
nolimit = False
|
||||||
for (option, argument) in optlist:
|
for (option, argument) in optlist:
|
||||||
option = option.lstrip('-') # Strip off the --.
|
option = option.lstrip('-') # Strip off the --.
|
||||||
if option == 'nolimit':
|
if option == 'nolimit':
|
||||||
nolimit = True
|
nolimit = True
|
||||||
if option == 'url':
|
if option == 'fancy':
|
||||||
simple = True
|
simple = False
|
||||||
elif option == 'from':
|
elif option == 'from':
|
||||||
criteria.append('added_by LIKE %s')
|
criteria.append('added_by LIKE %s')
|
||||||
formats.append(argument)
|
formats.append(argument)
|
||||||
|
@ -86,6 +86,10 @@ class URLSnarferTestCase(ChannelPluginTestCase, PluginDocumentation):
|
|||||||
self.assertRegexp('lasturl --from alsdkjf', '^No')
|
self.assertRegexp('lasturl --from alsdkjf', '^No')
|
||||||
self.assertNotError('randomurl')
|
self.assertNotError('randomurl')
|
||||||
|
|
||||||
|
def testDefaultNotFancy(self):
|
||||||
|
self.feedMsg(urls[0])
|
||||||
|
self.assertResponse('lasturl', urls[0])
|
||||||
|
|
||||||
def testAction(self):
|
def testAction(self):
|
||||||
self.irc.feedMsg(ircmsgs.action(self.channel, urls[1]))
|
self.irc.feedMsg(ircmsgs.action(self.channel, urls[1]))
|
||||||
self.assertNotRegexp('lasturl', '\\x01')
|
self.assertNotRegexp('lasturl', '\\x01')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user