| 1 | #$Id: clicli.pm 919 2011-10-21 21:57:00Z pro $ $URL: svn://svn.setun.net/dcppp/trunk/lib/Net/DirectConnect/clicli.pm $ | ||||||||||||||||||||||||||||||||||||||||||||
| 2 | package #hide from cpan | ||||||||||||||||||||||||||||||||||||||||||||
| 3 | Net::DirectConnect::clicli; | ||||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Net::DirectConnect; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Data::Dumper; #dev only | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | $Data::Dumper::Sortkeys = 1; | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | no warnings qw(uninitialized); | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | our $VERSION = ( split( ' ', '$Revision: 919 $' ) )[1]; | |||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use base 'Net::DirectConnect'; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||
| 12 | 0 | ▶ | sub init { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: not called CC=14 SCAR=53.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 13 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||
| 14 | #$self->log($self, 'inited0',"MT:$self->{'message_type'}", ' with', Dumper \@_); | ||||||||||||||||||||||||||||||||||||||||||||
| 15 | 0 | local %_ = ( | |||||||||||||||||||||||||||||||||||||||||||
| 16 | #http://www.dcpp.net/wiki/index.php/%24Supports | ||||||||||||||||||||||||||||||||||||||||||||
| 17 | 'supports_avail' => [ qw( | ||||||||||||||||||||||||||||||||||||||||||||
| 18 | BZList | ||||||||||||||||||||||||||||||||||||||||||||
| 19 | MiniSlots | ||||||||||||||||||||||||||||||||||||||||||||
| 20 | GetZBlock | ||||||||||||||||||||||||||||||||||||||||||||
| 21 | XmlBZList | ||||||||||||||||||||||||||||||||||||||||||||
| 22 | ADCGet | ||||||||||||||||||||||||||||||||||||||||||||
| 23 | TTHL | ||||||||||||||||||||||||||||||||||||||||||||
| 24 | TTHF | ||||||||||||||||||||||||||||||||||||||||||||
| 25 | ZLIG | ||||||||||||||||||||||||||||||||||||||||||||
| 26 | ClientID | ||||||||||||||||||||||||||||||||||||||||||||
| 27 | CHUNK | ||||||||||||||||||||||||||||||||||||||||||||
| 28 | GetTestZBlock | ||||||||||||||||||||||||||||||||||||||||||||
| 29 | GetCID | ||||||||||||||||||||||||||||||||||||||||||||
| 30 | ) | ||||||||||||||||||||||||||||||||||||||||||||
| 31 | ], | ||||||||||||||||||||||||||||||||||||||||||||
| 32 | 'XmlBZList' => 1, | ||||||||||||||||||||||||||||||||||||||||||||
| 33 | 'ADCGet' => 1, | ||||||||||||||||||||||||||||||||||||||||||||
| 34 | 'MiniSlots' => 1, | ||||||||||||||||||||||||||||||||||||||||||||
| 35 | 'TTHF' => 1, | ||||||||||||||||||||||||||||||||||||||||||||
| 36 | #MiniSlots XmlBZList ADCGet TTHL TTHF | ||||||||||||||||||||||||||||||||||||||||||||
| 37 | #@_, | ||||||||||||||||||||||||||||||||||||||||||||
| 38 | 'direction' => 'Download', | ||||||||||||||||||||||||||||||||||||||||||||
| 39 | #'Direction' => 'Upload', #rand here | ||||||||||||||||||||||||||||||||||||||||||||
| 40 | 'incomingclass' => __PACKAGE__, 'reconnects' => 0, inactive_timeout => 60, | ||||||||||||||||||||||||||||||||||||||||||||
| 41 | #charset_protocol => 'cp1251', #'utf8' | ||||||||||||||||||||||||||||||||||||||||||||
| 42 | ); | ||||||||||||||||||||||||||||||||||||||||||||
| 43 | #$self->{$_} ||= $_{$_} for keys %_; | ||||||||||||||||||||||||||||||||||||||||||||
| 44 | #!exists $self->{$_} ? $self->{$_} ||= $_{$_} : () for keys %_; | ||||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | ▶ | $self->{$_} //= $_{$_} for keys %_; | ||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{$_} //= $_{$_}
MC/DC0%0/2
$self->{$_} //= $_{$_}
$self->{$_}
$_{$_}
Truth table0%0/3
A //= B
A= $self->{$_}B= $_{$_}
| |||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | $self->{'modules'}{'nmdc'} = 1; | |||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | $self->{'auto_connect'} = 1 if !$self->{'incoming'} and !defined $self->{'auto_connect'}; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"incoming"} or defined $self->{"auto_connect"}
MC/DC0%0/2
$self->{"incoming"} or defined $self->{"auto_connect"}
$self->{"incoming"}
defined $self->{"auto_connect"}
Truth table0%0/3
A or B
A= $self->{"incoming"}B= defined $self->{"auto_connect"}
| |||||||||||||||||||||||||||||||||||||||||||||
| 48 | #$self->log($self, 'inited1',"MT:$self->{'message_type'}", ' with', Dumper \@_); | ||||||||||||||||||||||||||||||||||||||||||||
| 49 | #$self->log('dev', 'chPROTOcc:',$self->{'charset_protocol'}); | ||||||||||||||||||||||||||||||||||||||||||||
| 50 | #$self->baseinit(); | ||||||||||||||||||||||||||||||||||||||||||||
| 51 | #$self->log($self, 'inited2',"MT:$self->{'message_type'}", ' with', Dumper \@_); | ||||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | $self->get_peer_addr(); | |||||||||||||||||||||||||||||||||||||||||||
| 53 | #$self->log('info', "[$self->{'number'}] Incoming client $self->{'peerip'}") if $self->{'peerip'}; | ||||||||||||||||||||||||||||||||||||||||||||
| 54 | #$self->{'share_tth'} ||=$self->{'parent'}{'share_tth'}; | ||||||||||||||||||||||||||||||||||||||||||||
| 55 | #$self->{'share_full'} ||=$self->{'parent'}{'share_tth'}; | ||||||||||||||||||||||||||||||||||||||||||||
| 56 | #share_full share_tth want | ||||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | ▶ | $self->{$_} ||= $self->{'parent'}{$_} ||= {} for qw( NickList IpList PortList PortList_udp); #handler | ||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$self->{$_} ||= ($self->{"parent"}{$_} ||= {})
$self->{"parent"}{$_} ||= {}
MC/DC0%0/2
$self->{$_} ||= ($self->{"parent"}{$_} ||= {})
$self->{$_}
($self->{"parent"}{$_} ||= {})
MC/DC0%0/1
$self->{"parent"}{$_} ||= {}
$self->{"parent"}{$_}
Truth table0%0/3
A ||= B
A= $self->{$_}B= ($self->{"parent"}{$_} ||= {})
Truth table0%0/2
A
A= $self->{"parent"}{$_}
| |||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | ▶ | $self->{$_} ||= $self->{'parent'}{$_} for qw( Nick ); | ||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{$_} ||= $self->{"parent"}{$_}
MC/DC0%0/2
$self->{$_} ||= $self->{"parent"}{$_}
$self->{$_}
$self->{"parent"}{$_}
Truth table0%0/3
A ||= B
A= $self->{$_}B= $self->{"parent"}{$_}
| |||||||||||||||||||||||||||||||||||||||||||||
| 59 | #$self->{'NickList'} ||= {}; | ||||||||||||||||||||||||||||||||||||||||||||
| 60 | #$self->{'IpList'} ||= {}; | ||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | $self->module_load('filelist'); | |||||||||||||||||||||||||||||||||||||||||||
| 62 | #$self->{'PortList'} ||= {}; | ||||||||||||||||||||||||||||||||||||||||||||
| 63 | #$self->log( 'info', "Incoming client $self->{'host'}:$self->{'port'} via ", ref $self ) if $self->{'incoming'}; | ||||||||||||||||||||||||||||||||||||||||||||
| 64 | #$self->{'parse'} = undef if $self->{'parse'} and !keys %{ $self->{'parse'} }; | ||||||||||||||||||||||||||||||||||||||||||||
| 65 | #$self->{'parse'} ||= { | ||||||||||||||||||||||||||||||||||||||||||||
| 66 | local %_ = ( | ||||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | ▶ | 'Lock' => sub { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | ▶ | my $self = shift if ref $_[0]; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 69 | #$self->log('dev', 'LOCK:incoming', $self->{'incoming'}); | ||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | if ( $self->{'incoming'} ) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | $self->{'sendbuf'} = 1; | |||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | $self->cmd('MyNick'); | |||||||||||||||||||||||||||||||||||||||||||
| 73 | #$self->{'sendbuf'} = 0; | ||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | $self->cmd('Lock'); | |||||||||||||||||||||||||||||||||||||||||||
| 75 | #$self->{'sendbuf'} = 1; | ||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | $self->cmd('Supports'); | |||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | $self->cmd('Direction'); | |||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | $self->{'sendbuf'} = 0; | |||||||||||||||||||||||||||||||||||||||||||
| 79 | #} | ||||||||||||||||||||||||||||||||||||||||||||
| 80 | #my ($lock) = $_[0] =~ /^(.+?)(\s+Pk=.+)?\s*$/is; | ||||||||||||||||||||||||||||||||||||||||||||
| 81 | #$_[0] =~ /^(.+?)(\s+Pk=.+)?\s*$/is; | ||||||||||||||||||||||||||||||||||||||||||||
| 82 | #$self->cmd( 'Key', $self->lock2key($lock) ); | ||||||||||||||||||||||||||||||||||||||||||||
| 83 | } else { | ||||||||||||||||||||||||||||||||||||||||||||
| 84 | #$_[0] =~ /^(.+?)(\s+Pk=.+)?\s*$/is; | ||||||||||||||||||||||||||||||||||||||||||||
| 85 | #$self->{'key'} = $self->lock2key($1); | ||||||||||||||||||||||||||||||||||||||||||||
| 86 | #$self->log ( 'dev','lock2key', "[$1]=[$self->{'key'}]"); | ||||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 88 | #my ($lock) | ||||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | ( $self->{'key'} ) = $_[0] =~ /^(.+?)(\s+Pk=.+)?\s*$/is; | |||||||||||||||||||||||||||||||||||||||||||
| 90 | #$_[0] =~ /^(.+?)(\s+Pk=.+)?\s*$/is; | ||||||||||||||||||||||||||||||||||||||||||||
| 91 | #$self->log('dev', 'keycmd', $self->{'key'},$self->{'incoming'}); | ||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | ▶ | $self->cmd( 'Key', $self->{'key'} ) if ( $self->{'incoming'} ); | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 93 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | 'Direction' => sub { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | ▶ | my $self = shift if ref $_[0]; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | my $d = ( split /\s/, $_[0] )[0]; | |||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | ▶ | if ( $d eq 'Download' ) { $self->{'direction'} = 'Upload'; } | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 98 | else { | ||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | $self->{'direction'} = 'Download'; | |||||||||||||||||||||||||||||||||||||||||||
| 100 | #$self->log ( 'dev', "direction UNKNOWN [$d]", $self->{'direction'}, 'from', @_, ';'); | ||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 102 | #$self->log ( 'dev', "direction RECIEVED", $self->{'direction'}, 'from', @_, ';'); | ||||||||||||||||||||||||||||||||||||||||||||
| 103 | #2009/11/04-02:08:20 dev [2] direction RECIEVED Download from Download 28048 ; | ||||||||||||||||||||||||||||||||||||||||||||
| 104 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | ▶ | 'Key' => sub { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=9 SCAR=45.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | ▶ | my $self = shift if ref $_[0]; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | ▶ | if ( $self->{'incoming'} ) { } | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 108 | else { | ||||||||||||||||||||||||||||||||||||||||||||
| 109 | #$self->log('dev', 'outk',); | ||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | $self->{'sendbuf'} = 1; | |||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | $self->cmd('Supports'); | |||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | $self->cmd('Direction'); | |||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | $self->{'sendbuf'} = 0; | |||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | $self->cmd( 'Key', $self->{'key'} ); | |||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 116 | $self->file_select(), $self->log( "get:[filename:", $self->{'filename'}, '; fileas:', $self->{'fileas'}, "]" ) | ||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | ▶ | if $self->{'direction'} eq 'Download'; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 118 | $self->{'get'} = $self->{'filename'} . '$' . ( $self->{'file_recv_from'} || 1 ), | ||||||||||||||||||||||||||||||||||||||||||||
| 119 | $self->{'adcget'} = | ||||||||||||||||||||||||||||||||||||||||||||
| 120 | 'file ' . $self->{'filename'} . ' ' . ( $self->{'file_recv_from'} || 0 ) . ' ' . ( $self->{'file_recv_to'} || '-1' ), | ||||||||||||||||||||||||||||||||||||||||||||
| 121 | $self->cmd( ( $self->{'NickList'}->{ $self->{'peernick'} }{'ADCGet'} ? 'ADCGET' : 'Get' ) ) | ||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | ▶ | if $self->{'filename'}; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/6
$self->{'file_recv_from'} || 1
$self->{'file_recv_from'} || 0
$self->{'file_recv_to'} || '-1'
MC/DC0%0/1
$self->{'file_recv_from'} || 1
$self->{'file_recv_from'}
MC/DC0%0/1
$self->{'file_recv_from'} || 0
$self->{'file_recv_from'}
MC/DC0%0/1
$self->{'file_recv_to'} || '-1'
$self->{'file_recv_to'}
Truth table0%0/2
A
A= $self->{'file_recv_from'}
Truth table0%0/2
A
A= $self->{'file_recv_from'}
Truth table0%0/2
A
A= $self->{'file_recv_to'}
| |||||||||||||||||||||||||||||||||||||||||||||
| 123 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | 'Get' => sub { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | ▶ | my $self = shift if ref $_[0]; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 126 | #TODO | ||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | $self->cmd( 'FileLength', 0 ); | |||||||||||||||||||||||||||||||||||||||||||
| 128 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | ▶ | 'MyNick' => sub { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | ▶ | my $self = shift if ref $_[0]; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | $self->log( 'info', "peer is [", ( $self->{'peernick'} = $_[0] ), "]" ); | |||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | $self->{'NickList'}->{ $self->{'peernick'} }{'ip'} = $self->{'host'}; | |||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | $self->{'NickList'}->{ $self->{'peernick'} }{'port'} = $self->{'port'}; | |||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | $self->{'IpList'}->{ $self->{'host'} } = \%{ $self->{'NickList'}->{ $self->{'peernick'} } }; | |||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | $self->{'IpList'}->{ $self->{'host'} }->{'port'} = $self->{'PortList'}->{ $self->{'host'} }; | |||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | $self->handler( 'user_ip', $self->{'peernick'}, $self->{'host'}, $self->{'port'} ); | |||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | ▶ | if ( keys %{ $self->{'want'}->{ $self->{'peernick'} } } ) { $self->{'direction'} = 'Download'; } | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | else { $self->{'direction'} = 'Upload'; } | |||||||||||||||||||||||||||||||||||||||||||
| 139 | #$self->log ( 'dev', "direction", $self->{'direction'}, 'from', keys %{ $self->{'want'}->{ $self->{'peernick'} } }, ';'); | ||||||||||||||||||||||||||||||||||||||||||||
| 140 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | ▶ | 'FileLength' => sub { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | my $self = shift if ref $_[0]; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | $self->{'filetotal'} = $_[0]; | |||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | ▶ | return if $self->file_open(); | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | $self->cmd('Send'); | |||||||||||||||||||||||||||||||||||||||||||
| 146 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | ▶ | 'ADCSND' => sub { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | my $self = shift if ref $_[0]; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 149 | #$self->log( 'dev', "ADCSND::", @_ ); | ||||||||||||||||||||||||||||||||||||||||||||
| 150 | #$_[0] =~ /(\d+?)$/is; | ||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | local @_ = split /\s+/, $_[0]; | |||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | $self->{'filetotal'} = $_[2] + $_[3]; | |||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | return $self->file_open(); | |||||||||||||||||||||||||||||||||||||||||||
| 154 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | 'CSND' => sub { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | ▶ | my $self = shift if ref $_[0]; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | $_[0] =~ /^file\s+\S+\s+(\d+)\s(\d+)$/is; | |||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | $self->{'filetotal'} = $1 + $2; | |||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | return $self->file_open(); | |||||||||||||||||||||||||||||||||||||||||||
| 160 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | 'Supports' => sub { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | ▶ | my $self = shift if ref $_[0]; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | $self->supports_parse( $_[0], $self->{'NickList'}->{ $self->{'peernick'} } ); | |||||||||||||||||||||||||||||||||||||||||||
| 164 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | ▶ | 'MaxedOut' => sub { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | ▶ | my $self = shift if ref $_[0]; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | $self->disconnect(); | |||||||||||||||||||||||||||||||||||||||||||
| 168 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | ▶ | 'ADCGET' => sub { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | ▶ | my $self = shift if ref $_[0]; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 171 | #$self->log('dev', 'ADCGET', @_); | ||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | ▶ | $self->cmd( 'Error', "File Not Available" ) if $self->file_send_parse( map { split /\s/, $_ } @_ ); | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 173 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 174 | #}; | ||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | ▶ | $self->{'parse'}{$_} ||= $_{$_} for keys %_; | ||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{"parse"}{$_} ||= $_{$_}
MC/DC0%0/2
$self->{"parse"}{$_} ||= $_{$_}
$self->{"parse"}{$_}
$_{$_}
Truth table0%0/3
A ||= B
A= $self->{"parse"}{$_}B= $_{$_}
| |||||||||||||||||||||||||||||||||||||||||||||
| 177 | #$self->log ( 'dev', "del empty cmd", ), | ||||||||||||||||||||||||||||||||||||||||||||
| 178 | #$self->{'cmd'} = undef if $self->{'cmd'} and !keys %{ $self->{'cmd'} }; | ||||||||||||||||||||||||||||||||||||||||||||
| 179 | #$self->log('PRECMD',Dumper $self->{'cmd'}); | ||||||||||||||||||||||||||||||||||||||||||||
| 180 | #$self->{'cmd'} ||= { | ||||||||||||||||||||||||||||||||||||||||||||
| 181 | local %_ = ( | ||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | ▶ | 'connect_aft' => sub { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | ▶ | my $self = shift if ref $_[0]; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 184 | #my $self = shift if ref $_[0]; | ||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | $self->{'sendbuf'} = 1; | |||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | $self->cmd('MyNick'); | |||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | $self->{'sendbuf'} = 0; | |||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | $self->cmd('Lock'); | |||||||||||||||||||||||||||||||||||||||||||
| 189 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | ▶ | 'MyNick' => sub { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | my $self = shift if ref $_[0]; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 192 | $self->sendcmd( | ||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | 'MyNick', $self->{'Nick'} #|| $self->{'parent'}{'Nick'} | |||||||||||||||||||||||||||||||||||||||||||
| 194 | ); | ||||||||||||||||||||||||||||||||||||||||||||
| 195 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | ▶ | 'Lock' => sub { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | ▶ | my $self = shift if ref $_[0]; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 198 | #$self->log('dev', 'cmdLOCK', $_[0],$self->{'lock'}); | ||||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | ▶ | $self->sendcmd( 'Lock', $_[0] || $self->{'lock'} ); | ||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$_[0] || $self->{'lock'}
MC/DC0%0/2
$_[0] || $self->{'lock'}
$_[0]
$self->{'lock'}
Truth table0%0/3
A || B
A= $_[0]B= $self->{'lock'}
| |||||||||||||||||||||||||||||||||||||||||||||
| 200 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | ▶ | 'Supports' => sub { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | ▶ | my $self = shift if ref $_[0]; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | ▶ | $self->sendcmd( 'Supports', $self->supports() || 'MiniSlots XmlBZList ADCGet TTHF' ); #TTHL | ||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->supports || 'MiniSlots XmlBZList ADCGet TTHF'
MC/DC0%0/1
$self->supports || 'MiniSlots XmlBZList ADCGet TTHF'
$self->supports
Truth table0%0/2
A
A= $self->supports
| |||||||||||||||||||||||||||||||||||||||||||||
| 204 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | ▶ | 'Direction' => sub { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | ▶ | my $self = shift if ref $_[0]; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | $self->sendcmd( 'Direction', $self->{'direction'}, int( rand(0x7FFF) ) ); | |||||||||||||||||||||||||||||||||||||||||||
| 208 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | ▶ | 'Key' => sub { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | ▶ | my $self = shift if ref $_[0]; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 211 | #$self->log('dev', 'cmdKEY', $_[0],$self->{'incoming'}); | ||||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | $self->sendcmd( 'Key', $_[0] ); | |||||||||||||||||||||||||||||||||||||||||||
| 213 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | ▶ | 'Get' => sub { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | ▶ | my $self = shift if ref $_[0]; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | $self->sendcmd( 'Get', $self->{'get'} ); | |||||||||||||||||||||||||||||||||||||||||||
| 217 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | ▶ | 'Send' => sub { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | ▶ | my $self = shift if ref $_[0]; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | $self->sendcmd('Send'); | |||||||||||||||||||||||||||||||||||||||||||
| 221 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | ▶ | 'FileLength' => sub { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | ▶ | my $self = shift if ref $_[0]; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | $self->sendcmd( 'FileLength', $_[0] ); | |||||||||||||||||||||||||||||||||||||||||||
| 225 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | ▶ | 'ADCGET' => sub { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | ▶ | my $self = shift if ref $_[0]; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 228 | #$ADCGET file TTH/I2VAVWYGSVTBHSKN3BOA6EWTXSP4GAKJMRK2DJQ 730020132 2586332 | ||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | $self->sendcmd( 'ADCGET', $self->{'adcget'} ); | |||||||||||||||||||||||||||||||||||||||||||
| 230 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | ▶ | 'ADCSND' => sub { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | ▶ | my $self = shift if ref $_[0]; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | $self->sendcmd( 'ADCSND', @_ ); | |||||||||||||||||||||||||||||||||||||||||||
| 234 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | ▶ | 'Error' => sub { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | ▶ | my $self = shift if ref $_[0]; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | $self->sendcmd( 'Error', $_[0] ); | |||||||||||||||||||||||||||||||||||||||||||
| 238 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | ▶ | $self->{'cmd'}{$_} ||= $_{$_} for keys %_; | ||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{"cmd"}{$_} ||= $_{$_}
MC/DC0%0/2
$self->{"cmd"}{$_} ||= $_{$_}
$self->{"cmd"}{$_}
$_{$_}
Truth table0%0/3
A ||= B
A= $self->{"cmd"}{$_}B= $_{$_}
| |||||||||||||||||||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 242 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||