From: W. Trevor King Date: Wed, 15 Jul 2009 13:55:20 +0000 (-0400) Subject: Incorperated send_pgp_mime into be-handle-mail. X-Git-Tag: 1.0.0~62^2~46^2~74 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=bf6a5fdf33daabc0aa8e05b75d0a24cd3abbbdf6;p=be.git Incorperated send_pgp_mime into be-handle-mail. Todo: generate a real response email to replace the current dummy email. --- diff --git a/interfaces/email/interactive/be-handle-mail b/interfaces/email/interactive/be-handle-mail index b5f1755..4257414 100755 --- a/interfaces/email/interactive/be-handle-mail +++ b/interfaces/email/interactive/be-handle-mail @@ -30,6 +30,7 @@ Eventually we'll commit after every message. import libbe.cmdutil import email +import send_pgp_mime import sys ALLOWED_COMMANDS = ["new", "comment", "list", "show", "help"] @@ -54,7 +55,7 @@ def get_body_type(msg): continue return (part.get_payload(decode=1), part.get_content_type()) -def handle_message(msg_text): +def run_message(msg_text): p=email.Parser.Parser() msg=p.parsestr(msg_text) @@ -87,11 +88,23 @@ def handle_message(msg_text): if "--alt-id" not in args: command_args = ["--alt-id", msg["message-id"]] + command_args command_args.append(body) - return libbe.cmdutil.execute(command, command_args) + # catch stdout, stderr + ret = libbe.cmdutil.execute(command, command_args) + # restore stdout, stderr + response_header = """From: John Doe +To: wking@drexel.edu +Date: Fri, 18 Apr 2008 12:00:00 +0000 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +Subject: [be-bug] Re: show --xml 123""" + response_body = "Dummy content" + response_email = send_pgp_mime.Mail(response_header, response_body) + return response_email def main(): msg_text = sys.stdin.read() - sys.exit(handle_message(msg_text)) + response_email = handle_message(msg_text) + send_pgp_mime.mail(response_email, send_pgp_mime.sendmail) if __name__ == "__main__": main()