1package Protocol::XMPP::Element::Features; 2$Protocol::XMPP::Element::Features::VERSION = '0.006'; 3use strict; 4use warnings; 5use parent qw(Protocol::XMPP::ElementBase); 6 7=head1 NAME 8 9Protocol::XMPP::Features - broker for setting up internal state and triggering reponses based on supported features 10 11=head1 VERSION 12 13Version 0.006 14 15=head1 SYNOPSIS 16 17=head1 DESCRIPTION 18 19=head1 METHODS 20 21=cut 22 23=head1 C<end_element> 24 25=cut 26 27sub end_element { 28 my $self = shift; 29 $self->debug("End of the feature list"); 30 $self->stream->{features} = $self; # strong ref, parent will remove when no longer needed 31 $self->stream->dispatch_event('features'); 32 return if $self->stream->{tls_pending}; 33 34 $self->{waiting_futures} = Future->wait_all( 35 @{$self->{pending_futures}} 36 )->on_ready(sub { 37 delete $self->{waiting_futures}; 38 $self->stream->features_complete->done; 39 return $self->stream->dispatch_event('login') if $self->is_authorised; 40 $self->stream->dispatch_event('login_ready'); 41 }); 42} 43 44sub push_pending { 45 my $self = shift; 46 push @{$self->{pending_futures}}, @_; 47 $self 48} 49 50=head1 C<_sasl_mechanism_list> 51 52Return a list of SASL mechanisms as a space-separated string. 53 54=cut 55 56sub _sasl_mechanism_list { 57 my $self = shift; 58 return join(' ', map { $_->type } @{$self->{mechanism}}) 59} 60 611; 62 63__END__ 64 65=head1 AUTHOR 66 67Tom Molesworth <cpan@entitymodel.com> 68 69=head1 LICENSE 70 71Copyright Tom Molesworth 2010-2014. Licensed under the same terms as Perl itself. 72