From: cworth@cworth.org (Carl Worth)
Subject: [sup-talk] [PATCH] Add new :crypto_default configuration option.
Date: Mon, 28 Sep 2009 15:57:38 -0700 [thread overview]
Message-ID: <1254178611-sup-369@yoom.home.cworth.org> (raw)
For example, users that want to sign all outgoing messages by default
can set:
:crypto_default: :sign
in ~/.sup/config.yaml. Configuring an invalid value will cause a list
of the valid values to be logged at the "error" level.
---
lib/sup/horizontal-selector.rb | 8 +++++++-
lib/sup/modes/edit-message-mode.rb | 7 ++++++-
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/lib/sup/horizontal-selector.rb b/lib/sup/horizontal-selector.rb
index aef16d4..13c63ed 100644
--- a/lib/sup/horizontal-selector.rb
+++ b/lib/sup/horizontal-selector.rb
@@ -12,7 +12,13 @@ class HorizontalSelector
@selection = 0
end
- def set_to val; @selection = @vals.index(val) end
+ def set_to val
+ if @vals.index(val)
+ @selection = @vals.index(val)
+ else
+ error "Invalid option ", val.inspect, " (valid options: ", @vals.inspect, ")"
+ end
+ end
def val; @vals[@selection] end
diff --git a/lib/sup/modes/edit-message-mode.rb b/lib/sup/modes/edit-message-mode.rb
index 8da316f..3449503 100644
--- a/lib/sup/modes/edit-message-mode.rb
+++ b/lib/sup/modes/edit-message-mode.rb
@@ -89,7 +89,12 @@ EOS
if CryptoManager.have_crypto?
HorizontalSelector.new "Crypto:", [:none] + CryptoManager::OUTGOING_MESSAGE_OPERATIONS.keys, ["None"] + CryptoManager::OUTGOING_MESSAGE_OPERATIONS.values
end
- add_selector @crypto_selector if @crypto_selector
+ if @crypto_selector
+ if !$config[:crypto_default].nil?
+ @crypto_selector.set_to $config[:crypto_default]
+ end
+ add_selector @crypto_selector
+ end
HookManager.run "before-edit", :header => @header, :body => @body
--
1.6.4.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: not available
URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090928/cc5a4c98/attachment.bin>
next reply other threads:[~2009-09-28 22:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-28 22:57 Carl Worth [this message]
2009-10-01 17:07 ` William Morgan
2009-10-01 17:31 ` Carl Worth
2009-10-06 17:16 ` William Morgan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1254178611-sup-369@yoom.home.cworth.org \
--to=cworth@cworth.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox