~ulrith/mailman/russian

« back to all changes in this revision

Viewing changes to Mailman/Bouncer.py

  • Committer: Mark Sapiro
  • Date: 2014-10-17 05:09:49 UTC
  • Revision ID: mark@msapiro.net-20141017050949-a2kbcx5i2j9as9v9
Implemented the ability to forward bounces to the list owner.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 1998-2012 by the Free Software Foundation, Inc.
 
1
# Copyright (C) 1998-2014 by the Free Software Foundation, Inc.
2
2
#
3
3
# This program is free software; you can redistribute it and/or
4
4
# modify it under the terms of the GNU General Public License
89
89
            mm_cfg.DEFAULT_BOUNCE_YOU_ARE_DISABLED_WARNINGS_INTERVAL
90
90
        self.bounce_unrecognized_goes_to_list_owner = \
91
91
            mm_cfg.DEFAULT_BOUNCE_UNRECOGNIZED_GOES_TO_LIST_OWNER
 
92
        self.bounce_notify_owner_on_bounce_increment = \
 
93
            mm_cfg.DEFAULT_BOUNCE_NOTIFY_OWNER_ON_BOUNCE_INCREMENT
92
94
        self.bounce_notify_owner_on_disable = \
93
95
            mm_cfg.DEFAULT_BOUNCE_NOTIFY_OWNER_ON_DISABLE
94
96
        self.bounce_notify_owner_on_removal = \
135
137
                        siblist.Unlock()
136
138
            return
137
139
        info = self.getBounceInfo(member)
 
140
        first_today = True
138
141
        if day is None:
139
142
            # Use today's date
140
143
            day = time.localtime()[:3]
155
158
            return
156
159
        elif info.date == day:
157
160
            # We've already scored any bounces for this day, so ignore it.
 
161
            first_today = False
158
162
            syslog('bounce', '%s: %s already scored a bounce for date %s',
159
163
                   self.internal_name(), member,
160
164
                   time.strftime('%d-%b-%Y', day + (0,0,0,0,1,0)))
189
193
                info.reset(0, info.date, info.noticesleft)
190
194
            else:
191
195
                self.disableBouncingMember(member, info, msg)
 
196
        elif self.bounce_notify_owner_on_bounce_increment and first_today:
 
197
            self.__sendAdminBounceNotice(member, msg,
 
198
                                         did=_('bounce score incremented'))
192
199
        # We've set/changed bounce info above.  We now need to tell the
193
200
        # MemberAdaptor to set/update it.  We do it here in case the
194
201
        # MemberAdaptor stores bounce info externally to the list object to
218
225
        if self.bounce_notify_owner_on_disable:
219
226
            self.__sendAdminBounceNotice(member, msg)
220
227
 
221
 
    def __sendAdminBounceNotice(self, member, msg):
 
228
    def __sendAdminBounceNotice(self, member, msg, did=_('disabled')):
222
229
        # BAW: This is a bit kludgey, but we're not providing as much
223
230
        # information in the new admin bounce notices as we used to (some of
224
231
        # it was of dubious value).  However, we'll provide empty, strange, or
230
237
            {'listname' : self.real_name,
231
238
             'addr'     : member,
232
239
             'negative' : '',
233
 
             'did'      : _('disabled'),
 
240
             'did'      : did,
234
241
             'but'      : '',
235
242
             'reenable' : '',
236
243
             'owneraddr': siteowner,