From 8786427bb356878664767eaed0fa5d7a0e053693 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Thu, 31 May 2012 22:27:42 -0400 Subject: [PATCH] Ignore keys that aren't usable for encryption rather than just expired keys Signed-off-by: James McCoy --- plugin/gnupg.vim | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/plugin/gnupg.vim b/plugin/gnupg.vim index 046100d..97539c5 100644 --- a/plugin/gnupg.vim +++ b/plugin/gnupg.vim @@ -139,7 +139,7 @@ if (exists("g:loaded_gnupg") || &cp || exists("#GnuPG")) finish endif -let g:loaded_gnupg = '2.4' +let g:loaded_gnupg = '2.5' let s:GPGInitRun = 0 " check for correct vim version {{{2 @@ -1091,11 +1091,6 @@ function s:GPGNameToID(name) let fields = split(line, ":") - " Ignore expired keys - if fields[1] == 'e' - continue - endif - " search for the next uid if pubseen if (fields[0] == "uid") @@ -1106,6 +1101,11 @@ function s:GPGNameToID(name) " search for the next pub else if (fields[0] == "pub") + " Ignore keys which are not usable for encryption + if fields[11] !~? 'e' + continue + endif + let identity = fields[4] let gpgids += [identity] if exists("*strftime") @@ -1163,13 +1163,13 @@ function s:GPGIDToName(identity) for line in lines let fields = split(line, ":") - " Ignore expired keys - if fields[1] == 'e' - continue - endif - if !pubseen " search for the next pub if (fields[0] == "pub") + " Ignore keys which are not usable for encryption + if fields[11] !~? 'e' + continue + endif + let pubseen = 1 endif else " search for the next uid