| 1 | 1 | ▶ | use JSON; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use Encode; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 3 | 0 | ▶ | sub Webqq::Client::_send_sess_message{ | ||||||||||||||||||||||||||||||
|
Subroutine
_send_sess_message: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||
| 4 | 0 | my($self,$msg) = @_; | |||||||||||||||||||||||||||||||
| 5 | 0 | ▶ | return unless defined $msg->{group_sig}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 6 | 0 | my $ua = $self->{asyn_ua}; | |||||||||||||||||||||||||||||||
| 7 | 0 | ▶ | my $callback = sub{ | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||
| 8 | 0 | my $response = shift; | |||||||||||||||||||||||||||||||
| 9 | 0 | ▶ | print $response->content() if $self->{debug}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 10 | 0 | my $status = $self->parse_send_status_msg( $response->content() ); | |||||||||||||||||||||||||||||||
| 11 | 0 | ▶ | if(defined $status and $status->{is_success}==0){ | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
defined $status and $status->{"is_success"} == 0
MC/DC0%0/2
defined $status and $status->{"is_success"} == 0
defined $status
$status->{"is_success"} == 0
Truth table0%0/3
A and B
A= defined $statusB= $status->{"is_success"} == 0
| |||||||||||||||||||||||||||||||||
| 12 | 0 | $self->send_sess_message($msg); | |||||||||||||||||||||||||||||||
| 13 | 0 | return; | |||||||||||||||||||||||||||||||
| 14 | } | ||||||||||||||||||||||||||||||||
| 15 | elsif(defined $status){ | ||||||||||||||||||||||||||||||||
| 16 | 0 | ▶ | if(ref $msg->{cb} eq 'CODE'){ | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 17 | $msg->{cb}->( | ||||||||||||||||||||||||||||||||
| 18 | $msg, #msg | ||||||||||||||||||||||||||||||||
| 19 | $status->{is_success}, #is_success | ||||||||||||||||||||||||||||||||
| 20 | $status->{status} #status | ||||||||||||||||||||||||||||||||
| 21 | 0 | ); | |||||||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||||||
| 23 | 0 | ▶ | if(ref $self->{on_send_message} eq 'CODE'){ | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 24 | $self->{on_send_message}->( | ||||||||||||||||||||||||||||||||
| 25 | $msg, #msg | ||||||||||||||||||||||||||||||||
| 26 | $status->{is_success}, #is_success | ||||||||||||||||||||||||||||||||
| 27 | $status->{status} #status | ||||||||||||||||||||||||||||||||
| 28 | 0 | ); | |||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||
| 31 | 0 | }; | |||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | my $api_url = ($self->{is_https}?'https':'http') . '://d.web2.qq.com/channel/send_sess_msg2'; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | my @headers = $self->{type} eq 'webqq'? (Referer => 'http://d.web2.qq.com/proxy.html?v=20110331002&callback=1&id=3') | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 35 | : (Referer => 'http://d.web2.qq.com/proxy.html?v=20130916001&callback=1&id=2') | ||||||||||||||||||||||||||||||||
| 36 | ; | ||||||||||||||||||||||||||||||||
| 37 | 0 | my $content = [decode("utf8",$msg->{content}),[]]; | |||||||||||||||||||||||||||||||
| 38 | my %s = ( | ||||||||||||||||||||||||||||||||
| 39 | to => $msg->{to_uin}, | ||||||||||||||||||||||||||||||||
| 40 | group_sig => $msg->{group_sig}, | ||||||||||||||||||||||||||||||||
| 41 | face => $self->{qq_database}{user}{face} || 591, | ||||||||||||||||||||||||||||||||
| 42 | content => JSON->new->utf8->encode($content), | ||||||||||||||||||||||||||||||||
| 43 | msg_id => $msg->{msg_id}, | ||||||||||||||||||||||||||||||||
| 44 | service_type => $msg->{service_type}, | ||||||||||||||||||||||||||||||||
| 45 | clientid => $self->{qq_param}{clientid}, | ||||||||||||||||||||||||||||||||
| 46 | psessionid => $self->{qq_param}{psessionid}, | ||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | ); | ||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{'qq_database'}{'user'}{'face'} || 591
MC/DC0%0/1
$self->{'qq_database'}{'user'}{'face'} || 591
$self->{'qq_database'}{'user'}{'face'}
Truth table0%0/2
A
A= $self->{'qq_database'}{'user'}{'face'}
| |||||||||||||||||||||||||||||||||
| 48 | 0 | $s{content} = decode("utf8",$s{content}); | |||||||||||||||||||||||||||||||
| 49 | 0 | my $post_content = [ | |||||||||||||||||||||||||||||||
| 50 | r => JSON->new->utf8->encode(\%s), | ||||||||||||||||||||||||||||||||
| 51 | ]; | ||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||
| 53 | 0 | ▶ | if($self->{type} eq 'webqq'){ | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 54 | push @$post_content,( | ||||||||||||||||||||||||||||||||
| 55 | clientid => $self->{qq_param}{clientid}, | ||||||||||||||||||||||||||||||||
| 56 | psessionid => $self->{qq_param}{psessionid}, | ||||||||||||||||||||||||||||||||
| 57 | 0 | ); | |||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | if($self->{debug}){ | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 61 | 0 | require URI; | |||||||||||||||||||||||||||||||
| 62 | 0 | my $uri = URI->new('http:'); | |||||||||||||||||||||||||||||||
| 63 | 0 | $uri->query_form($post_content); | |||||||||||||||||||||||||||||||
| 64 | 0 | print $api_url,"\n"; | |||||||||||||||||||||||||||||||
| 65 | 0 | print $uri->query(),"\n"; | |||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||
| 68 | $ua->post( | ||||||||||||||||||||||||||||||||
| 69 | 0 | $api_url, | |||||||||||||||||||||||||||||||
| 70 | $post_content, | ||||||||||||||||||||||||||||||||
| 71 | @headers, | ||||||||||||||||||||||||||||||||
| 72 | $callback, | ||||||||||||||||||||||||||||||||
| 73 | ); | ||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||
| 75 | 1 | 1; | |||||||||||||||||||||||||||||||