diff options
| author | Barry Warsaw | 2011-06-10 19:52:25 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2011-06-10 19:52:25 -0400 |
| commit | f8596ce463863dc6defb5dac84f5b226c45cb419 (patch) | |
| tree | 616e2f0d952d1654d3b0b60d661f5349d469acf4 /src/mailman/mta/aliases.py | |
| parent | bf8b285acb8c2500e52ae2582f27513b9842de54 (diff) | |
| download | mailman-f8596ce463863dc6defb5dac84f5b226c45cb419.tar.gz mailman-f8596ce463863dc6defb5dac84f5b226c45cb419.tar.zst mailman-f8596ce463863dc6defb5dac84f5b226c45cb419.zip | |
Diffstat (limited to 'src/mailman/mta/aliases.py')
| -rw-r--r-- | src/mailman/mta/aliases.py | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/src/mailman/mta/aliases.py b/src/mailman/mta/aliases.py new file mode 100644 index 000000000..9f2bd74e3 --- /dev/null +++ b/src/mailman/mta/aliases.py @@ -0,0 +1,65 @@ +# Copyright (C) 2011 by the Free Software Foundation, Inc. +# +# This file is part of GNU Mailman. +# +# GNU Mailman is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# GNU Mailman is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# GNU Mailman. If not, see <http://www.gnu.org/licenses/>. + +"""Utility for generating all the aliases of a mailing list.""" + +from __future__ import absolute_import, unicode_literals + +__metaclass__ = type +__all__ = [ + 'MailTransportAgentAliases', + ] + + +from zope.interface import implements + +from mailman.interfaces.mta import IMailTransportAgentAliases + + +SUBDESTINATIONS = ( + 'bounces', + 'confirm', + 'join', + 'leave', + 'owner', + 'request', + 'subscribe', + 'unsubscribe', + ) + + + +class MailTransportAgentAliases: + """Utility for generating all the aliases of a mailing list.""" + + implements(IMailTransportAgentAliases) + + def aliases(self, mlist): + """See `IMailTransportAgentAliases`.""" + # Always return + yield mlist.posting_address + for destination in sorted(SUBDESTINATIONS): + yield '{0}-{1}@{2}'.format(mlist.list_name, + destination, + mlist.host_name) + + def destinations(self, mlist): + """See `IMailTransportAgentAliases`.""" + # Always return + yield mlist.list_name + for destination in sorted(SUBDESTINATIONS): + yield '{0}-{1}'.format(mlist.list_name, destination) |
