XMPP/Ext/MUC/RoomInfo.pm untested

filter: Statementstmt 0.0% 0 / 35 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 56 CC 4 SCAR 18.3
CC
4
Cov
0%
as_debug_string
12.0
init
6.0
new
2.0
CRAP 6.2
1 package AnyEvent::XMPP::Ext::MUC::RoomInfo;
2 use strict;
3 use AnyEvent::XMPP::Namespaces qw/xmpp_ns/;
4  
5 =head1 NAME
6  
7 AnyEvent::XMPP::Ext::MUC::RoomInfo - Room information
8  
9 =head1 SYNOPSIS
10  
11 =head1 DESCRIPTION
12  
13 This module represents the room information for a MUC.
14  
15 =head1 METHODS
16  
17 =over 4
18  
19 =item B<new (%args)>
20  
21 =cut
22  
23 sub new {
24 my $this = shift;
25 my $class = ref($this) || $this;
26 my $self = bless { @_ }, $class;
27 $self->init;
28 $self
29 }
30  
31 sub init {
32 my ($self) = @_;
33 my $info = $self->{disco_info};
34 my $df;
35 if (my ($xdata) = $info->xml_node ()->find_all ([qw/data_form x/])) {
36 $df = AnyEvent::XMPP::Ext::DataForm->new;
37 $df->from_node ($xdata);
38 }
39 $self->{form} = $df;
40 }
41  
42 =item B<disco_info>
43  
44 This method returns the info discovery object L<AnyEvent::XMPP::Ext::Disco::Info>
45 for the disco query that this roominfo was obtained from.
46  
47 =cut
48  
49 sub disco_info {
50 $_[0]->{disco_info}
51 }
52  
53 =item B<as_debug_string>
54  
55 Returns the MUC room information as string for debugging.
56  
57 =cut
58  
59 sub as_debug_string {
60 my ($self) = @_;
61 my $info = $self->{disco_info};
62 my @feats = keys %{$info->features};
63 my $str = "MUC features for " . $info->jid . "\n";
64 for (@feats) {
65 if (/^muc_/) {
66 $str .= "- $_\n";
67 }
68 }
69 if (defined $self->{form}) {
70 $str .= "form:\n";
71 $str .= $self->{form}->as_debug_string;
72 }
73 $str
74 }
75  
76 =back
77  
78 =head1 AUTHOR
79  
80 Robin Redeker, C<< <elmex at ta-sa.org> >>, JID: C<< <elmex at jabber.org> >>
81  
82 =head1 COPYRIGHT & LICENSE
83  
84 Copyright 2007, 2008 Robin Redeker, all rights reserved.
85  
86 This program is free software; you can redistribute it and/or modify it
87 under the same terms as Perl itself.
88  
89 =cut
90  
91 1;