mod_c2s: Fix session:close() when a stanza is passed as reason
authorKim Alvefur <zash@zash.se>
Fri, 10 May 2013 20:29:03 +0000 (22:29 +0200)
committerKim Alvefur <zash@zash.se>
Fri, 10 May 2013 20:29:03 +0000 (22:29 +0200)
plugins/mod_c2s.lua

index efef8763a3d38f51cd45324a5bff1eab50639a5d..1d2dd6ddf4c07b25e7aebcaaf090a4ea0104d542 100644 (file)
@@ -157,7 +157,7 @@ local function session_close(session, reason)
                session.send("</stream:stream>");
                function session.send() return false; end
                
-               local reason = (reason and (reason.text or reason.condition)) or reason;
+               local reason = (reason and (reason.name or reason.text or reason.condition)) or reason;
                session.log("info", "c2s stream for %s closed: %s", session.full_jid or ("<"..session.ip..">"), reason or "session closed");
 
                -- Authenticated incoming stream may still be sending us stanzas, so wait for </stream:stream> from remote