[Bps-public-commit] djabberd branch, master, updated. 1e309a6b523804e661c3eabce85d16454a85f1f0

Thomas Sibley trs at bestpractical.com
Thu Sep 23 11:48:19 EDT 2010


The branch, master has been updated
       via  1e309a6b523804e661c3eabce85d16454a85f1f0 (commit)
      from  68d1b031df9d004869808d85b3e5825ede737d5a (commit)

Summary of changes:
 lib/DJabberd/Connection/ClientIn.pm |    2 +-
 lib/DJabberd/Connection/ServerIn.pm |    2 +-
 t/handle-stanza-hook.t              |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

- Log -----------------------------------------------------------------
commit 1e309a6b523804e661c3eabce85d16454a85f1f0
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Sep 23 11:17:05 2010 -0400

    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.

diff --git a/lib/DJabberd/Connection/ClientIn.pm b/lib/DJabberd/Connection/ClientIn.pm
index fbf6e86..d40b680 100644
--- a/lib/DJabberd/Connection/ClientIn.pm
+++ b/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"}++;
 
diff --git a/lib/DJabberd/Connection/ServerIn.pm b/lib/DJabberd/Connection/ServerIn.pm
index d7ca323..18d601b 100644
--- a/lib/DJabberd/Connection/ServerIn.pm
+++ b/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"}++;
 
diff --git a/t/handle-stanza-hook.t b/t/handle-stanza-hook.t
index f34e720..bee2b77 100644
--- a/t/handle-stanza-hook.t
+++ b/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";

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list