line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package AnyEvent::XMPP::Ext::Disco::Items; |
2
|
1
|
|
|
1
|
|
1397
|
use AnyEvent::XMPP::Namespaces qw/xmpp_ns/; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
59
|
|
3
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
434
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
AnyEvent::XMPP::Ext::Disco::Items - Service discovery items |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 SYNOPSIS |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 DESCRIPTION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
This class represents the result of a disco items request |
14
|
|
|
|
|
|
|
sent by a C handler. |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 METHODS |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=over 4 |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub new { |
23
|
0
|
|
|
0
|
0
|
|
my $this = shift; |
24
|
0
|
|
0
|
|
|
|
my $class = ref($this) || $this; |
25
|
0
|
|
|
|
|
|
my $self = bless { @_ }, $class; |
26
|
0
|
|
|
|
|
|
$self->init; |
27
|
0
|
|
|
|
|
|
$self |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=item B |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Returns the L object of the IQ query. |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=cut |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub xml_node { |
37
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
38
|
0
|
|
|
|
|
|
$self->{xmlnode} |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub init { |
42
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
43
|
0
|
|
|
|
|
|
my $node = $self->{xmlnode}; |
44
|
0
|
0
|
|
|
|
|
return unless $node; |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
my (@items) = $node->find_all ([qw/disco_items item/]); |
47
|
0
|
|
|
|
|
|
for (@items) { |
48
|
0
|
|
|
|
|
|
push @{$self->{items}}, { |
|
0
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
jid => $_->attr ('jid'), |
50
|
|
|
|
|
|
|
name => $_->attr ('name'), |
51
|
|
|
|
|
|
|
node => $_->attr ('node'), |
52
|
|
|
|
|
|
|
xml_node => $_, |
53
|
|
|
|
|
|
|
}; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=item B |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Returns the JID these items belong to. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=cut |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
0
|
1
|
|
sub jid { $_[0]->{jid} } |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=item B |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Returns the node these items belong to (may be undef). |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=cut |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
0
|
1
|
|
sub node { $_[0]->{node} } |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=item B |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Returns a list of hashreferences which contain following keys: |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
jid, name, node and xml_node |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
C contains the JID of the item. |
80
|
|
|
|
|
|
|
C contains the name of the item and might be undef. |
81
|
|
|
|
|
|
|
C contains the node id of the item and might be undef. |
82
|
|
|
|
|
|
|
C contains the L object of the item |
83
|
|
|
|
|
|
|
for further analyses. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=cut |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub items { |
88
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
89
|
0
|
|
|
|
|
|
@{$self->{items}} |
|
0
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=item B |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Prints these items to stdout for debugging. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=cut |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub debug_dump { |
99
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
100
|
0
|
|
|
|
|
|
printf "ITEMS FOR %s (%s):\n", $self->jid, $self->node; |
101
|
0
|
|
|
|
|
|
for ($self->items) { |
102
|
0
|
|
|
|
|
|
printf " - %-40s (%30s): %s\n", $_->{jid}, $_->{node}, $_->{name} |
103
|
|
|
|
|
|
|
} |
104
|
0
|
|
|
|
|
|
print "END ITEMS\n"; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=back |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 AUTHOR |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Robin Redeker, C<< >>, JID: C<< >> |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Copyright 2007, 2008 Robin Redeker, all rights reserved. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
118
|
|
|
|
|
|
|
under the same terms as Perl itself. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=cut |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
1; |