From 484d69889fa4af71b45fd84ab0bec506f3d03983 Mon Sep 17 00:00:00 2001 From: Daniel Kahn Gillmor Date: Wed, 20 Apr 2011 13:14:59 -0400 Subject: [PATCH] remove findall argument, clean up indentation --- Crypt/Monkeysphere/Validator.pm | 41 +++++++++++++++------------------ 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/Crypt/Monkeysphere/Validator.pm b/Crypt/Monkeysphere/Validator.pm index dacea6d..b49c7a6 100644 --- a/Crypt/Monkeysphere/Validator.pm +++ b/Crypt/Monkeysphere/Validator.pm @@ -12,15 +12,13 @@ use parent 'Crypt::Monkeysphere::Keyserver'; Create a new Crypt::Monkeysphere::Validator instance Arguments - - Param hash, all optional. - findall => 0|1 return all suitable keys, rather than first suitable + Param hash, all optional. - context => 'e-mail' | something else. - control what counts as a suitable key. + context => 'e-mail' | 'https' | 'ssh', etc. + control what counts as a suitable user IDs. - kspolicy => 'always|never|unlessvalid' + kspolicy => 'always|never|unlessvalid' when to fetch keys from keyserver. (plus arguments for Crypt::Monkeysphere::{Keyserver,Logger}::new ) @@ -33,7 +31,6 @@ sub new { my $self=$class->SUPER::new(%opts); - $self->{findall} = $opts{findall} || 0; $self->{context}=$opts{context} || 'ssh'; $self->{kspolicy}=$opts{kspolicy} || 'unlessvalid'; return $self; @@ -109,7 +106,7 @@ sub query{ $self->log('verbose', "...and is fully valid!\n"); push(@{$ret->{valid_keys}}, { fingerprint => $subkey->fingerprint, val => $validity }); - last unless($self->{findall}); + last; } else { $self->log('verbose', "...but is not fully valid (%s).\n",$validity); push(@{$ret->{subvalid_keys}}, @@ -118,24 +115,22 @@ sub query{ } } } - last if ($foundvalid); - } - if ($lastloop || $foundvalid) { - last; - } else { - if (!$foundvalid) { - if (defined $fpr) { - $self->fetch_fpr($fpr); - } else { - $self->fetch_uid($uid); - } - } - $lastloop = 1; + last if ($foundvalid); + } + if ($lastloop || $foundvalid) { + last; + } else { + if (!$foundvalid) { + if (defined $fpr) { + $self->fetch_fpr($fpr); + } else { + $self->fetch_uid($uid); + } } + $lastloop = 1; } - + } return $ret; - } sub keycomp { -- 2.26.2