fix loop bug on multiple URL given

This commit is contained in:
urlbot
2014-12-14 16:01:09 +01:00
parent e2e16896b5
commit 54c590051c

View File

@@ -148,6 +148,7 @@ def extract_url(data, msg_obj):
return return
ret = None ret = None
out = []
for url in result: for url in result:
ratelimit_touch() ratelimit_touch()
if ratelimit_exceeded(msg_obj): if ratelimit_exceeded(msg_obj):
@@ -158,6 +159,7 @@ def extract_url(data, msg_obj):
if not None is re.match(b, url): if not None is re.match(b, url):
flag = True flag = True
logger('info', 'url blacklist match for ' + url) logger('info', 'url blacklist match for ' + url)
break
if flag: if flag:
# an URL has matched the blacklist, continue to the next URL # an URL has matched the blacklist, continue to the next URL
@@ -204,10 +206,13 @@ def extract_url(data, msg_obj):
message = message.replace('\n', '\\n') message = message.replace('\n', '\\n')
logger('info', 'printing ' + message) logger('info', 'adding to out buf: ' + message)
send_reply(message, msg_obj) out.append(message)
ret = True ret = True
if True == ret:
send_reply(out, msg_obj)
return ret return ret
def handle_msg(msg_obj): def handle_msg(msg_obj):