[tor-commits] [gettor/master] Add a hack for the 'torfarsi1 at torproject.org' email address.
kaner at torproject.org
kaner at torproject.org
Sun Aug 21 10:25:15 UTC 2011
commit e896a09ce20bcf8c59cd0118c903b72e1133d79a
Author: Christian Fromme <kaner at strace.org>
Date: Sun Aug 21 12:24:23 2011 +0200
Add a hack for the 'torfarsi1 at torproject.org' email address.
---
lib/gettor/filters.py | 11 +++++++++++
lib/gettor/requests.py | 5 ++++-
2 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/lib/gettor/filters.py b/lib/gettor/filters.py
index 558e945..4deacb0 100644
--- a/lib/gettor/filters.py
+++ b/lib/gettor/filters.py
@@ -43,3 +43,14 @@ def checkAddressHack(userAddress):
# User address looks good.
return True
+
+def doToAddressHack(toAddress):
+ """Large HACK alert: If we received an email to the address
+ 'torfarsi1 at torproject.org', we understand it to reply in Farsi to that
+ email.
+ """
+ if re.compile(".*torfarsi1 at torproject.org.*").match(toAddress):
+ return "<gettor+fa at torproject.org>"
+ else:
+ return toAddress
+
diff --git a/lib/gettor/requests.py b/lib/gettor/requests.py
index a61ac14..9cadef5 100644
--- a/lib/gettor/requests.py
+++ b/lib/gettor/requests.py
@@ -9,6 +9,7 @@ import logging
import gettor.utils
import gettor.packages
+import gettor.filters
class requestMail:
def __init__(self, config):
@@ -33,7 +34,9 @@ class requestMail:
in our reply should reflect that. So, use the `To:' field from the
incoming mail, but filter out everything except the gettor@ address.
"""
- regexGettor = '.*(<)?(gettor.*@torproject.org)+(?(1)>).*'
+ regexGettor = '.*(<)?(gettor.*@.*torproject.org)+(?(1)>).*'
+ toField = gettor.filters.doToAddressHack(toField)
+ logging.debug("toField: %s" % toField)
match = re.match(regexGettor, toField)
if match:
return match.group(2)
More information about the tor-commits
mailing list