]> git.sthu.org Git - pgp-tools.git/commitdiff
Sort keys by creation date.
authorweasel <weasel@b513b33f-fedd-0310-b452-c3deb5f4c849>
Tue, 16 Aug 2005 14:25:08 +0000 (14:25 +0000)
committerweasel <weasel@b513b33f-fedd-0310-b452-c3deb5f4c849>
Tue, 16 Aug 2005 14:25:08 +0000 (14:25 +0000)
git-svn-id: svn://svn.debian.org/pgp-tools/trunk@179 b513b33f-fedd-0310-b452-c3deb5f4c849

keylookup/NEWS
keylookup/keylookup

index 6e90f921a23b59d3adf79be74f568c3efd822246..db8a7323bee76e5ca3ec4735993679278d6083b0 100644 (file)
@@ -3,6 +3,7 @@ $Id$
 Release notes for keylookup 3.0 (2005-08-16)
  * Make keylookup use gpg --search instead of querying the
    keyserver directly.
+ * Sort keys by creation date.
 
 Release notes for keylookup 2.2 (2002-09-24)
  * Some keyservers have started putting the key type (DSA or RSA)
index 0b46a69ae234696d7c564e4b0d28fc45415fee82..4c3ccefbfe4318647162758510c36e3ed2d486e0 100755 (executable)
@@ -105,13 +105,10 @@ sub getHits($) {
                my ($type, undef) = split /:/;
                if ($type eq 'pub') {
                        my ($type, $keyid, $algo, $bits, $created, undef, $revoked) = split /:/;
-                       my (undef,undef,undef,$mday,$mon,$year,undef,undef,undef) = localtime ($created);
                        $currentKey = { 'bits' => $bits,
                                        'type' => (defined $ALGOS{$algo} ? $ALGOS{$algo} : '#'.$algo),
                                        'keyid' => $keyid,
-                                       'year' => $year+1900,
-                                       'month' => $mon+1,
-                                       'day' => $mday,
+                                       'created' => $created,
                                        'revoked' => $revoked,
                                        'uid' => []
                                      };
@@ -169,13 +166,15 @@ sub prepareForDialog {
        my $keys = shift;
        my @keyargs = ();
 
-       for my $keyid (keys %$keys) {
+       for my $keyid (sort {- ($keys->{$a}->{'created'} <=> $keys->{$b}->{'created'})} keys %$keys) {
                for (@{ $keys->{$keyid}->{'uid'} }) {
                        push @keyargs,
                                $keys->{$keyid}->{'keyid'},
                                length() <= $MAX_UID_FIELD_LEN ? $_ : substr($_, 0, $MAX_UID_FIELD_LEN-2) . '..',
                                'off';
                };
+               my (undef,undef,undef,$mday,$mon,$year,undef,undef,undef) = localtime ($keys->{$keyid}->{'created'});
+               push @keyargs, $keys->{$keyid}->{'keyid'}, sprintf( "[created: %s-%s-%s]", $year+1900, $mon+1, $mday ), 'off';
                push @keyargs, '-'x8, '-'x40, 'off';
        };
        pop @keyargs;
@@ -189,14 +188,13 @@ sub prepareForTXT {
        my $keys = shift;
        my @lines = ();
 
-       for my $keyid (keys %$keys) {
+       for my $keyid (sort {- ($keys->{$a}->{'created'} <=> $keys->{$b}->{'created'})} keys %$keys) {
+               my (undef,undef,undef,$mday,$mon,$year,undef,undef,undef) = localtime ($keys->{$keyid}->{'created'});
                push @lines, sprintf( "%s%s/%s %s-%s-%s\n",
                                      $keys->{$keyid}->{'bits'},
                                      $keys->{$keyid}->{'type'},
                                      $keys->{$keyid}->{'keyid'},
-                                     $keys->{$keyid}->{'year'},
-                                     $keys->{$keyid}->{'month'},
-                                     $keys->{$keyid}->{'day'} );
+                                     $year+1900, $mon+1, $mday );
                push @lines, map { ' 'x26 . $_ . "\n" } @{ $keys->{$keyid}->{'uid'} };
                push @lines, "\n";
        };