summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbwarsaw2001-05-01 06:41:24 +0000
committerbwarsaw2001-05-01 06:41:24 +0000
commitc7a495d8944a555cfe88d4153c632c1f79e2ba3e (patch)
tree972df1f44c8c5bc1d469d49906073282bb89a2d9
parentada25ab87bf3fb69de8b1f0ff43b0a6cf88c66a1 (diff)
downloadmailman-c7a495d8944a555cfe88d4153c632c1f79e2ba3e.tar.gz
mailman-c7a495d8944a555cfe88d4153c632c1f79e2ba3e.tar.zst
mailman-c7a495d8944a555cfe88d4153c632c1f79e2ba3e.zip
-rw-r--r--Mailman/Queue/ArchRunner.py25
1 files changed, 22 insertions, 3 deletions
diff --git a/Mailman/Queue/ArchRunner.py b/Mailman/Queue/ArchRunner.py
index 10755f1ad..9e005ab04 100644
--- a/Mailman/Queue/ArchRunner.py
+++ b/Mailman/Queue/ArchRunner.py
@@ -16,7 +16,12 @@
"""Outgoing queue runner."""
+import time
+
+from mimelib.date import parsedate_tz, mktime_tz, formatdate
+
from Mailman import mm_cfg
+from Mailman import LockFile
from Mailman.Queue.Runner import Runner
@@ -38,11 +43,25 @@ class ArchRunner(Runner):
# original message. BAW: Note that there should be a third option
# here: to clobber the date only if it's bogus, i.e. way in the future
# or way in the past.
- if mlist.clobber_date:
- originaldate = msg['date']
+ clobber = 0
+ originaldate = msg.get('date')
+ if not originaldate:
+ clobber = 1
+ elif mm_cfg.ARCHIVER_CLOBBER_DATE_POLICY == 1:
+ clobber = 1
+ elif mm_cfg.ARCHIVER_CLOBBER_DATE_POLICY == 2:
+ # what's the timestamp on the original message?
+ tup = parsedate_tz(originaldate)
+ now = time.time()
+ if not tup:
+ clobber = 1
+ elif abs(now - mktime_tz(tup)) > \
+ mm_cfg.ARCHIVER_ALLOWABLE_SANE_DATE_SKEW:
+ clobber = 1
+ if clobber:
del msg['date']
del msg['x-original-date']
- msg['Date'] = time.ctime(msgdata['received_time'])
+ msg['Date'] = formatdate(msgdata['received_time'])
if originaldate:
msg['X-Original-Date'] = originaldate
#