summaryrefslogtreecommitdiff
path: root/src/mailman/interfaces
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman/interfaces')
-rw-r--r--src/mailman/interfaces/mailinglist.py83
-rw-r--r--src/mailman/interfaces/mime.py68
2 files changed, 138 insertions, 13 deletions
diff --git a/src/mailman/interfaces/mailinglist.py b/src/mailman/interfaces/mailinglist.py
index 2cfb9f737..1c1cbc869 100644
--- a/src/mailman/interfaces/mailinglist.py
+++ b/src/mailman/interfaces/mailinglist.py
@@ -22,6 +22,8 @@ from __future__ import absolute_import, unicode_literals
__metaclass__ = type
__all__ = [
'DigestFrequency',
+ 'IAcceptableAlias',
+ 'IAcceptableAliasSet',
'IMailingList',
'Personalization',
'ReplyToMunging',
@@ -281,10 +283,74 @@ class IMailingList(Interface):
that gets created to accumlate messages for the digest.
""")
- def clear_acceptable_aliases():
+ filter_content = Attribute(
+ """Flag specifying whether to filter a message's content.
+
+ Filtering is performed on MIME type and file name extension.
+ """)
+
+ convert_html_to_plaintext = Attribute(
+ """Flag specifying whether text/html parts should be converted.
+
+ When True, after filtering, if there are any text/html parts left in
+ the original message, they are converted to text/plain.
+ """)
+
+ collapse_alternatives = Attribute(
+ """Flag specifying whether multipart/alternatives should be collapsed.
+
+ After all MIME content filtering is complete, collapsing alternatives
+ replaces the outer multipart/alternative parts with the first
+ subpart.
+ """)
+
+ filter_types = Attribute(
+ """Sequence of MIME types that should be filtered out.
+
+ These can be either main types or main/sub types. Set this attribute
+ to a sequence to change it, or to None to empty it.
+ """)
+
+ pass_types = Attribute(
+ """Sequence of MIME types to explicitly pass.
+
+ These can be either main types or main/sub types. Set this attribute
+ to a sequence to change it, or to None to empty it. Pass types are
+ consulted after filter types, and only if `pass_types` is non-empty.
+ """)
+
+ filter_extensions = Attribute(
+ """Sequence of file extensions that should be filtered out.
+
+ Set this attribute to a sequence to change it, or to None to empty it.
+ """)
+
+ pass_extensions = Attribute(
+ """Sequence of file extensions to explicitly pass.
+
+ Set this attribute to a sequence to change it, or to None to empty it.
+ Pass extensions are consulted after filter extensions, and only if
+ `pass_extensions` is non-empty.
+ """)
+
+
+
+
+class IAcceptableAlias(Interface):
+ """An acceptable alias for implicit destinations."""
+
+ mailing_list = Attribute('The associated mailing list.')
+
+ address = Attribute('The address or pattern to match against recipients.')
+
+
+class IAcceptableAliasSet(Interface):
+ """The set of acceptable aliases for a mailing list."""
+
+ def clear():
"""Clear the set of acceptable posting aliases."""
- def add_acceptable_alias(alias):
+ def add(alias):
"""Add the given address as an acceptable aliases for posting.
:param alias: The email address to accept as a recipient for implicit
@@ -296,7 +362,7 @@ class IMailingList(Interface):
'@' sign in it.
"""
- def remove_acceptable_alias(alias):
+ def remove(alias):
"""Remove the given address as an acceptable aliases for posting.
:param alias: The email address to no longer accept as a recipient for
@@ -304,14 +370,5 @@ class IMailingList(Interface):
:type alias: string
"""
- acceptable_aliases = Attribute(
+ aliases = Attribute(
"""An iterator over all the acceptable aliases.""")
-
-
-
-class IAcceptableAlias(Interface):
- """An acceptable alias for implicit destinations."""
-
- mailing_list = Attribute('The associated mailing list.')
-
- address = Attribute('The address or pattern to match against recipients.')
diff --git a/src/mailman/interfaces/mime.py b/src/mailman/interfaces/mime.py
new file mode 100644
index 000000000..a1d74dc69
--- /dev/null
+++ b/src/mailman/interfaces/mime.py
@@ -0,0 +1,68 @@
+# Copyright (C) 2009 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/>.
+
+"""MIME content filtering."""
+
+from __future__ import absolute_import, unicode_literals
+
+__metaclass__ = type
+__all__ = [
+ 'FilterAction',
+ 'FilterType',
+ 'IContentFilter',
+ ]
+
+
+from munepy import Enum
+from zope.interface import Interface, Attribute
+
+
+
+class FilterAction(Enum):
+ # Discard a message that matches the content type filter.
+ discard = 0
+ # Bounce the message back to the original author.
+ bounce = 1
+ # Discard and forward the message on to the list owner.
+ forward = 2
+ # Discard, but preserve it.
+ preserve = 3
+
+
+class FilterType(Enum):
+ # Filter MIME type.
+ filter_mime = 0
+ # Pass MIME type.
+ pass_mime = 1
+ # Filter file extension.
+ filter_extension = 2
+ # Pass file extension.
+ pass_extension = 3
+
+
+
+class IContentFilter(Interface):
+ """A single content filter settings for a mailing list."""
+
+ mailing_list = Attribute(
+ """The mailing list for this content filter.""")
+
+ filter_pattern = Attribute(
+ """The filter/pass content pattern.""")
+
+ filter_type = Attribute(
+ """Type of filter.""")