sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit 4ce8afdf60d0690f407d610640a2c87d7b75b894
parent 881fcd852599a07985cdff563edf375be5ec21a0
Author: William Morgan <wmorgan-sup@masanjin.net>
Date:   Sun, 11 Oct 2009 13:01:08 -0700

make decrypt an interactive command

Diffstat:
M lib/sup/crypto.rb | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/lib/sup/crypto.rb b/lib/sup/crypto.rb
@@ -119,12 +119,17 @@ class CryptoManager
     payload_fn.write payload.to_s
     payload_fn.close
 
-    output = run_gpg "--decrypt #{payload_fn.path}"
+    output_fn = Tempfile.new "redwood.output"
+    output_fn.close
+
+    message = run_gpg "--output #{output_fn.path} --yes --decrypt #{payload_fn.path}", :interactive => true
 
     unless $?.success?
-      return Chunk::CryptoNotice.new(:invalid, "This message could not be decrypted", output.split("\n"))
+      info "Error while running gpg: #{message}"
+      return Chunk::CryptoNotice.new(:invalid, "This message could not be decrypted", message.split("\n"))
     end
 
+    output = IO.read output_fn.path
     decrypted_payload, sig_lines = if output =~ /\A(.*?)((^gpg: .*$)+)\Z/m
       [$1, $2]
     else