move reply handler to this repo
authorIan Kelling <iank@fsf.org>
Mon, 18 May 2020 18:38:20 +0000 (14:38 -0400)
committerIan Kelling <iank@fsf.org>
Mon, 18 May 2020 18:38:20 +0000 (14:38 -0400)
It makes sense to be here

mp/yyz.py [new file with mode: 0644]

diff --git a/mp/yyz.py b/mp/yyz.py
new file mode 100644 (file)
index 0000000..a403aa9
--- /dev/null
+++ b/mp/yyz.py
@@ -0,0 +1,49 @@
+# handle the reply button when a message is displayed in the list archive.
+# Copyright (C) 2020  Free Software Foundation
+
+# This program 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 2 of the License, or
+# (at your option) any later version.
+
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+
+
+# iank: file had a date of 2002 on it. This
+
+
+## apache has this related configuration (this is duplicated in fsf ansible)
+# Alias /mp/ /home/mharc/mp/
+# <Directory /home/mharc/mp>
+#         AddHandler python-program .py
+#         PythonHandler yyz
+#         PythonDebug on
+# </Directory>
+
+from mod_python import apache, util
+from urllib import quote
+
+def handler (req):
+    if req.method != 'POST' or \
+           not req.headers_in.has_key ('content-type') or \
+           req.headers_in['content-type'][:10] != 'multipart/':
+        return apache.HTTP_NOT_FOUND
+
+    form = util.FieldStorage (req)
+    if form.has_key ('a') and form.has_key ('b') and \
+       form.has_key ('c') and form.has_key ('d'):
+        req.headers_out.add ('Location',
+                            'mailto:%s@%s?In-Reply-To=%s&Subject=%s' \
+                             % (quote(form['a']), quote(form['c']),
+                                quote(form['d']), quote(form['b'])))
+
+        return apache.HTTP_MOVED_TEMPORARILY
+
+    return apache.HTTP_NOT_FOUND