Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
* [sup-talk] [PATCH] decrypt returns 3 elem array if gpg is unavailable
@ 2009-09-03 16:38 Matt Zulak
  2009-09-04 14:34 ` William Morgan
  0 siblings, 1 reply; 2+ messages in thread
From: Matt Zulak @ 2009-09-03 16:38 UTC (permalink / raw)


CryptoManager's decrypt method returns a CryptoNotice if the GPG binary
can't be found on the path; however, the Message class expects a 3
element array with either a RMail::Message or nil at index 0.
This patch ensures sup plays nice when importing encrypted messages from
a mail-store on an environment that does not have GPG.
---
 lib/sup/crypto.rb |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/sup/crypto.rb b/lib/sup/crypto.rb
index 7f044b9..afbc445 100644
--- a/lib/sup/crypto.rb
+++ b/lib/sup/crypto.rb
@@ -105,7 +105,7 @@ class CryptoManager
 
   ## returns decrypted_message, status, desc, lines
   def decrypt payload # a RubyMail::Message object
-    return unknown_status(cant_find_binary) unless @cmd
+    return [nil, nil, unknown_status(cant_find_binary)] unless @cmd
 
     payload_fn = Tempfile.new "redwood.payload"
     payload_fn.write payload.to_s
-- 
1.6.2.1



^ permalink raw reply	[flat|nested] 2+ messages in thread

* [sup-talk] [PATCH] decrypt returns 3 elem array if gpg is unavailable
  2009-09-03 16:38 [sup-talk] [PATCH] decrypt returns 3 elem array if gpg is unavailable Matt Zulak
@ 2009-09-04 14:34 ` William Morgan
  0 siblings, 0 replies; 2+ messages in thread
From: William Morgan @ 2009-09-04 14:34 UTC (permalink / raw)


Reformatted excerpts from Matt Zulak's message of 2009-09-03:
> CryptoManager's decrypt method returns a CryptoNotice if the GPG
> binary can't be found on the path; however, the Message class expects
> a 3 element array with either a RMail::Message or nil at index 0.

Thanks. I've fixed this in a slightly different way, by returning the
notice as the first element. I think the code is a little easier to read
that way. Let me know if it doesn't work.
-- 
William <wmorgan-sup at masanjin.net>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-09-04 14:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-03 16:38 [sup-talk] [PATCH] decrypt returns 3 elem array if gpg is unavailable Matt Zulak
2009-09-04 14:34 ` William Morgan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox