summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbwarsaw2001-07-06 05:32:27 +0000
committerbwarsaw2001-07-06 05:32:27 +0000
commit984b30495341b5510db35b15a61df73229c8605f (patch)
treee276c9bf63c90782e828d307ebd6eed0d5b3ecd1
parent540e0bfdaf93132859aa0edb0ba55435bb586d44 (diff)
downloadmailman-984b30495341b5510db35b15a61df73229c8605f.tar.gz
mailman-984b30495341b5510db35b15a61df73229c8605f.tar.zst
mailman-984b30495341b5510db35b15a61df73229c8605f.zip
prepare_message(): Use Utils.unique_message_id() to generate the
Message-ID header. mcre: Message-ID headers crafted by Mailman now include a serial number. Recognize this, and also use a verbose regular expression so it's not so cryptic.
-rw-r--r--Mailman/Queue/NewsRunner.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/Mailman/Queue/NewsRunner.py b/Mailman/Queue/NewsRunner.py
index fa376feea..6961a6aaf 100644
--- a/Mailman/Queue/NewsRunner.py
+++ b/Mailman/Queue/NewsRunner.py
@@ -16,8 +16,6 @@
"""NNTP queue runner."""
-import os
-import time
import re
import socket
import nntplib
@@ -28,12 +26,22 @@ from mimelib.address import getaddresses
COMMASPACE = ', '
from Mailman import mm_cfg
+from Mailman import Utils
from Mailman.Queue.Runner import Runner
from Mailman.Logging.Syslog import syslog
from Mailman.pythonlib.StringIO import StringIO
-# Matches our Mailman crafted Message-IDs
-mcre = re.compile(r'<mailman.\d+.\d+.(?P<listname>[^@]+)@(?P<hostname>[^>]+)>')
+# Matches our Mailman crafted Message-IDs. See Utils.unique_message_id()
+mcre = re.compile(r"""
+ <mailman. # match the prefix
+ \d+. # serial number
+ \d+. # time in seconds since epoch
+ \d+. # pid
+ (?P<listname>[^@]+) # list's internal_name()
+ @ # localpart@dom.ain
+ (?P<hostname>[^>]+) # list's host_name
+ > # trailer
+ """, re.VERBOSE)
@@ -111,8 +119,7 @@ def prepare_message(mlist, msg, msgdata):
hackmsgid = 0
if hackmsgid:
del msg['message-id']
- msg['Message-ID'] = '<mailman.%d.%d.%s@%s>' % (
- time.time(), os.getpid(), mlist.internal_name(), mlist.host_name)
+ msg['Message-ID'] = Utils.unique_message_id(mlist)
#
# Lines: is useful
if msg['Lines'] is None: