line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Off-the-Record Account (private key) |
2
|
|
|
|
|
|
|
package Protocol::OTR::Account; |
3
|
|
|
|
|
|
|
BEGIN { |
4
|
4
|
|
|
4
|
|
299
|
$Protocol::OTR::Account::AUTHORITY = 'cpan:AJGB'; |
5
|
|
|
|
|
|
|
} |
6
|
|
|
|
|
|
|
$Protocol::OTR::Account::VERSION = '0.05'; |
7
|
4
|
|
|
4
|
|
23
|
use strict; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
137
|
|
8
|
4
|
|
|
4
|
|
20
|
use warnings; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
132
|
|
9
|
4
|
|
|
4
|
|
1769
|
use Protocol::OTR::Contact (); |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
92
|
|
10
|
4
|
|
|
4
|
|
26
|
use Params::Validate qw(validate validate_pos SCALAR BOOLEAN); |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
1193
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub _new { |
13
|
6
|
|
|
6
|
|
13
|
my ($class, $otr, $args, $find_only) = @_; |
14
|
|
|
|
|
|
|
|
15
|
6
|
100
|
|
|
|
22
|
my $m = $find_only ? "_find_account" : "_account"; |
16
|
|
|
|
|
|
|
|
17
|
6
|
|
|
|
|
1107637
|
$args->{fingerprint} = $otr->$m( $args->{name}, $args->{protocol} ); |
18
|
|
|
|
|
|
|
|
19
|
6
|
50
|
|
|
|
45
|
return unless $args->{fingerprint}; |
20
|
|
|
|
|
|
|
|
21
|
6
|
|
|
|
|
39
|
my $self = bless $args, $class; |
22
|
6
|
|
|
|
|
44
|
$self->{otr} = $otr; |
23
|
|
|
|
|
|
|
|
24
|
6
|
|
|
|
|
43
|
return $self; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub ctx { |
28
|
1
|
|
|
1
|
1
|
7
|
return $_[0]->{otr}; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub name { |
32
|
129
|
|
|
129
|
1
|
1903
|
return $_[0]->{name}; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub protocol { |
36
|
5
|
|
|
5
|
1
|
19
|
return $_[0]->{protocol}; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub fingerprint { |
40
|
9
|
|
|
9
|
1
|
42
|
return $_[0]->{fingerprint}; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub contact { |
44
|
9
|
|
|
9
|
1
|
988
|
my $self = shift; |
45
|
|
|
|
|
|
|
|
46
|
9
|
|
|
|
|
540
|
my ($name, $fingerprint, $is_verified) = validate_pos( |
47
|
|
|
|
|
|
|
@_, |
48
|
|
|
|
|
|
|
{ |
49
|
|
|
|
|
|
|
type => SCALAR, |
50
|
|
|
|
|
|
|
}, |
51
|
|
|
|
|
|
|
{ |
52
|
|
|
|
|
|
|
type => SCALAR, |
53
|
|
|
|
|
|
|
optional => 1, |
54
|
|
|
|
|
|
|
}, |
55
|
|
|
|
|
|
|
{ |
56
|
|
|
|
|
|
|
type => BOOLEAN, |
57
|
|
|
|
|
|
|
optional => 1, |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
); |
60
|
|
|
|
|
|
|
|
61
|
7
|
|
|
|
|
63
|
return Protocol::OTR::Contact->_new( |
62
|
|
|
|
|
|
|
$self, |
63
|
|
|
|
|
|
|
{ |
64
|
|
|
|
|
|
|
name => $name, |
65
|
|
|
|
|
|
|
fingerprint => $fingerprint, |
66
|
|
|
|
|
|
|
is_verified => $is_verified, |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub contacts { |
72
|
4
|
|
|
4
|
1
|
1574
|
my ($self) = @_; |
73
|
|
|
|
|
|
|
|
74
|
6
|
|
|
|
|
24
|
return map { |
75
|
4
|
|
|
|
|
26
|
Protocol::OTR::Contact->_new($self, { name => $_ } ) |
76
|
4
|
|
|
|
|
6
|
} @{ $self->_contacts() } |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
__END__ |