line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package AnyEvent::XMPP::Error::Stream; |
2
|
1
|
|
|
1
|
|
2546
|
use AnyEvent::XMPP::Error; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
use strict; |
4
|
|
|
|
|
|
|
our @ISA = qw/AnyEvent::XMPP::Error/; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
AnyEvent::XMPP::Error::Stream - XML Stream errors |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Subclass of L |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=cut |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub init { |
15
|
|
|
|
|
|
|
my ($self) = @_; |
16
|
|
|
|
|
|
|
my $node = $self->xml_node; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my @txt = $node->find_all ([qw/streams text/]); |
19
|
|
|
|
|
|
|
my $error; |
20
|
|
|
|
|
|
|
for my $er ( |
21
|
|
|
|
|
|
|
qw/bad-format bad-namespace-prefix conflict connection-timeout host-gone |
22
|
|
|
|
|
|
|
host-unknown improper-addressing internal-server-error invalid-from |
23
|
|
|
|
|
|
|
invalid-id invalid-namespace invalid-xml not-authorized policy-violation |
24
|
|
|
|
|
|
|
remote-connection-failed resource-constraint restricted-xml |
25
|
|
|
|
|
|
|
see-other-host system-shutdown undefined-condition unsupported-stanza-type |
26
|
|
|
|
|
|
|
unsupported-version xml-not-well-formed/) |
27
|
|
|
|
|
|
|
{ |
28
|
|
|
|
|
|
|
if (my (@n) = $node->find_all ([streams => $er])) { |
29
|
|
|
|
|
|
|
$error = $n[0]->name; |
30
|
|
|
|
|
|
|
last; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
unless ($error) { |
35
|
|
|
|
|
|
|
#d# warn "got undefined error stanza, trying to find any undefined error..."; |
36
|
|
|
|
|
|
|
for my $n ($node->nodes) { |
37
|
|
|
|
|
|
|
if ($n->eq_ns ('streams')) { |
38
|
|
|
|
|
|
|
$error = $n->name; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
$self->{error_name} = $error; |
44
|
|
|
|
|
|
|
$self->{error_text} = @txt ? $txt[0]->text : ''; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 METHODS |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=over 4 |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=item B |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Returns the L object for this stream error. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=cut |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub xml_node { |
58
|
|
|
|
|
|
|
$_[0]->{node} |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=item B |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Returns the name of the error. That might be undef, one of the following |
64
|
|
|
|
|
|
|
strings or some other string that has been discovered by a heuristic |
65
|
|
|
|
|
|
|
(because some servers send errors that are not in the RFC). |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
bad-format |
68
|
|
|
|
|
|
|
bad-namespace-prefix |
69
|
|
|
|
|
|
|
conflict |
70
|
|
|
|
|
|
|
connection-timeout |
71
|
|
|
|
|
|
|
host-gone |
72
|
|
|
|
|
|
|
host-unknown |
73
|
|
|
|
|
|
|
improper-addressing |
74
|
|
|
|
|
|
|
internal-server-error |
75
|
|
|
|
|
|
|
invalid-from |
76
|
|
|
|
|
|
|
invalid-id |
77
|
|
|
|
|
|
|
invalid-namespace |
78
|
|
|
|
|
|
|
invalid-xml |
79
|
|
|
|
|
|
|
not-authorized |
80
|
|
|
|
|
|
|
policy-violation |
81
|
|
|
|
|
|
|
remote-connection-failed |
82
|
|
|
|
|
|
|
resource-constraint |
83
|
|
|
|
|
|
|
restricted-xml |
84
|
|
|
|
|
|
|
see-other-host |
85
|
|
|
|
|
|
|
system-shutdown |
86
|
|
|
|
|
|
|
undefined-condition |
87
|
|
|
|
|
|
|
unsupported-stanza-type |
88
|
|
|
|
|
|
|
unsupported-version |
89
|
|
|
|
|
|
|
xml-not-well-formed |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=cut |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub name { $_[0]->{error_name} } |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=item B |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
The humand readable error portion. Might be undef if none was received. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=cut |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub text { $_[0]->{error_text} } |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub string { |
104
|
|
|
|
|
|
|
my ($self) = @_; |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sprintf ("stream error: %s: %s", |
107
|
|
|
|
|
|
|
$self->name, |
108
|
|
|
|
|
|
|
$self->text) |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=back |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=cut |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 AUTHOR |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Robin Redeker, C<< >>, JID: C<< >> |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Copyright 2007, 2008 Robin Redeker, all rights reserved. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
125
|
|
|
|
|
|
|
under the same terms as Perl itself. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=cut |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
1; # End of AnyEvent::XMPP |