Moved _urlRe to webutils as urlRe.

This commit is contained in:
Jeremy Fincher 2004-01-04 11:18:53 +00:00
parent 61eb55fa57
commit 669ac8995f
2 changed files with 4 additions and 2 deletions

View File

@ -147,7 +147,6 @@ class URL(callbacks.PrivmsgCommandAndRegexp,
db.commit() db.commit()
return db return db
_urlRe = re.compile(r"(\w+://[^\])>\s]+)", re.I)
def doPrivmsg(self, irc, msg): def doPrivmsg(self, irc, msg):
channel = msg.args[0] channel = msg.args[0]
db = self.getDb(channel) db = self.getDb(channel)
@ -162,7 +161,7 @@ class URL(callbacks.PrivmsgCommandAndRegexp,
text = ircmsgs.unAction(msg) text = ircmsgs.unAction(msg)
else: else:
text = msg.args[1] text = msg.args[1]
for url in self._urlRe.findall(text): for url in webutils.urlRe.findall(text):
r = self.configurables.get('non-snarfing-regexp', channel) r = self.configurables.get('non-snarfing-regexp', channel)
if r and r.search(url): if r and r.search(url):
continue continue

View File

@ -33,12 +33,15 @@ __revision__ = "$Id$"
import fix import fix
import re
import socket import socket
import urllib2 import urllib2
class WebError(Exception): class WebError(Exception):
pass pass
urlRe = re.compile(r"(\w+://[^\])>\s]+)", re.I)
def getUrlFd(url): def getUrlFd(url):
"""Gets a file-like object for a url.""" """Gets a file-like object for a url."""
try: try: