summaryrefslogtreecommitdiff
path: root/src/mailman/interfaces/bounce.py
diff options
context:
space:
mode:
authorBarry Warsaw2011-05-15 12:19:25 -0400
committerBarry Warsaw2011-05-15 12:19:25 -0400
commitb8e977bfe7b144c690c30a4bc0b94d74a35faeac (patch)
tree069e91e7b1a436336eb23683bbb0fd474924fab4 /src/mailman/interfaces/bounce.py
parent091917126e7c58657310524882743e8391166fc3 (diff)
parent9d30e3d7f584093fd30d2cbdd1124b4d49adb132 (diff)
downloadmailman-b8e977bfe7b144c690c30a4bc0b94d74a35faeac.tar.gz
mailman-b8e977bfe7b144c690c30a4bc0b94d74a35faeac.tar.zst
mailman-b8e977bfe7b144c690c30a4bc0b94d74a35faeac.zip
Merge current bounces work.
Diffstat (limited to 'src/mailman/interfaces/bounce.py')
-rw-r--r--src/mailman/interfaces/bounce.py63
1 files changed, 62 insertions, 1 deletions
diff --git a/src/mailman/interfaces/bounce.py b/src/mailman/interfaces/bounce.py
index 22e2467b8..168ca7ee0 100644
--- a/src/mailman/interfaces/bounce.py
+++ b/src/mailman/interfaces/bounce.py
@@ -21,13 +21,16 @@ from __future__ import absolute_import, unicode_literals
__metaclass__ = type
__all__ = [
+ 'BounceContext',
'IBounceDetector',
+ 'IBounceEvent',
+ 'IBounceProcessor',
'Stop',
]
from flufl.enum import Enum
-from zope.interface import Interface
+from zope.interface import Attribute, Interface
@@ -39,6 +42,19 @@ Stop = object()
+class BounceContext(Enum):
+ """The context in which the bounce was detected."""
+
+ # This is a normal bounce detection. IOW, Mailman received a bounce in
+ # response to a mailing list post.
+ normal = 1
+
+ # A probe email bounced. This can be considered a bit more serious, since
+ # it occurred in response to a specific message to a specific user.
+ probe = 2
+
+
+
class IBounceDetector(Interface):
"""Detect a bounce in an email message."""
@@ -52,3 +68,48 @@ class IBounceDetector(Interface):
returned to halt any bounce processing pipeline.
:rtype: A set strings, or `Stop`
"""
+
+
+
+class IBounceEvent(Interface):
+ """Registration record for a single bounce event."""
+
+ list_name = Attribute(
+ """The name of the mailing list that received this bounce.""")
+
+ email = Attribute(
+ """The email address that bounced.""")
+
+ timestamp = Attribute(
+ """The timestamp for when the bounce was received.""")
+
+ message_id = Attribute(
+ """The Message-ID of the bounce message.""")
+
+ context = Attribute(
+ """Where was the bounce detected?""")
+
+ processed = Attribute(
+ """Has this bounce event been processed?""")
+
+
+
+class IBounceProcessor(Interface):
+ """Manager/processor of bounce events."""
+
+ def register(mlist, email, msg, context=None):
+ """Register a bounce event.
+
+ :param mlist: The mailing list that the bounce occurred on.
+ :type mlist: IMailingList
+ :param email: The email address that is bouncing.
+ :type email: str
+ :param msg: The bounce message.
+ :type msg: email.message.Message
+ :param context: In what context was the bounce detected? The default
+ is 'normal' context (i.e. we received a normal bounce for the
+ address).
+ :type context: BounceContext
+ :return: The registered bounce event.
+ :rtype: IBounceEvent
+ """