Webqq/Client/Method/_send_sess_message.pm

filter: Statementstmt 19.4% 7 / 36 Branchbran 0.0% 0 / 20 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 50.0% 2 / 4 Podpod n/a totaltotal 13.2% 9 / 68 CC 13 SCAR 38.9
CC
13
Cov
11%
_send_sess_message
56.0
__ANON__
56.0
BEGIN
1.0
CRAP 49.1
« Webqq/Client/Plugin/SendMsgControl.pm ↑ Summary Webqq/Client/Method/_send_group_message.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 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
BranchTrueFalseTotal
unless defined $msg->{"group_sig"} 0 0 0
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
BranchTrueFalseTotal
if $self->{"debug"} 0 0 0
10 0 my $status = $self->parse_send_status_msg( $response->content() );
11 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
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
BranchTrueFalseTotal
if (ref $msg->{"cb"} eq "CODE") 0 0 0
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
BranchTrueFalseTotal
if (ref $self->{"on_send_message"} eq "CODE") 0 0 0
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
BranchTrueFalseTotal
$self->{'is_https'} ? : 0 0 0
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
BranchTrueFalseTotal
$self->{'type'} eq 'webqq' ? : 0 0 0
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
l!l
00
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'}
Aresult
11
00
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
BranchTrueFalseTotal
if ($self->{"type"} eq "webqq") 0 0 0
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
BranchTrueFalseTotal
if ($self->{"debug"}) 0 0 0
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;
« Webqq/Client/Plugin/SendMsgControl.pm ↑ Summary Webqq/Client/Method/_send_group_message.pm »