aboutsummaryrefslogtreecommitdiffstats
path: root/interfaces/email
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2009-07-15 09:55:20 -0400
committerW. Trevor King <wking@drexel.edu>2009-07-15 09:55:20 -0400
commitbf6a5fdf33daabc0aa8e05b75d0a24cd3abbbdf6 (patch)
tree4c5cd427186fca39131b1091b98d1b5c495ec48f /interfaces/email
parent7286b98027a7230d948ff7517fd2e25bfd1f66a2 (diff)
downloadbugseverywhere-bf6a5fdf33daabc0aa8e05b75d0a24cd3abbbdf6.tar.gz
Incorperated send_pgp_mime into be-handle-mail.
Todo: generate a real response email to replace the current dummy email.
Diffstat (limited to 'interfaces/email')
-rwxr-xr-xinterfaces/email/interactive/be-handle-mail19
1 files changed, 16 insertions, 3 deletions
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 <jdoe@example.com>
+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()