summaryrefslogtreecommitdiff
path: root/Mailman/Utils.py
diff options
context:
space:
mode:
authorcotton1998-11-13 15:29:30 +0000
committercotton1998-11-13 15:29:30 +0000
commit69ea72e446c21e791696ee974741350c00a7d768 (patch)
tree7cafded1f990fb1b61437b5546f5bfca1f3e398b /Mailman/Utils.py
parentbe5838c944191fd919b66c88890eda56b5d515e7 (diff)
downloadmailman-69ea72e446c21e791696ee974741350c00a7d768.tar.gz
mailman-69ea72e446c21e791696ee974741350c00a7d768.tar.zst
mailman-69ea72e446c21e791696ee974741350c00a7d768.zip
fixed up IsAdminsitrivia a bit as per the problems reported by
Madarasz Gergely. IsAdministrivia now strips sigs and counts lines correctly from the body of the message instead of the whole message. In addition, I up'd the constant 10 for the maximum number of lines with text in them to 30. scott
Diffstat (limited to 'Mailman/Utils.py')
-rw-r--r--Mailman/Utils.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/Mailman/Utils.py b/Mailman/Utils.py
index ff386d0f0..3dc248856 100644
--- a/Mailman/Utils.py
+++ b/Mailman/Utils.py
@@ -444,9 +444,7 @@ def maketext(templatefile, dict, raw=0):
# get sent to the list admin instead of the entire list.
#
def IsAdministrivia(msg):
- lines = map(string.lower, msg.readlines())
- if len(lines) > 30:
- return 0
+ lines = map(string.lower, string.split(msg.body, "\n"))
#
# check to see how many lines that actually have text in them there are
#
@@ -464,9 +462,14 @@ def IsAdministrivia(msg):
for line in lines:
if string.strip(line):
lines_with_text = lines_with_text + 1
- if lines_with_text > 10: # we might want to change this to mm_cfg.DEFAULT_MAIL_COMMANDS_MAX_LINES.
+ if lines_with_text > 30: # we might want to change this to mm_cfg.DEFAULT_MAIL_COMMANDS_MAX_LINES.
return 0
- if admin_data.has_key(string.lower(string.strip(msg.body))):
+ sig_ind = string.find(msg.body, "\n-- ")
+ if sig_ind != -1:
+ body = msg.body[:sig_ind]
+ else:
+ body = msg.body
+ if admin_data.has_key(string.lower(string.strip(body))):
return 1
try:
if admin_data.has_key(string.lower(string.strip(msg["subject"]))):
@@ -475,7 +478,7 @@ def IsAdministrivia(msg):
pass
for line in lines[:5]:
if not string.strip(line):
- return
+ continue
words = string.split(line)
if admin_data.has_key(words[0]):
min_args, max_args = admin_data[words[0]]