Use zero-width characters for message loop checking.

(imported from commit 61f6dca96cd1d8431258afc0181e71d5b709e300)
This commit is contained in:
Tim Abbott 2012-09-28 15:45:11 -04:00
parent 0a4366ea6b
commit 06ee153faa
1 changed files with 6 additions and 5 deletions

View File

@ -115,10 +115,11 @@ def process_loop(log):
zsig, body = notice.message.split("\x00", 1)
is_personal = False
is_huddle = False
if zsig.endswith("`") and zsig.startswith("`"):
print "Skipping message from Humbug!"
continue
if isinstance(zsig, str):
# Check for width unicode character u'\u200B'.encode("utf-8")
if u'\u200B'.encode("utf-8") in zsig:
print "Skipping message from Humbug!"
continue
sender = notice.sender.lower().replace("athena.mit.edu", "mit.edu")
recipient = notice.recipient.lower().replace("athena.mit.edu", "mit.edu")
@ -217,7 +218,7 @@ def get_new_zephyrs():
return simplejson.loads(res.read())['zephyrs']
def send_zephyr(message):
zsig = "`%s`" % (username_to_fullname(message["sender_email"]))
zsig = u"%s\u200B" % (username_to_fullname(message["sender_email"]))
if ' dot ' in zsig:
print "ERROR! Couldn't compute zsig for %s!" % (message["sender_email"])
return