[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tmda-cvs
Subject:    CVS: tmda/TMDA ChangeLog,1.97,1.98 Defaults.py,1.82,1.83 Util.py,1.23,1.24
From:       "Jason R. Mastaler" <jasonrm () users ! sourceforge ! net>
Date:       2001-11-30 23:55:21
[Download RAW message or body]

Update of /cvsroot/tmda/tmda/TMDA
In directory usw-pr-cvs1:/tmp/cvs-serv10424/TMDA

Modified Files:
	ChangeLog Defaults.py Util.py 
Log Message:
Add our own Message-ID header to the confirmation bounces rather than
relying on the MTA to add it.  The creation algorithm is the same as
qmail's:

The lefthand side of '@' consists of the current time in UTC + the
process_id + the string 'tmda', and righthand side is the FQDN of the
host.  e.g,

<20011130190055.12345.tmda@nightshade.la.mastaler.com>


Index: ChangeLog
===================================================================
RCS file: /cvsroot/tmda/tmda/TMDA/ChangeLog,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -r1.97 -r1.98
--- ChangeLog	2001/11/28 21:45:07	1.97
+++ ChangeLog	2001/11/30 23:55:18	1.98
@@ -1,3 +1,11 @@
+2001-11-30  Jason R. Mastaler  <jasonrm@nightshade.la.mastaler.com>
+
+	* Util.py (make_msgid): New function to create and return an
+	rfc2822 compliant Message-ID string.
+
+	* Defaults.py (PID): Store the process id here so all areas of the
+	code can access it without having to re-fetch it.
+
 2001-11-28  Jason R. Mastaler  <jasonrm@nightshade.la.mastaler.com>
 
 	* FilterParser.py (FilterParser.firstmatch): Add support for DJB's

Index: Defaults.py
===================================================================
RCS file: /cvsroot/tmda/tmda/TMDA/Defaults.py,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -r1.82 -r1.83
--- Defaults.py	2001/11/20 23:23:53	1.82
+++ Defaults.py	2001/11/30 23:55:18	1.83
@@ -23,6 +23,9 @@
 DELIVERY_AGENT = 'TMDA ' + 'v' + TMDA_VERSION + '/Python ' + PYTHON_VERSION \
                  + ' (' + sys.platform + ')'
 
+# The current process id of the Python interpreter as a string.
+PID = str(os.getpid())
+
 # General exit status codes which should be understood by all MTAs.
 # Defined so we can raise exit codes within TMDA modules without
 # having to create an MTA instance.

Index: Util.py
===================================================================
RCS file: /cvsroot/tmda/tmda/TMDA/Util.py,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- Util.py	2001/11/28 17:19:36	1.23
+++ Util.py	2001/11/30 23:55:18	1.24
@@ -9,6 +9,7 @@
 import re
 import string
 import sys
+import time
 import types
 
 
@@ -111,6 +112,28 @@
     if int(num) == 1:
         timeout = timeout[:-1]
     return timeout
+
+
+def make_msgid(timesecs=None, pid=None):
+    """Return an rfc2822 compliant Message-ID string.  e.g,
+    
+    <20011130190055.12345.tmda@nightshade.la.mastaler.com>
+
+    timesecs is optional, and if not given, the current time is used.
+
+    pid is optional, and if not given, the current process id is used.
+    """
+    if not timesecs:
+        timesecs = time.time()
+    if not pid:
+        import Defaults
+        pid = Defaults.PID
+    idhost = os.environ.get('QMAILIDHOST')
+    if not idhost:
+        idhost = gethostname()
+    date = time.strftime("%Y%m%d%H%M%S", time.gmtime(timesecs))
+    message_id = "<%s.%s.tmda@%s>" % (date, pid, idhost)
+    return message_id
 
 
 def file_to_dict(file,dict):

_______________________________________________
tmda-cvs mailing list
http://libertine.org/lists/listinfo/tmda-cvs

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic