summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbwarsaw1999-12-09 22:29:18 +0000
committerbwarsaw1999-12-09 22:29:18 +0000
commit11dff8cb470aacca93d587902a98f82be7701c1a (patch)
tree031d38ab447ac8ace50ee2f1c6eb9a2b1b55e903
parent3074b68c71d784fad4412442214cbf5321b2cc22 (diff)
downloadmailman-11dff8cb470aacca93d587902a98f82be7701c1a.tar.gz
mailman-11dff8cb470aacca93d587902a98f82be7701c1a.tar.zst
mailman-11dff8cb470aacca93d587902a98f82be7701c1a.zip
Port to the new bounce handling architecture.
-rwxr-xr-xscripts/mailowner23
-rwxr-xr-xscripts/owner23
2 files changed, 38 insertions, 8 deletions
diff --git a/scripts/mailowner b/scripts/mailowner
index 0e90d8562..749935dce 100755
--- a/scripts/mailowner
+++ b/scripts/mailowner
@@ -26,11 +26,17 @@ whose owner(s) to send mail to.
import sys
+import mimetools
+
import paths
+
+from Mailman import mm_cfg
from Mailman import MailList
from Mailman import Message
from Mailman.Handlers import HandlerAPI
+from Mailman.Bouncers import BouncerAPI
from Mailman.Logging.Utils import LogStdErr
+from Mailman.pythonlib.StringIO import StringIO
LogStdErr('error', 'post')
@@ -41,14 +47,23 @@ def main():
# fail, and should send back an error message when it does.
mlist = MailList.MailList(sys.argv[1])
try:
- msg = Message.Message(sys.stdin)
- if not mlist.bounce_processing or not mlist.ScanMessage(msg):
- msg.recips = mlist.owner
- HandlerAPI.DeliverToUser(mlist, msg)
+ s = StringIO(sys.stdin.read())
+ msg = mimetools.Message(s)
+ if mlist.bounce_processing:
+ if BouncerAPI.ScanMessages(mlist, msg):
+ return
+ # okay, no bounces were detected, but we have to convert this
+ # mimetools.Message thingie to one of our OutgoingMessages.
+ msg = Message.OutgoingMessage(s.getvalue())
+ msg.recips = mlist.owner[:]
+ # for debugging purposes
+ msg.recips.append(mm_cfg.MAILMAN_OWNER)
+ HandlerAPI.DeliverToUser(mlist, msg)
finally:
mlist.Save()
mlist.Unlock()
+
if __name__ == '__main__':
main()
diff --git a/scripts/owner b/scripts/owner
index 0e90d8562..749935dce 100755
--- a/scripts/owner
+++ b/scripts/owner
@@ -26,11 +26,17 @@ whose owner(s) to send mail to.
import sys
+import mimetools
+
import paths
+
+from Mailman import mm_cfg
from Mailman import MailList
from Mailman import Message
from Mailman.Handlers import HandlerAPI
+from Mailman.Bouncers import BouncerAPI
from Mailman.Logging.Utils import LogStdErr
+from Mailman.pythonlib.StringIO import StringIO
LogStdErr('error', 'post')
@@ -41,14 +47,23 @@ def main():
# fail, and should send back an error message when it does.
mlist = MailList.MailList(sys.argv[1])
try:
- msg = Message.Message(sys.stdin)
- if not mlist.bounce_processing or not mlist.ScanMessage(msg):
- msg.recips = mlist.owner
- HandlerAPI.DeliverToUser(mlist, msg)
+ s = StringIO(sys.stdin.read())
+ msg = mimetools.Message(s)
+ if mlist.bounce_processing:
+ if BouncerAPI.ScanMessages(mlist, msg):
+ return
+ # okay, no bounces were detected, but we have to convert this
+ # mimetools.Message thingie to one of our OutgoingMessages.
+ msg = Message.OutgoingMessage(s.getvalue())
+ msg.recips = mlist.owner[:]
+ # for debugging purposes
+ msg.recips.append(mm_cfg.MAILMAN_OWNER)
+ HandlerAPI.DeliverToUser(mlist, msg)
finally:
mlist.Save()
mlist.Unlock()
+
if __name__ == '__main__':
main()