blob: 11efc401ad4ac559d53e93c9e5cc50e8bf5d5344 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# ComparableUserId.pm
# - providing an object-oriented approach to GnuPG user ids
#
# Copyright (C) 2000 Frank J. Tobin <ftobin@cpan.org>
#
# This module is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# $Id: ComparableUserId.pm,v 1.3 2001/09/14 12:34:36 ftobin Exp $
#
package GnuPG::ComparableUserId;
use strict;
use base qw( GnuPG::UserId );
sub compare
{
my ( $self, $other, $deep ) = @_;
return 0 unless $self->user_id_string() eq $other->user_id_string();
return 0 unless $self->_deeply_compare( $other );
return 1;
}
sub _deeply_compare
{
my ( $self, $other ) = @_;
return 0 unless
$self->rigorously_compare( $other );
my @self_signatures = $self->signatures();
my @other_signatures = $other->signatures();
return 0 unless @self_signatures == @other_signatures;
my $num_sigs = @self_signatures;
for ( my $i = 0; $i < $num_sigs; $i++ )
{
return 0
unless $self_signatures[$i]->compare( $other_signatures[$i], 1 );
}
return 1;
}
1;
|