From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 10.42.240.136 with SMTP id la8cs123646icb; Wed, 9 Feb 2011 14:23:36 -0800 (PST) Received: by 10.224.20.73 with SMTP id e9mr15537446qab.74.1297290215597; Wed, 09 Feb 2011 14:23:35 -0800 (PST) Return-Path: Received: from rubyforge.org (rubyforge.org [205.234.109.19]) by mx.google.com with ESMTP id d13si1043750vcs.109.2011.02.09.14.23.35; Wed, 09 Feb 2011 14:23:35 -0800 (PST) Received-SPF: pass (google.com: domain of sup-devel-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) client-ip=205.234.109.19; Authentication-Results: mx.google.com; spf=pass (google.com: domain of sup-devel-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) smtp.mail=sup-devel-bounces@rubyforge.org; dkim=neutral (body hash did not verify) header.i=@gmail.com Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id E93C41D780F8; Wed, 9 Feb 2011 17:23:34 -0500 (EST) Received: from mail-qw0-f50.google.com (mail-qw0-f50.google.com [209.85.216.50]) by rubyforge.org (Postfix) with ESMTP id B35CB185835A for ; Wed, 9 Feb 2011 17:03:55 -0500 (EST) Received: by qwd6 with SMTP id 6so568165qwd.23 for ; Wed, 09 Feb 2011 14:03:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=zss8032DvjkASD6U6mtXhf/EBJkCH+/cpuc2jhSbJZE=; b=Ylb9Vs1SRIOLvIBw/sfwQcZoOaLRCnbBdCQrxJZGyfzE6y9ypvULKljGrBtzoJmf4p tFlykqN/eNsFwvRr/n8dv2MYGaahkpQXLVdODcscwprl9U5W7OkQLb5JWL83KqoJCinf NFYhw6I9WnE49MfghoJznOyAkapv6FpSRfoCI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=Vi+AJYUmxIDXHPBDAJs15unXtv+19snNdXMWODFgXLylBImKGMYCd6KomaMX0LuxWW OFIsJ3FkySqewMoUaBazB6SywwqoeTNGrdOV37z3O0ZVlg1XjMwf7W+KuH7f5pSZ3nx6 X5SlzPRu6ux/hu18D43K8FGBWhq+ppEzCIMsc= MIME-Version: 1.0 Received: by 10.229.184.208 with SMTP id cl16mr15310093qcb.216.1297289035258; Wed, 09 Feb 2011 14:03:55 -0800 (PST) Received: by 10.229.218.79 with HTTP; Wed, 9 Feb 2011 14:03:55 -0800 (PST) Date: Wed, 9 Feb 2011 22:03:55 +0000 Message-ID: From: Hamish D To: Sup developer discussion Subject: [sup-devel] BRANCH: rerun_crypto_selector X-BeenThere: sup-devel@rubyforge.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: Sup developer discussion List-Id: Sup developer discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: sup-devel-bounces@rubyforge.org Errors-To: sup-devel-bounces@rubyforge.org I noticed that if I changed the reply-to selector that my crypto-selector hook wasn't getting called, so I've made a branch called rerun_crypto_selector (and merged it to next). From the main commit message in the branch: Re-run the crypto selector hook after message changes. The crypto-selector hook will be re-run after the message is edited, or after the recipients change due to changing the "Reply to" selector in reply-mode. So when the recipients change, the default selector will also change. However, if the user has manually changed the crypto selector then the hook will not be re-run, so as to avoid over-riding the user's choice. I've also updated the wiki as the headers["to"] bit is sometimes an array. Working much nicer now. I've pasted in the two patches at the end for those who like to review them in the email. Hamish Downer commit f111201a469fd1c1dccb143e089cc623ce35025d Author: Hamish Downer Date: Tue Feb 8 23:53:13 2011 +0000 added @changed_by_user to HorizontalSelector diff --git a/lib/sup/horizontal-selector.rb b/lib/sup/horizontal-selector.rb index 35a028e..e6ec6dc 100644 --- a/lib/sup/horizontal-selector.rb +++ b/lib/sup/horizontal-selector.rb @@ -1,7 +1,7 @@ module Redwood class HorizontalSelector - attr_accessor :label + attr_accessor :label, :changed_by_user def initialize label, vals, labels, base_color=:horizontal_selector_unselected_color, selected_color=:horizontal_selector_selected_color @label = label @@ -10,6 +10,7 @@ class HorizontalSelector @base_color = base_color @selected_color = selected_color @selection = 0 + @changed_by_user = false end def set_to val; @selection = @vals.index(val) end @@ -37,10 +38,12 @@ class HorizontalSelector def roll_left @selection = (@selection - 1) % @labels.length + @changed_by_user = true end def roll_right @selection = (@selection + 1) % @labels.length + @changed_by_user = true end end commit 3cbccb471fc73b1593374ef8efea1a22ba237d89 Author: Hamish Downer Date: Wed Feb 9 18:58:30 2011 +0000 Re-run the crypto selector hook after message changes. The crypto-selector hook will be re-run after the message is edited, or after the recipients change due to changing the "Reply to" selector in reply-mode. So when the recipients change, the default selector will also change. However, if the user has manually changed the crypto selector then the hook will not be re-run, so as to avoid over-riding the user's choice. diff --git a/lib/sup/modes/edit-message-mode.rb b/lib/sup/modes/edit-message-mode.rb index 734a879..6c2d61c 100644 --- a/lib/sup/modes/edit-message-mode.rb +++ b/lib/sup/modes/edit-message-mode.rb @@ -179,6 +179,7 @@ EOS header, @body = parse_file @file.path @header = header - NON_EDITABLE_HEADERS handle_new_text @header, @body + rerun_crypto_selector_hook update @edited @@ -215,6 +216,12 @@ EOS protected + def rerun_crypto_selector_hook + if @crypto_selector && !@crypto_selector.changed_by_user + HookManager.run "crypto-mode", :header => @header, :body => @body, :crypto_selector => @crypto_selector + end + end + def mime_encode string string = [string].pack('M') # basic quoted-printable string.gsub!(/=\n/,'') # .. remove trailing newline diff --git a/lib/sup/modes/reply-mode.rb b/lib/sup/modes/reply-mode.rb index 079e4de..ccdf371 100644 --- a/lib/sup/modes/reply-mode.rb +++ b/lib/sup/modes/reply-mode.rb @@ -165,6 +165,7 @@ protected if @headers[@type_selector.val] != self.header self.header = @headers[@type_selector.val] self.body = @bodies[@type_selector.val] unless @edited + rerun_crypto_selector_hook update end end @@ -174,6 +175,7 @@ protected if @headers[@type_selector.val] != self.header self.header = @headers[@type_selector.val] self.body = @bodies[@type_selector.val] unless @edited + rerun_crypto_selector_hook update end end _______________________________________________ Sup-devel mailing list Sup-devel@rubyforge.org http://rubyforge.org/mailman/listinfo/sup-devel