commit e896a09ce20bcf8c59cd0118c903b72e1133d79a
Author: Christian Fromme <[email protected]>
Date:   Sun Aug 21 12:24:23 2011 +0200

    Add a hack for the '[email protected]' 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
+       '[email protected]', we understand it to reply in Farsi to that
+       email.
+    """
+    if re.compile(".*[email protected].*").match(toAddress):
+        return "<[email protected]>"
+    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)

_______________________________________________
tor-commits mailing list
[email protected]
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits

Reply via email to