Webqq/Client/Method/_send_discuss_message.pm

filter: Statementstmt 26.3% 10 / 38 Branchbran 0.0% 0 / 16 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 60.0% 3 / 5 Podpod n/a totaltotal 18.0% 13 / 72 CC 12 SCAR 37.0
CC
12
Cov
16%
__ANON__
56.0
_send_discuss_message
42.0
BEGIN
1.0
CRAP 40.4
« Webqq/Client/Method/get_single_long_nick.pm ↑ Summary Webqq/Client/Plugin/PostImgVerifycode.pm »
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
BranchTrueFalseTotal
if $self->{"type"} ne "smartqq" 0 0 0
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
BranchTrueFalseTotal
$self->{'is_https'} ? : 0 0 0
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
BranchTrueFalseTotal
if $self->{"debug"} 0 0 0
14 0 my $status = $self->parse_send_status_msg( $response->content() );
15 0 ▶ if(defined $status and $status->{is_success} == 0){
Branch: 2 branches
BranchTrueFalseTotal
if (defined $status and $status->{'is_success'} == 0) { } 0 0 0
elsif (defined $status) { } 0 0 0
Condition0%0/3
defined $status and $status->{"is_success"} == 0
!ll&&!rl&&r
000
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
ABresult
0X0
100
111
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
BranchTrueFalseTotal
if (ref $msg->{"cb"} eq "CODE") 0 0 0
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
BranchTrueFalseTotal
if (ref $self->{"on_send_message"} eq "CODE") 0 0 0
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'}
l!l&&r!l&&!r
000
$self->{'qq_database'}{'user'}{'face'} || 591
l!l
00
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'}
ABresult
1X1
011
000
Truth table0%0/2
A
A= $self->{'qq_database'}{'user'}{'face'}
Aresult
11
00
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
BranchTrueFalseTotal
if ($self->{"debug"}) 0 0 0
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;
« Webqq/Client/Method/get_single_long_nick.pm ↑ Summary Webqq/Client/Plugin/PostImgVerifycode.pm »