Skip to content

Commit 6c8df41

Browse files
committed
update
1 parent 3c68164 commit 6c8df41

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

Mailman/Handlers/SMTPDirect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ def bulkdeliver(mlist, msg, msgdata, envsender, failures, conn):
402402
failures.update(refused)
403403
msgdata['failures'] = failures
404404
# Raise RejectMessage to properly handle the rejection
405-
raise Errors.RejectMessage('Message rejected due to spam detection')
405+
raise Mailman.Errors.RejectMessage('Message rejected due to spam detection')
406406

407407
# Get the list of recipients
408408
recips = msgdata.get('recipients', [])

Mailman/MailList.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,3 +1411,24 @@ def ApprovedChangeMemberAddress(self, oldaddr, newaddr, globally):
14111411
def log_and_notify_admin(self, oldaddr, newaddr):
14121412
syslog('subscribe', '%s: changed address %s -> %s',
14131413
self.internal_name(), oldaddr, newaddr)
1414+
1415+
def CheckPending(self, email, unsub=False):
1416+
"""Check if there is already an unexpired pending (un)subscription for
1417+
this email.
1418+
"""
1419+
if not mm_cfg.REFUSE_SECOND_PENDING:
1420+
return False
1421+
pends = self._Pending__load()
1422+
# Save and reload the db to evict expired pendings.
1423+
self._Pending__save(pends)
1424+
pends = self._Pending__load()
1425+
for k, v in list(pends.items()):
1426+
if k in ('evictions', 'version'):
1427+
continue
1428+
op, data = v[:2]
1429+
if (op == Pending.SUBSCRIPTION and not unsub and
1430+
data.address.lower() == email.lower() or
1431+
op == Pending.UNSUBSCRIPTION and unsub and
1432+
data.lower() == email.lower()):
1433+
return True
1434+
return False

0 commit comments

Comments
 (0)