From e201c7e1a551247ac76e9d281a91b723b7912b69 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Tue, 22 May 2012 07:33:40 -0400 Subject: fixed two bugs in the signature detection code --- askbot/lamson_handlers.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/askbot/lamson_handlers.py b/askbot/lamson_handlers.py index f6b6b752..13797752 100644 --- a/askbot/lamson_handlers.py +++ b/askbot/lamson_handlers.py @@ -203,7 +203,7 @@ def ASK(message, host = None, addr = None): except Tag.MultipleObjectsReturned: return -@route('welcome-(address)@host', address='.+') +@route('welcome-(address)@(host)', address='.+') @stateless @process_reply def VALIDATE_EMAIL( @@ -222,10 +222,16 @@ def VALIDATE_EMAIL( #extract the signature tail = list() for line in reversed(content.splitlines()): + #scan backwards from the end until the magic line if reply_code in line: break - tail.append(line) - signature = '\n'.join(reversed(tail)) + tail.insert(0, line) + + #strip off the leading quoted lines, there could be one or two + while tail[0].startswith('>'): + line.pop(0) + + signature = '\n'.join(tail) #save the signature and mark email as valid user = reply_address_object.user -- cgit v1.2.3-1-g7c22