aboutsummaryrefslogtreecommitdiffstats
path: root/Mailman/Bouncer.py
diff options
context:
space:
mode:
authorMark Sapiro <mark@msapiro.net>2014-10-16 22:09:49 -0700
committerMark Sapiro <mark@msapiro.net>2014-10-16 22:09:49 -0700
commit15e0573756e18870b4f8ae7a26b272b792baf94d (patch)
tree531f6400760096a25f7c6908fb35780ffe6ccdfb /Mailman/Bouncer.py
parent851430b1cfbee6d92e4e1c0f110e4e66a1609d55 (diff)
downloadmailman2-15e0573756e18870b4f8ae7a26b272b792baf94d.tar.gz
mailman2-15e0573756e18870b4f8ae7a26b272b792baf94d.tar.xz
mailman2-15e0573756e18870b4f8ae7a26b272b792baf94d.zip
Implemented the ability to forward bounces to the list owner.
Diffstat (limited to 'Mailman/Bouncer.py')
-rw-r--r--Mailman/Bouncer.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/Mailman/Bouncer.py b/Mailman/Bouncer.py
index 29fe4ea5..2a1cb539 100644
--- a/Mailman/Bouncer.py
+++ b/Mailman/Bouncer.py
@@ -1,4 +1,4 @@
-# Copyright (C) 1998-2012 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2014 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -89,6 +89,8 @@ class Bouncer:
mm_cfg.DEFAULT_BOUNCE_YOU_ARE_DISABLED_WARNINGS_INTERVAL
self.bounce_unrecognized_goes_to_list_owner = \
mm_cfg.DEFAULT_BOUNCE_UNRECOGNIZED_GOES_TO_LIST_OWNER
+ self.bounce_notify_owner_on_bounce_increment = \
+ mm_cfg.DEFAULT_BOUNCE_NOTIFY_OWNER_ON_BOUNCE_INCREMENT
self.bounce_notify_owner_on_disable = \
mm_cfg.DEFAULT_BOUNCE_NOTIFY_OWNER_ON_DISABLE
self.bounce_notify_owner_on_removal = \
@@ -135,6 +137,7 @@ class Bouncer:
siblist.Unlock()
return
info = self.getBounceInfo(member)
+ first_today = True
if day is None:
# Use today's date
day = time.localtime()[:3]
@@ -155,6 +158,7 @@ class Bouncer:
return
elif info.date == day:
# We've already scored any bounces for this day, so ignore it.
+ first_today = False
syslog('bounce', '%s: %s already scored a bounce for date %s',
self.internal_name(), member,
time.strftime('%d-%b-%Y', day + (0,0,0,0,1,0)))
@@ -189,6 +193,9 @@ class Bouncer:
info.reset(0, info.date, info.noticesleft)
else:
self.disableBouncingMember(member, info, msg)
+ elif self.bounce_notify_owner_on_bounce_increment and first_today:
+ self.__sendAdminBounceNotice(member, msg,
+ did=_('bounce score incremented'))
# We've set/changed bounce info above. We now need to tell the
# MemberAdaptor to set/update it. We do it here in case the
# MemberAdaptor stores bounce info externally to the list object to
@@ -218,7 +225,7 @@ class Bouncer:
if self.bounce_notify_owner_on_disable:
self.__sendAdminBounceNotice(member, msg)
- def __sendAdminBounceNotice(self, member, msg):
+ def __sendAdminBounceNotice(self, member, msg, did=_('disabled')):
# BAW: This is a bit kludgey, but we're not providing as much
# information in the new admin bounce notices as we used to (some of
# it was of dubious value). However, we'll provide empty, strange, or
@@ -230,7 +237,7 @@ class Bouncer:
{'listname' : self.real_name,
'addr' : member,
'negative' : '',
- 'did' : _('disabled'),
+ 'did' : did,
'but' : '',
'reenable' : '',
'owneraddr': siteowner,