diff options
| author | klm | 1998-07-12 04:40:09 +0000 |
|---|---|---|
| committer | klm | 1998-07-12 04:40:09 +0000 |
| commit | 665e4d0b7d8400c017798f1a4433425e691aeb47 (patch) | |
| tree | 65be2afa4451f2f3036df609545db85fa7321517 /Mailman/MailCommandHandler.py | |
| parent | 496988dcbff4c39a61009d2f1a7bccf921e1c232 (diff) | |
| download | mailman-665e4d0b7d8400c017798f1a4433425e691aeb47.tar.gz mailman-665e4d0b7d8400c017798f1a4433425e691aeb47.tar.zst mailman-665e4d0b7d8400c017798f1a4433425e691aeb47.zip | |
Prevent processing of exactly duplicated commands. This is
particularly to avoid the inevitable duplication in the subject and
body, common for other mlm's, where people forget whether it's the
subject or the body that has effect. In mailman, it's both - but now,
not for duplicates.
Diffstat (limited to 'Mailman/MailCommandHandler.py')
| -rw-r--r-- | Mailman/MailCommandHandler.py | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/Mailman/MailCommandHandler.py b/Mailman/MailCommandHandler.py index f2686d431..a21866954 100644 --- a/Mailman/MailCommandHandler.py +++ b/Mailman/MailCommandHandler.py @@ -109,8 +109,9 @@ class MailCommandHandler: # # check to see if confirmation request -- special handling # - conf_pat = r"%s -- confirmation of subscription -- request (\d\d\d\d\d\d)" % \ - self.real_name + conf_pat = (r"%s -- confirmation of subscription" + r" -- request (\d\d\d\d\d\d)" + % self.real_name) match = re.search(conf_pat, subject) if not match: match = re.search(conf_pat, mail.body) @@ -118,6 +119,7 @@ class MailCommandHandler: lines = ["confirm %s" % (match.group(1))] else: self.AddError("Subject line ignored: %s" % subject) + processed = {} # For avoiding redundancies. for line in lines: line = string.strip(line) if not line: @@ -135,7 +137,20 @@ class MailCommandHandler: if not self._cmd_dispatch.has_key(cmd): self.AddError("%s: Command UNKNOWN." % cmd) else: - self._cmd_dispatch[cmd](args, line, mail) + # We do not repeat identical commands. (Eg, it's common + # with other mlm's for people to put a command in the + # subject and the body, uncertain which one has effect...) + isdup = 0 + if not processed.has_key(cmd): + processed[cmd] = [] + else: + for did in processed[cmd]: + if args == did: + isdup = 1 + break + if not isdup: + processed[cmd].append(args) + self._cmd_dispatch[cmd](args, line, mail) if not self.__NoMailCmdResponse: self.SendMailCmdResponse(mail) |
