Use utils.web.httpUrlRe for the Web/ShrinkUrl snarfer regexes.

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
This commit is contained in:
James Vega 2009-10-04 21:41:05 -04:00
parent 22b3ccfbde
commit ca917d3528
2 changed files with 3 additions and 2 deletions

View File

@ -107,7 +107,6 @@ class ShrinkUrl(callbacks.PluginRegexp):
return msg return msg
def shrinkSnarfer(self, irc, msg, match): def shrinkSnarfer(self, irc, msg, match):
r"https?://[^\])>\s]{13,}"
channel = msg.args[0] channel = msg.args[0]
if not irc.isChannel(channel): if not irc.isChannel(channel):
return return
@ -139,6 +138,7 @@ class ShrinkUrl(callbacks.PluginRegexp):
m = irc.reply(s, prefixNick=False) m = irc.reply(s, prefixNick=False)
m.tag('shrunken') m.tag('shrunken')
shrinkSnarfer = urlSnarfer(shrinkSnarfer) shrinkSnarfer = urlSnarfer(shrinkSnarfer)
shrinkSnarfer.__doc__ = utils.web.httpUrlRe
def _getLnUrl(self, url): def _getLnUrl(self, url):
url = utils.web.urlquote(url) url = utils.web.urlquote(url)

View File

@ -1,5 +1,6 @@
### ###
# Copyright (c) 2005, Jeremiah Fincher # Copyright (c) 2005, Jeremiah Fincher
# Copyright (c) 2009, James Vega
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -75,7 +76,6 @@ class Web(callbacks.PluginRegexp):
irc.reply(str(e)) irc.reply(str(e))
def titleSnarfer(self, irc, msg, match): def titleSnarfer(self, irc, msg, match):
r"https?://[^\])>\s]+"
channel = msg.args[0] channel = msg.args[0]
if not irc.isChannel(channel): if not irc.isChannel(channel):
return return
@ -105,6 +105,7 @@ class Web(callbacks.PluginRegexp):
s = format('Title: %s (at %s)', title, domain) s = format('Title: %s (at %s)', title, domain)
irc.reply(s, prefixNick=False) irc.reply(s, prefixNick=False)
titleSnarfer = urlSnarfer(titleSnarfer) titleSnarfer = urlSnarfer(titleSnarfer)
titleSnarfer.__doc__ = utils.web.httpUrlRe
def headers(self, irc, msg, args, url): def headers(self, irc, msg, args, url):
"""<url> """<url>