1# Copyright (C) 1998-2020 by the Free Software Foundation, Inc.
2#
3# This file is part of GNU Mailman.
4#
5# GNU Mailman is free software: you can redistribute it and/or modify it under
6# the terms of the GNU General Public License as published by the Free
7# Software Foundation, either version 3 of the License, or (at your option)
8# any later version.
9#
10# GNU Mailman is distributed in the hope that it will be useful, but WITHOUT
11# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13# more details.
14#
15# You should have received a copy of the GNU General Public License along with
16# GNU Mailman.  If not, see <https://www.gnu.org/licenses/>.
17
18"""Perform some bookkeeping after a successful post."""
19
20from mailman.core.i18n import _
21from mailman.interfaces.handler import IHandler
22from mailman.utilities.datetime import now
23from public import public
24from zope.interface import implementer
25
26
27@public
28@implementer(IHandler)
29class AfterDelivery:
30    """Perform some bookkeeping after a successful post."""
31
32    name = 'after-delivery'
33    description = _('Perform some bookkeeping after a successful post.')
34
35    def process(self, mlist, msg, msgdata):
36        """See `IHander`."""
37        mlist.last_post_at = now()
38        mlist.post_id += 1
39