CVS: tmda/TMDA AutoResponse.py,1.11,1.12 Defaults.py,1.178,1.179 Deliver.py,1.14,1.15
Timothy Legant <[email protected]>
| Newsgroups | gmane.mail.spam.tmda.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/tmda/tmda/TMDA
In directory sc8-pr-cvs1:/tmp/cvs-serv21830
Modified Files:
AutoResponse.py Defaults.py Deliver.py
Log Message:
Added the ability to purge headers from TMDA-generated mail as well as
during delivery (mbox, maildir, forwards and pipes to commands). This
necessitated changing the configuration variable 'PURGED_HEADERS' to
'PURGED_HEADERS_CLIENT'. The variables 'PURGED_HEADERS_SERVER' and
'PURGED_HEADERS_DELIVERY' were added. See Defaults.py for details.
Index: AutoResponse.py
===================================================================
RCS file: /cvsroot/tmda/tmda/TMDA/AutoResponse.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- AutoResponse.py 27 Apr 2003 07:58:17 -0000 1.11
+++ AutoResponse.py 25 May 2003 02:21:20 -0000 1.12
@@ -194,12 +194,9 @@
self.mimemsg['X-Delivery-Agent'] = 'TMDA/%s (%s)' % (Version.TMDA,
Version.CODENAME)
# Optionally, add some headers.
- if Defaults.ADDED_HEADERS_SERVER:
- keys = Defaults.ADDED_HEADERS_SERVER.keys()
- keys.sort()
- for k in keys:
- del self.mimemsg[k]
- self.mimemsg[k] = Defaults.ADDED_HEADERS_SERVER[k]
+ Util.add_headers(self.mimemsg, Defaults.ADDED_HEADERS_SERVER)
+ # Optionally, remove some headers.
+ Util.purge_headers(self.mimemsg, Defaults.PURGED_HEADERS_SERVER)
def send(self):
Index: Defaults.py
===================================================================
RCS file: /cvsroot/tmda/tmda/TMDA/Defaults.py,v
retrieving revision 1.178
retrieving revision 1.179
diff -u -r1.178 -r1.179
--- Defaults.py 29 Apr 2003 20:25:59 -0000 1.178
+++ Defaults.py 25 May 2003 02:21:20 -0000 1.179
@@ -1232,23 +1232,48 @@
if not vars().has_key('PRIMARY_ADDRESS_MATCH'):
PRIMARY_ADDRESS_MATCH = 5
-# PURGED_HEADERS
+# PURGED_HEADERS_CLIENT
# A list containing one or more message headers that should be removed
# from outgoing client-side messages (i.e, messages sent with
# tmda-sendmail) prior to injection. Listed headers are
# case-insensitive, and the purging will only be attempted if the
# header actually exists.
#
-# NOTE: PURGED_HEADERS is run _after_ ADDED_HEADERS (see above).
+# NOTE: PURGED_HEADERS_CLIENT is run _after_ ADDED_HEADERS (see above).
#
# Examples:
#
-# PURGED_HEADERS = ["bcc", "resent-bcc", "x-mailer"]
-# PURGED_HEADERS = ["bcc", "resent-bcc", "x-mailer", "user-agent"]
+# PURGED_HEADERS_CLIENT = ["bcc", "resent-bcc", "x-mailer"]
+# PURGED_HEADERS_CLIENT = ["bcc", "resent-bcc", "x-mailer", "user-agent"]
#
# Default is "Bcc:" and "Resent-Bcc"
-if not vars().has_key('PURGED_HEADERS'):
- PURGED_HEADERS = ["bcc", "resent-bcc"]
+if not vars().has_key('PURGED_HEADERS_CLIENT'):
+ PURGED_HEADERS_CLIENT = ["bcc", "resent-bcc"]
+
+# PURGED_HEADERS_SERVER
+# A list containing one or more message headers that should be removed
+# from _all_ outgoing server-side messages (i.e, messages sent with
+# tmda-filter) prior to injection. Listed headers are case-insensitive
+# and the purging will only be attempted if the header actually exists.
+#
+# See PURGED_HEADERS_CLIENT (above) for some examples.
+#
+# No default
+if not vars().has_key('PURGED_HEADERS_SERVER'):
+ PURGED_HEADERS_SERVER = None
+
+# PURGED_HEADERS_DELIVERY
+# A list containing one or more message headers that should be removed
+# from _all_ delivered messages (i.e, messages stored in an mbox or a
+# maildir, forwarded or passed to a program by TMDA). Listed headers
+# are case-insensitive and the purging will only be attempted if the
+# header actually exists.
+#
+# See PURGED_HEADERS_CLIENT (above) for some examples.
+#
+# No default
+if not vars().has_key('PURGED_HEADERS_DELIVERY'):
+ PURGED_HEADERS_DELIVERY = None
# RECIPIENT_HEADER
# A string containing the name of a header (case-insensitive) whose
Index: Deliver.py
===================================================================
RCS file: /cvsroot/tmda/tmda/TMDA/Deliver.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- Deliver.py 27 Apr 2003 07:58:17 -0000 1.14
+++ Deliver.py 25 May 2003 02:21:20 -0000 1.15
@@ -29,6 +29,7 @@
import stat
import time
+import Defaults
import Errors
import Util
@@ -105,6 +106,8 @@
def deliver(self):
"""Deliver the message appropriately."""
+ # Optionally, remove some headers.
+ Util.purge_headers(self.msg, Defaults.PURGED_HEADERS_DELIVERY)
(type, dest) = self.get_instructions()
if type == 'program':
# don't wrap headers, don't escape From, add From_ line
_______________________________________
tmda-cvs mailing list
http://tmda.net/lists/listinfo/tmda-cvs