From b38b2be021b6b0a82b93ed6bc19d4c03768adb40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=A9munaire?= Date: Wed, 28 Nov 2012 15:00:01 +0100 Subject: [PATCH] YCC module: can reduce more than one URL per message --- modules/ycc.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/modules/ycc.py b/modules/ycc.py index 104d78a..a072938 100644 --- a/modules/ycc.py +++ b/modules/ycc.py @@ -56,17 +56,15 @@ def cmd_ycc(msg): def parselisten(msg): global LAST_URLS - res = re.match("([a-zA-Z0-9+.-]+:(//)?[^ ]*)", msg.content) - if res is not None: - url = res.group(1) + urls = re.findall("([a-zA-Z0-9+.-]+:(//)?[^ ]+)", msg.content) + for (url, osef) in urls: o = urlparse(url) if o.scheme != "": if o.netloc == "ycc.fr" or (o.netloc == "" and len(o.path) < 10): - return False + continue if msg.channel not in LAST_URLS: LAST_URLS[msg.channel] = list() LAST_URLS[msg.channel].append(o.geturl()) - return True return False def parseresponse(res):