DJabberd/ClusterMessage/DeliverStanza.pm

filter: Statementstmt 52.0% 13 / 25 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 4 / 6 Podpod 0.0% 0 / 2 totaltotal 48.5% 17 / 35 CC 3 SCAR 12.5
CC
3
Cov
48%
new
6.0
process
6.0
BEGIN
1.0
CRAP 3.5
« DJabberd/PresenceChecker/Dummy.pm ↑ Summary DJabberd/Message.pm »
1 package DJabberd::ClusterMessage::DeliverStanza;
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::ClusterMessage';
Subroutine BEGIN: called CC=1 SCAR=0.0
5 20 ▶use fields ('to', # bare JID to deliver it to
Subroutine BEGIN: called CC=1 SCAR=0.0
6 'asxml', # string representing the XML to send
7 20 );
8  
9 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod undocumented
10 0 my $self = shift; # instance or class
11 0 ▶ $self = fields::new($self) unless ref $self;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $self 0 0 0
12  
13 0 my ($jid, $stanza) = @_;
14 0 $self->{to} = $jid->as_bare_string;
15 0 $self->{asxml} = $stanza; # TODO: ->as_xml, don't take raw object. or both?
16 0 return $self;
17 }
18  
19 0 ▶sub process {
Subroutine process: not called CC=2 SCAR=17.9
Pod undocumented
20 0 my ($self, $vhost) = @_;
21 0 my @dconns = grep { $_->is_available } $vhost->find_conns_of_bare(DJabberd::JID->new($self->{to}));
22  
23 0 warn "Sending stanza to @dconns: [$self->{asxml}]\n";
24 0 foreach my $c (@dconns) {
25 0 $c->write(\ $self->{asxml});
26 }
27 }
28  
29 20 1;
« DJabberd/PresenceChecker/Dummy.pm ↑ Summary DJabberd/Message.pm »