Permalink
Browse files

Force a string when getting the element for unsupported stanza errors

$node->element returns (NS, tag) in array context, but we want the
string representation.

Additionally, include the element in question for _client_ unsupported
stanza error messages.
  • Loading branch information...
1 parent 68d1b03 commit 1e309a6b523804e661c3eabce85d16454a85f1f0 @tsibley tsibley committed Sep 23, 2010
Showing with 3 additions and 3 deletions.
  1. +1 −1 lib/DJabberd/Connection/ClientIn.pm
  2. +1 −1 lib/DJabberd/Connection/ServerIn.pm
  3. +1 −1 t/handle-stanza-hook.t
View
2 lib/DJabberd/Connection/ClientIn.pm
@@ -229,7 +229,7 @@ sub on_stanza_received {
},
}
) unless $class;
- return $self->stream_error("unsupported-stanza-type") unless $class;
+ return $self->stream_error("unsupported-stanza-type", scalar $node->element) unless $class;
$DJabberd::Stats::counter{"ClientIn:$class"}++;
View
2 lib/DJabberd/Connection/ServerIn.pm
@@ -62,7 +62,7 @@ sub on_stanza_received {
);
my $class = $class{$node->element} or
- return $self->stream_error("unsupported-stanza-type", $node->element);
+ return $self->stream_error("unsupported-stanza-type", scalar $node->element);
$DJabberd::Stats::counter{"ServerIn:$class"}++;
View
2 t/handle-stanza-hook.t
@@ -69,7 +69,7 @@ my $client = Test::DJabberd::Client->new(server => $server, name => "client");
$client->send_xml(qq{<bogus-stanza/>});
# should get a stream error
is($client->recv_xml,
- "<stream:error><unsupported-stanza-type xmlns='urn:ietf:params:xml:ns:xmpp-streams'/></stream:error>",
+ "<stream:error><unsupported-stanza-type xmlns='urn:ietf:params:xml:ns:xmpp-streams'/><text xmlns='urn:ietf:params:xml:ns:xmpp-streams'>{jabber:client}bogus-stanza</text></stream:error>",
"should get a stream error for bogus stanza");
pass "Done";

0 comments on commit 1e309a6

Please sign in to comment.