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