Gnus development mailing list
 help / color / mirror / Atom feed
From: Wolfram Fenske <Wolfram.Fenske@Student.Uni-Magdeburg.DE>
To: ding@gnus.org
Cc: Daiki Ueno <ueno@unixuser.org>
Subject: Re: epg and expired recipient keys
Date: Tue, 06 Mar 2007 03:19:49 +0100	[thread overview]
Message-ID: <867itvcdve.fsf@hondo.cadr.de> (raw)
In-Reply-To: <a62f61ff-ae93-415e-a50b-93c5679f4409@well-done.deisui.org> (Daiki Ueno's message of "Thu, 01 Mar 2007 07:23:26 +0900")

Daiki Ueno <ueno@unixuser.org> writes:

>>>>>> In <87zm71f0sl.fsf@wheatstone.g10code.de> 
>>>>>>	Werner Koch <wk@gnupg.org> wrote:
>> > I'm now wondering whether to exclude unusable keys from the key list
>
>> Yes, please do this when encrypting.
>
> Okay, I just installed this in Gnus CVS.  The filter function is
>
> (defun mml2015-epg-find-usable-key (keys usage)
>   (catch 'found
>     (while keys
>       (let ((pointer (epg-key-sub-key-list (car keys))))
>         (while pointer
>           (if (and (memq usage (epg-sub-key-capability (car pointer)))
>                    (not (memq (epg-sub-key-validity (car pointer))
>                               '(revoked expired))))
>               (throw 'found (car keys)))
>           (setq pointer (cdr pointer))))
>       (setq keys (cdr keys)))))

How about a version that uses the "dolist" macro?  I think this makes
the code a lot clearer.  Plus, it's shorter.

--8<---------------cut here---------------start------------->8---
(defun mml2015-epg-find-usable-key (keys usage)
  (catch 'found
    (dolist (key keys)
      (dolist (sub (epg-key-sub-key-list key))
	(when (and (memq usage (epg-sub-key-capability sub))
                   (not (memq (epg-sub-key-validity sub) '(revoked expired))))
	  (throw 'found key))))))
--8<---------------cut here---------------end--------------->8---

-- 
Wolfram Fenske

A: Yes.
>Q: Are you sure?
>>A: Because it reverses the logical flow of conversation.
>>>Q: Why is top posting frowned upon?




  reply	other threads:[~2007-03-06  2:19 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-23 13:02 Michael Piotrowski
2007-02-24 16:00 ` Werner Koch
2007-02-26 10:37   ` Michael Piotrowski
     [not found]   ` <smutzxbtsam.fsf@linuxpal.mit.edu>
2007-02-26 12:23     ` Werner Koch
2007-02-26 12:49       ` Daiki Ueno
2007-02-26 14:31         ` Werner Koch
2007-02-27 11:23           ` Michael Piotrowski
2007-02-28 22:23           ` Daiki Ueno
2007-03-06  2:19             ` Wolfram Fenske [this message]
2007-03-06  4:29               ` Katsumi Yamaoka
2007-03-06  9:41                 ` Wolfram Fenske
2007-03-07 19:19                 ` Miles Bader
2007-03-07 19:25                   ` Miles Bader
2007-03-08  1:06                     ` dolist vs. while-loop (was Re: epg and expired recipient keys) Katsumi Yamaoka
2007-03-08 14:55                       ` Miles Bader
2007-03-06  4:40               ` epg and expired recipient keys Daiki Ueno
2007-03-06  9:37                 ` Wolfram Fenske

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=867itvcdve.fsf@hondo.cadr.de \
    --to=wolfram.fenske@student.uni-magdeburg.de \
    --cc=ding@gnus.org \
    --cc=ueno@unixuser.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;
as well as URLs for NNTP newsgroup(s).