X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=mutt%2Fcrypto-autoencrypt.pl;h=6bce8cc3f7c264b9eaecff90ec8538d48da060f0;hb=bf502c718806d7711c584078648803affa67e127;hp=6895dcc47b74dc06dac4ee7702efa211c93d1d92;hpb=ddbb97e0f525662b44e8346ffd713e42933475bd;p=config%2Fdotfiles.git diff --git a/mutt/crypto-autoencrypt.pl b/mutt/crypto-autoencrypt.pl index 6895dcc..6bce8cc 100755 --- a/mutt/crypto-autoencrypt.pl +++ b/mutt/crypto-autoencrypt.pl @@ -3,7 +3,7 @@ # Helper script for mutt to create a list of send-hooks which enable # crypt_autoencrypt for known GnuPG keys. -# Copyright (C) 2009-2012 Simon Ruderich +# Copyright (C) 2009-2013 Simon Ruderich # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -24,7 +24,15 @@ use warnings; open my $gpg, '-|', 'gpg --list-keys --with-colons --fixed-list-mode' or die $!; while (<$gpg>) { - next unless /<(.+?@.+?)>/; + next if not /^uid:/; + + # We don't skip invalid, deleted, revoked, expired and not-trusted UIDs to + # prevent sending an unencrypted mail when e.g. a key is revoked or + # expired; GnuPG will warn if we use any of them. If you really want to + # skip those UIDs (not recommended), uncomment the next line. + #next if /^uid:[idren]:/; + + next if not /<(.+?@.+?)>:/; print "send-hook '~t .*$1.*' 'set crypt_autoencrypt=yes'\n"; } close $gpg or die $!;