line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Off-the-Record Contact |
2
|
|
|
|
|
|
|
package Protocol::OTR::Contact; |
3
|
|
|
|
|
|
|
BEGIN { |
4
|
4
|
|
|
4
|
|
129
|
$Protocol::OTR::Contact::AUTHORITY = 'cpan:AJGB'; |
5
|
|
|
|
|
|
|
} |
6
|
|
|
|
|
|
|
$Protocol::OTR::Contact::VERSION = '0.05'; |
7
|
4
|
|
|
4
|
|
18
|
use strict; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
101
|
|
8
|
4
|
|
|
4
|
|
17
|
use warnings; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
79
|
|
9
|
4
|
|
|
4
|
|
16
|
use Protocol::OTR (); |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
51
|
|
10
|
4
|
|
|
4
|
|
1589
|
use Protocol::OTR::Fingerprint (); |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
67
|
|
11
|
4
|
|
|
4
|
|
2320
|
use Protocol::OTR::Channel (); |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
104
|
|
12
|
4
|
|
|
4
|
|
2294
|
use Params::Validate qw(validate CODEREF); |
|
4
|
|
|
|
|
29891
|
|
|
4
|
|
|
|
|
1530
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub _new { |
15
|
13
|
|
|
13
|
|
20
|
my ($class, $act, $args) = @_; |
16
|
|
|
|
|
|
|
|
17
|
13
|
|
|
|
|
833
|
$act->_contact( @$args{qw( name fingerprint is_verified )} ); |
18
|
|
|
|
|
|
|
|
19
|
13
|
|
|
|
|
38
|
my $self = bless $args, $class; |
20
|
13
|
|
|
|
|
47
|
$self->{act} = $act; |
21
|
|
|
|
|
|
|
|
22
|
13
|
|
|
|
|
71
|
return $self; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub account { |
26
|
10
|
|
|
10
|
1
|
46
|
return $_[0]->{act}; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub name { |
30
|
124
|
|
|
124
|
1
|
310
|
return $_[0]->{name}; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub fingerprints { |
34
|
9
|
|
|
9
|
1
|
1098
|
my ($self) = @_; |
35
|
|
|
|
|
|
|
|
36
|
11
|
|
|
|
|
45
|
return map { |
37
|
9
|
|
|
|
|
86
|
Protocol::OTR::Fingerprint->_new($self, $_) |
38
|
9
|
|
|
|
|
12
|
} @{ $self->_fingerprints() } |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub active_fingerprint { |
42
|
7
|
|
|
7
|
1
|
8
|
my ($self) = @_; |
43
|
|
|
|
|
|
|
|
44
|
7
|
100
|
|
|
|
62
|
if ( my $fprint = $self->_active_fingerprint() ) { |
45
|
6
|
|
|
|
|
19
|
return Protocol::OTR::Fingerprint->_new($self, $fprint); |
46
|
|
|
|
|
|
|
}; |
47
|
|
|
|
|
|
|
|
48
|
1
|
|
|
|
|
4
|
return; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub channel { |
52
|
5
|
|
|
5
|
1
|
797
|
my $self = shift; |
53
|
|
|
|
|
|
|
|
54
|
5
|
|
|
|
|
485
|
my %args = validate( |
55
|
|
|
|
|
|
|
@_, |
56
|
|
|
|
|
|
|
{ |
57
|
|
|
|
|
|
|
policy => { |
58
|
|
|
|
|
|
|
optional => 1, |
59
|
|
|
|
|
|
|
default => Protocol::OTR::POLICY_OPPORTUNISTIC(), |
60
|
|
|
|
|
|
|
}, |
61
|
|
|
|
|
|
|
max_message_size => { |
62
|
|
|
|
|
|
|
optional => 1, |
63
|
|
|
|
|
|
|
default => 0, |
64
|
|
|
|
|
|
|
}, |
65
|
|
|
|
|
|
|
on_read => { |
66
|
|
|
|
|
|
|
type => CODEREF, |
67
|
|
|
|
|
|
|
}, |
68
|
|
|
|
|
|
|
on_write => { |
69
|
|
|
|
|
|
|
type => CODEREF, |
70
|
|
|
|
|
|
|
}, |
71
|
|
|
|
|
|
|
on_gone_secure => { |
72
|
|
|
|
|
|
|
optional => 1, |
73
|
|
|
|
|
|
|
type => CODEREF, |
74
|
|
|
|
|
|
|
}, |
75
|
|
|
|
|
|
|
on_gone_insecure => { |
76
|
|
|
|
|
|
|
optional => 1, |
77
|
|
|
|
|
|
|
type => CODEREF, |
78
|
|
|
|
|
|
|
}, |
79
|
|
|
|
|
|
|
on_still_secure => { |
80
|
|
|
|
|
|
|
optional => 1, |
81
|
|
|
|
|
|
|
type => CODEREF, |
82
|
|
|
|
|
|
|
}, |
83
|
|
|
|
|
|
|
on_unverified_fingerprint => { |
84
|
|
|
|
|
|
|
optional => 1, |
85
|
|
|
|
|
|
|
type => CODEREF, |
86
|
|
|
|
|
|
|
}, |
87
|
|
|
|
|
|
|
on_symkey => { |
88
|
|
|
|
|
|
|
optional => 1, |
89
|
|
|
|
|
|
|
type => CODEREF, |
90
|
|
|
|
|
|
|
}, |
91
|
|
|
|
|
|
|
on_timer => { |
92
|
|
|
|
|
|
|
optional => 1, |
93
|
|
|
|
|
|
|
type => CODEREF, |
94
|
|
|
|
|
|
|
}, |
95
|
|
|
|
|
|
|
on_smp => { |
96
|
|
|
|
|
|
|
optional => 1, |
97
|
|
|
|
|
|
|
type => CODEREF, |
98
|
|
|
|
|
|
|
}, |
99
|
|
|
|
|
|
|
on_error => { |
100
|
|
|
|
|
|
|
optional => 1, |
101
|
|
|
|
|
|
|
type => CODEREF, |
102
|
|
|
|
|
|
|
}, |
103
|
|
|
|
|
|
|
on_event => { |
104
|
|
|
|
|
|
|
optional => 1, |
105
|
|
|
|
|
|
|
type => CODEREF, |
106
|
|
|
|
|
|
|
}, |
107
|
|
|
|
|
|
|
on_smp_event => { |
108
|
|
|
|
|
|
|
optional => 1, |
109
|
|
|
|
|
|
|
type => CODEREF, |
110
|
|
|
|
|
|
|
}, |
111
|
|
|
|
|
|
|
on_before_encrypt => { |
112
|
|
|
|
|
|
|
optional => 1, |
113
|
|
|
|
|
|
|
type => CODEREF, |
114
|
|
|
|
|
|
|
}, |
115
|
|
|
|
|
|
|
on_after_decrypt => { |
116
|
|
|
|
|
|
|
optional => 1, |
117
|
|
|
|
|
|
|
type => CODEREF, |
118
|
|
|
|
|
|
|
}, |
119
|
|
|
|
|
|
|
on_is_contact_logged_in => { |
120
|
|
|
|
|
|
|
optional => 1, |
121
|
|
|
|
|
|
|
type => CODEREF, |
122
|
|
|
|
|
|
|
}, |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
); |
125
|
|
|
|
|
|
|
|
126
|
3
|
|
|
|
|
47
|
return Protocol::OTR::Channel->_new($self, \%args); |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
1; |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
__END__ |