summaryrefslogtreecommitdiff
path: root/Mailman/Bouncer.py
diff options
context:
space:
mode:
authorbwarsaw2002-05-28 03:02:23 +0000
committerbwarsaw2002-05-28 03:02:23 +0000
commit1fb9a463c468bedc74cdfe7782bdfc76d2c64bc5 (patch)
treed7b3908ace7eae899b061a4b90c8bb07b0bbc73b /Mailman/Bouncer.py
parent98773e98bf62dcab1a49ffa4872e530c588aa2de (diff)
downloadmailman-1fb9a463c468bedc74cdfe7782bdfc76d2c64bc5.tar.gz
mailman-1fb9a463c468bedc74cdfe7782bdfc76d2c64bc5.tar.zst
mailman-1fb9a463c468bedc74cdfe7782bdfc76d2c64bc5.zip
Diffstat (limited to 'Mailman/Bouncer.py')
-rw-r--r--Mailman/Bouncer.py37
1 files changed, 31 insertions, 6 deletions
diff --git a/Mailman/Bouncer.py b/Mailman/Bouncer.py
index 621e9fdfd..cd3ea06fd 100644
--- a/Mailman/Bouncer.py
+++ b/Mailman/Bouncer.py
@@ -30,7 +30,7 @@ from Mailman import Message
from Mailman import MemberAdaptor
from Mailman import Pending
from Mailman.Logging.Syslog import syslog
-from Mailman.i18n import _
+from Mailman import i18n
EMPTYSTRING = ''
@@ -39,6 +39,16 @@ EMPTYSTRING = ''
# for time.mktime().
ZEROHOUR_PLUSONEDAY = time.localtime(mm_cfg.days(1))[:3]
+def _(s): return s
+
+REASONS = {MemberAdaptor.BYBOUNCE: _('due to excessive bounces'),
+ MemberAdaptor.BYUSER: _('by yourself'),
+ MemberAdaptor.BYADMIN: _('by the list administrator'),
+ MemberAdaptor.UNKNOWN: _('for unknown reasons'),
+ }
+
+_ = i18n._
+
class _BounceInfo:
@@ -122,8 +132,8 @@ class Bouncer:
# Continue to check phase below
else:
# See if this member's bounce information is stale.
- now = time.mktime(today + (0,) * 6)
- lastbounce = time.mktime(info.date + (0,) * 6)
+ now = Utils.midnight(today)
+ lastbounce = Utils.midnight(info.date)
if lastbounce + self.bounce_info_stale_after < now:
# Information is stale, so simply reset it
info.reset(weight, today, 0)
@@ -188,17 +198,26 @@ class Bouncer:
info = self.getBounceInfo(member)
if info is None:
return
+ reason = self.getDeliveryStatus(member)
if info.noticesleft <= 0:
# BAW: Remove them now, with a notification message
self.ApprovedDeleteMember(
- member, 'bouncing address',
+ member, 'disabled address',
admin_notif=self.bounce_notify_owner_on_removal,
userack=1)
# Expunge the pending cookie for the user. We throw away the
# returned data.
Pending.confirm(info.cookie)
- syslog('bounce', '%s: %s deleted after exhausting notices',
- self.internal_name(), member)
+ if reason == MemberAdaptor.BYBOUNCE:
+ syslog('bounce', '%s: %s deleted after exhausting notices',
+ self.internal_name(), member)
+ syslog('subscribe', '%s: %s auto-unsubscribed [reason: %s]',
+ self.internal_name(), member,
+ {MemberAdaptor.BYBOUNCE: 'BYBOUNCE',
+ MemberAdaptor.BYUSER: 'BYUSER',
+ MemberAdaptor.BYADMIN: 'BYADMIN',
+ MemberAdaptor.BYUNKNOWN: 'BYUNKNOWN'}.get(
+ reason, 'invalid value'))
return
# Send the next notification
confirmurl = '%s/%s' % (self.GetScriptURL('confirm', absolute=1),
@@ -206,6 +225,11 @@ class Bouncer:
optionsurl = self.GetOptionsURL(member, absolute=1)
reqaddr = self.GetRequestEmail()
lang = self.getMemberLanguage(member)
+ reason = REASONS.get(reason)
+ if reason is None:
+ reason = _('for unknown reasons')
+ else:
+ reason = _(reason)
text = Utils.maketext(
'disabled.txt',
{'listname' : self.real_name,
@@ -214,6 +238,7 @@ class Bouncer:
'optionsurl' : optionsurl,
'password' : self.getMemberPassword(member),
'owneraddr' : self.GetOwnerEmail(),
+ 'reason' : reason,
}, lang=lang, mlist=self)
msg = Message.UserNotification(member, reqaddr, text=text, lang=lang)
# BAW: See the comment in MailList.py ChangeMemberAddress() for why we