DJabberd/Delivery/Local.pm

filter: Statementstmt 35.7% 10 / 28 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 50.0% 3 / 6 Podpod 0.0% 0 / 2 totaltotal 22.4% 13 / 58 CC 9 SCAR 37.5
CC
9
Cov
22%
deliver
72.0
__ANON__
6.0
run_before
2.0
CRAP 42.4
« DJabberd/DNS.pm ↑ Summary DJabberd/Connection/Admin.pm »
1 package DJabberd::Delivery::Local;
2 20 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 20 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 20 ▶use base 'DJabberd::Delivery';
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 0 ▶sub run_before { ("DJabberd::Delivery::S2S") }
Subroutine run_before: not called CC=1 SCAR=6.9
Pod undocumented
7  
8 0 ▶sub deliver {
Subroutine deliver: not called CC=8 SCAR=42.8
Pod undocumented
9 0 my ($self, $vhost, $cb, $stanza) = @_;
10 0 ▶ my $to = $stanza->to_jid or return $cb->declined;
Branch: 1 branch
BranchTrueFalseTotal
my $to = $stanza->to_jid or return $cb->declined 0 0 0
11  
12 0 my @dconns;
13 0 ▶ my $find_bares = sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
14 0 ▶ @dconns = grep { $_->is_available || $stanza->deliver_when_unavailable } $vhost->find_conns_of_bare($to)
Condition0%0/3
$_->is_available || $stanza->deliver_when_unavailable
l!l&&r!l&&!r
000
MC/DC0%0/2
$_->is_available || $stanza->deliver_when_unavailable
$_->is_available $stanza->deliver_when_unavailable
Truth table0%0/3
A || B
A= $_->is_availableB= $stanza->deliver_when_unavailable
ABresult
1X1
011
000
15 0 };
16  
17 0 ▶ if ($to->is_bare) {
Branch: 1 branch
BranchTrueFalseTotal
if ($to->is_bare) { } 0 0 0
18 0 $find_bares->();
19 } else {
20 0 my $dest;
21 0 ▶ if (($dest = $vhost->find_jid($to)) && ($dest->is_available || $stanza->deliver_when_unavailable)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dest = $vhost->find_jid($to) and $dest->is_available || $stanza->deliver_when_unavailable) { } 0 0 0
Condition0%0/6
$dest = $vhost->find_jid($to) and $dest->is_available || $stanza->deliver_when_unavailable
!ll&&!rl&&r
000
$dest->is_available or $stanza->deliver_when_unavailable
l!l&&r!l&&!r
000
MC/DC0%0/3
$dest = $vhost->find_jid($to) and $dest->is_available || $stanza->deliver_when_unavailable
$dest = $vhost->find_jid($to) $dest->is_available $stanza->deliver_when_unavailable
Truth table0%0/4
A and B or C
A= $dest = $vhost->find_jid($to)B= $dest->is_availableC= $stanza->deliver_when_unavailable
ABCresult
0XX0
1000
11X1
1011
22 0 push @dconns, $dest;
23 } else {
24 0 $find_bares->();
25 }
26 }
27  
28 0 ▶ return $cb->declined unless @dconns;
Branch: 1 branch
BranchTrueFalseTotal
unless @dconns 0 0 0
29  
30 0 $DJabberd::Stats::counter{deliver_local}++;
31  
32 0 foreach my $c (@dconns) {
33 0 $c->send_stanza($stanza);
34 }
35  
36 0 $cb->delivered;
37 }
38  
39 20 1;
« DJabberd/DNS.pm ↑ Summary DJabberd/Connection/Admin.pm »