| 1 | # ABSTRACT: Off-the-Record Contact | ||||||||||
| 2 | package Protocol::OTR::Contact; | ||||||||||
| 3 | 8 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 8 | $Protocol::OTR::Contact::AUTHORITY = 'cpan:AJGB'; | |||||||||
| 5 | } | ||||||||||
| 6 | 8 | $Protocol::OTR::Contact::VERSION = '0.05'; | |||||||||
| 7 | 8 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 8 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 8 | ▶ | use Protocol::OTR (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 8 | ▶ | use Protocol::OTR::Fingerprint (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 8 | ▶ | use Protocol::OTR::Channel (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 8 | ▶ | use Params::Validate qw(validate CODEREF); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | |||||||||||
| 14 | 13 | ▶ | sub _new { | ||||||||
|
Subroutine
_new: called CC=1 SCAR=0.0
| |||||||||||
| 15 | 13 | my ($class, $act, $args) = @_; | |||||||||
| 16 | |||||||||||
| 17 | 13 | $act->_contact( @$args{qw( name fingerprint is_verified )} ); | |||||||||
| 18 | |||||||||||
| 19 | 13 | my $self = bless $args, $class; | |||||||||
| 20 | 13 | $self->{act} = $act; | |||||||||
| 21 | |||||||||||
| 22 | 13 | return $self; | |||||||||
| 23 | } | ||||||||||
| 24 | |||||||||||
| 25 | 10 | ▶ | sub account { | ||||||||
|
Subroutine
account: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 26 | 10 | return $_[0]->{act}; | |||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | 124 | ▶ | sub name { | ||||||||
|
Subroutine
name: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 30 | 124 | return $_[0]->{name}; | |||||||||
| 31 | } | ||||||||||
| 32 | |||||||||||
| 33 | 9 | ▶ | sub fingerprints { | ||||||||
|
Subroutine
fingerprints: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 34 | 9 | my ($self) = @_; | |||||||||
| 35 | |||||||||||
| 36 | return map { | ||||||||||
| 37 | 11 | Protocol::OTR::Fingerprint->_new($self, $_) | |||||||||
| 38 | 9 | } @{ $self->_fingerprints() } | |||||||||
| 39 | } | ||||||||||
| 40 | |||||||||||
| 41 | 7 | ▶ | sub active_fingerprint { | ||||||||
|
Subroutine
active_fingerprint: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 42 | 7 | my ($self) = @_; | |||||||||
| 43 | |||||||||||
| 44 | 7 | ▶ | if ( my $fprint = $self->_active_fingerprint() ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 45 | 6 | return Protocol::OTR::Fingerprint->_new($self, $fprint); | |||||||||
| 46 | }; | ||||||||||
| 47 | |||||||||||
| 48 | 1 | return; | |||||||||
| 49 | } | ||||||||||
| 50 | |||||||||||
| 51 | 5 | ▶ | sub channel { | ||||||||
|
Subroutine
channel: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 52 | 5 | my $self = shift; | |||||||||
| 53 | |||||||||||
| 54 | 5 | 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 | return Protocol::OTR::Channel->_new($self, \%args); | |||||||||
| 127 | } | ||||||||||
| 128 | |||||||||||
| 129 | 8 | 1; | |||||||||
| 130 | |||||||||||
| 131 | __END__ | ||||||||||