From 28028319c90743b253bb554865e97d2c41cb07c0 Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Mon, 18 May 2020 14:38:20 -0400 Subject: [PATCH] move reply handler to this repo It makes sense to be here --- mp/yyz.py | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 mp/yyz.py diff --git a/mp/yyz.py b/mp/yyz.py new file mode 100644 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/ +# +# AddHandler python-program .py +# PythonHandler yyz +# PythonDebug on +# + +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 -- 2.25.1