YCC module: can reduce more than one URL per message
This commit is contained in:
parent
9495e43cc0
commit
b38b2be021
@ -56,17 +56,15 @@ def cmd_ycc(msg):
|
|||||||
|
|
||||||
def parselisten(msg):
|
def parselisten(msg):
|
||||||
global LAST_URLS
|
global LAST_URLS
|
||||||
res = re.match("([a-zA-Z0-9+.-]+:(//)?[^ ]*)", msg.content)
|
urls = re.findall("([a-zA-Z0-9+.-]+:(//)?[^ ]+)", msg.content)
|
||||||
if res is not None:
|
for (url, osef) in urls:
|
||||||
url = res.group(1)
|
|
||||||
o = urlparse(url)
|
o = urlparse(url)
|
||||||
if o.scheme != "":
|
if o.scheme != "":
|
||||||
if o.netloc == "ycc.fr" or (o.netloc == "" and len(o.path) < 10):
|
if o.netloc == "ycc.fr" or (o.netloc == "" and len(o.path) < 10):
|
||||||
return False
|
continue
|
||||||
if msg.channel not in LAST_URLS:
|
if msg.channel not in LAST_URLS:
|
||||||
LAST_URLS[msg.channel] = list()
|
LAST_URLS[msg.channel] = list()
|
||||||
LAST_URLS[msg.channel].append(o.geturl())
|
LAST_URLS[msg.channel].append(o.geturl())
|
||||||
return True
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def parseresponse(res):
|
def parseresponse(res):
|
||||||
|
Loading…
Reference in New Issue
Block a user