File Coverage

blib/lib/Protocol/XMPP/Element/Features.pm
Criterion Covered Total %
statement 9 28 32.1
branch 0 4 0.0
condition n/a
subroutine 3 7 42.8
pod 1 2 50.0
total 13 41 31.7


line stmt bran cond sub pod time code
1             package Protocol::XMPP::Element::Features;
2              
3 1     1   194696 use strict;
  1         2  
  1         45  
4 1     1   6 use warnings;
  1         2  
  1         129  
5 1     1   8 use parent qw(Protocol::XMPP::ElementBase);
  1         3  
  1         15  
6              
7             our $VERSION = '0.007'; ## VERSION
8              
9             =head1 NAME
10              
11             Protocol::XMPP::Features - broker for setting up internal state and triggering reponses based on supported features
12              
13             =head1 SYNOPSIS
14              
15             =head1 DESCRIPTION
16              
17             =head1 METHODS
18              
19             =cut
20              
21             =head1 C
22              
23             =cut
24              
25             sub end_element {
26 0     0 1   my $self = shift;
27 0           $self->debug("End of the feature list");
28 0           $self->stream->{features} = $self; # strong ref, parent will remove when no longer needed
29 0           $self->stream->dispatch_event('features');
30 0 0         return if $self->stream->{tls_pending};
31              
32             $self->{waiting_futures} = Future->wait_all(
33 0           @{$self->{pending_futures}}
34             )->on_ready(sub {
35 0     0     delete $self->{waiting_futures};
36 0           $self->stream->features_complete->done;
37 0 0         return $self->stream->dispatch_event('login') if $self->is_authorised;
38 0           $self->stream->dispatch_event('login_ready');
39 0           });
40             }
41              
42             sub push_pending {
43 0     0 0   my $self = shift;
44 0           push @{$self->{pending_futures}}, @_;
  0            
45 0           $self
46             }
47              
48             =head1 C<_sasl_mechanism_list>
49              
50             Return a list of SASL mechanisms as a space-separated string.
51              
52             =cut
53              
54             sub _sasl_mechanism_list {
55 0     0     my $self = shift;
56 0           return join(' ', map { $_->type } @{$self->{mechanism}})
  0            
  0            
57             }
58              
59             1;
60              
61             __END__