Get user feedback.

This commit is contained in:
Stuart Gathman
2007-01-08 23:20:54 +00:00
parent 4b0e7b22da
commit 9f8cef5ee2
3 changed files with 47 additions and 6 deletions
+5 -3
View File
@@ -10,6 +10,9 @@
# CBV results.
#
# $Log$
# Revision 1.2 2007/01/05 23:33:55 customdesigned
# Make blacklist an AddrCache
#
# Revision 1.1 2007/01/05 21:25:40 customdesigned
# Move AddrCache to Milter package.
#
@@ -52,7 +55,7 @@ class AddrCache(object):
def has_key(self,sender):
"True if sender is cached and has not expired."
try:
lsender = sender.lower()
lsender = sender and sender.lower()
ts,res = self.cache[lsender]
too_old = time.time() - self.age*24*60*60 # max age in days
if not ts or ts > too_old:
@@ -67,8 +70,7 @@ class AddrCache(object):
try:
user,host = sender.split('@',1)
return self.has_key(host)
except ValueError:
pass
except: pass
return False
__contains__ = has_key
+17
View File
@@ -0,0 +1,17 @@
# Author: Stuart D. Gathman <stuart@bmsi.com>
# Copyright 2005 Business Management Systems, Inc.
# This code is under the GNU General Public License. See COPYING for details.
# The localpart of SMTP return addresses is often signed. The format
# of the signing is application specific and doesn't concern us -
# except that we wish to extract some sort of fixed string from
# the variable signature which represents the "source" of the message.
def unsign(s):
"""Attempt to unsign localpart and return original email.
No attempt is made to verify the signature.
>>> unsign('SRS0=8Y3CZ=3U=jsconnor.com=bills@bmsi.com')
'bills@jsconnor.com'
"""
# not implemented yet
return s