Clean up the mta directory.
[mailman.git] / src / mailman / mta / aliases.py
blobdc434c613d14afd39a3efb074aeb4c4f63dab5ab
1 # Copyright (C) 2011-2016 by the Free Software Foundation, Inc.
3 # This file is part of GNU Mailman.
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.
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.
15 # You should have received a copy of the GNU General Public License along with
16 # GNU Mailman. If not, see <http://www.gnu.org/licenses/>.
18 """Utility for generating all the aliases of a mailing list."""
20 from mailman import public
21 from mailman.interfaces.mta import IMailTransportAgentAliases
22 from zope.interface import implementer
25 SUBDESTINATIONS = (
26 'bounces',
27 'confirm',
28 'join',
29 'leave',
30 'owner',
31 'request',
32 'subscribe',
33 'unsubscribe',
37 @public
38 @implementer(IMailTransportAgentAliases)
39 class MailTransportAgentAliases:
40 """Utility for generating all the aliases of a mailing list."""
42 def aliases(self, mlist):
43 """See `IMailTransportAgentAliases`."""
44 # Always return
45 yield mlist.posting_address
46 for destination in sorted(SUBDESTINATIONS):
47 yield '{}-{}@{}'.format(
48 mlist.list_name, destination, mlist.mail_host)
50 def destinations(self, mlist):
51 """See `IMailTransportAgentAliases`."""
52 # Always return
53 yield mlist.list_name
54 for destination in sorted(SUBDESTINATIONS):
55 yield '{}-{}'.format(mlist.list_name, destination)