From: Daniel Schoepe <daniel.schoepe@googlemail.com>
To: sup-talk <sup-talk@rubyforge.org>
Subject: [sup-talk] [patch] Add crypto_selector variable to before-edit
Date: Mon, 18 Jan 2010 15:32:26 +0100 [thread overview]
Message-ID: <1263824428-sup-6466@nemesis.home> (raw)
[-- Attachment #1.1.1: Type: text/plain, Size: 391 bytes --]
This patch adds crypto_selector to the variables available to the
before-edit hook, so one can set default crypto-options or
sign/encrypt a mail depending on e.g the message or header content.
Users should beware that the variable can be nil, since the same hook
is also run from reply_mode which doesn't have access to the
crypto_selector element or crypto-support can be absent entirely.
[-- Attachment #1.1.2: add_crypto_selector.patch --]
[-- Type: application/octet-stream, Size: 2056 bytes --]
From 1a8e906a7e49226021d088073f40f8cc0c4d75c6 Mon Sep 17 00:00:00 2001
From: Daniel Schoepe <daniel.schoepe@googlemail.com>
Date: Mon, 18 Jan 2010 15:16:25 +0100
Subject: [PATCH] Added crypto_selector to before-edit hook
---
lib/sup/modes/edit-message-mode.rb | 9 +++++----
lib/sup/modes/reply-mode.rb | 2 +-
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/lib/sup/modes/edit-message-mode.rb b/lib/sup/modes/edit-message-mode.rb
index 8849271..b991d73 100644
--- a/lib/sup/modes/edit-message-mode.rb
+++ b/lib/sup/modes/edit-message-mode.rb
@@ -34,8 +34,10 @@ EOS
Modifies message body and headers before editing a new message. Variables
should be modified in place.
Variables:
- header: a hash of headers. See 'signature' hook for documentation.
- body: an array of lines of body text.
+ header: a hash of headers. See 'signature' hook for documentation.
+ body: an array of lines of body text.
+ crypto_selector: the UI element for cryptography settings; useful for
+ default settings. (Can be nil)
Return value:
none
EOS
@@ -90,8 +92,7 @@ EOS
HorizontalSelector.new "Crypto:", [:none] + CryptoManager::OUTGOING_MESSAGE_OPERATIONS.keys, ["None"] + CryptoManager::OUTGOING_MESSAGE_OPERATIONS.values
end
add_selector @crypto_selector if @crypto_selector
-
- HookManager.run "before-edit", :header => @header, :body => @body
+ HookManager.run "before-edit", :header => @header, :body => @body, :crypto_selector => @crypto_selector
super opts
regen_text
diff --git a/lib/sup/modes/reply-mode.rb b/lib/sup/modes/reply-mode.rb
index 3d39a8a..1453393 100644
--- a/lib/sup/modes/reply-mode.rb
+++ b/lib/sup/modes/reply-mode.rb
@@ -151,7 +151,7 @@ EOS
end)
@headers.each do |k, v|
- HookManager.run "before-edit", :header => v, :body => body
+ HookManager.run "before-edit", :header => v, :body => body, :crypto_selector => nil
end
super :header => @headers[@type_selector.val], :body => body, :twiddles => false
--
1.6.6
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 140 bytes --]
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
next reply other threads:[~2010-01-18 14:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-18 14:32 Daniel Schoepe [this message]
2010-01-23 12:53 ` William Morgan
2010-01-24 11:10 ` Carlos Garcia Campos
2010-01-26 15:55 ` Daniel Schoepe
2010-01-26 18:19 ` Ben Walton
2010-02-27 18:17 ` Rich Lane
2010-03-09 10:29 ` Gaute Hope
2010-03-12 22:03 ` Daniel Schoepe
2010-03-12 22:34 ` Gaute Hope
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=1263824428-sup-6466@nemesis.home \
--to=daniel.schoepe@googlemail.com \
--cc=sup-talk@rubyforge.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