aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_c2s.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2013-04-25 20:37:51 +0100
committerMatthew Wild <mwild1@gmail.com>2013-04-25 20:37:51 +0100
commit2716bbf64ff4f9c62bb578802de9e16b42d5203d (patch)
tree0f587a95354aa54cd7e6365fde97fb1050c6c7da /plugins/mod_c2s.lua
parentc953a057a8fb1e0b0617dd090ab4ff7a643956c3 (diff)
parent55b90a8abd0e65e476c7df3fe0ff437a99607f3e (diff)
downloadprosody-2716bbf64ff4f9c62bb578802de9e16b42d5203d.tar.gz
prosody-2716bbf64ff4f9c62bb578802de9e16b42d5203d.zip
Merge 0.9->trunk
Diffstat (limited to 'plugins/mod_c2s.lua')
-rw-r--r--plugins/mod_c2s.lua18
1 files changed, 9 insertions, 9 deletions
diff --git a/plugins/mod_c2s.lua b/plugins/mod_c2s.lua
index cafd0c71..efef8763 100644
--- a/plugins/mod_c2s.lua
+++ b/plugins/mod_c2s.lua
@@ -133,25 +133,25 @@ local function session_close(session, reason)
session.send(st.stanza("stream:stream", default_stream_attr):top_tag());
end
if reason then -- nil == no err, initiated by us, false == initiated by client
+ local stream_error = st.stanza("stream:error");
if type(reason) == "string" then -- assume stream error
- log("debug", "Disconnecting client, <stream:error> is: %s", reason);
- session.send(st.stanza("stream:error"):tag(reason, {xmlns = 'urn:ietf:params:xml:ns:xmpp-streams' }));
+ stream_error:tag(reason, {xmlns = 'urn:ietf:params:xml:ns:xmpp-streams' });
elseif type(reason) == "table" then
if reason.condition then
- local stanza = st.stanza("stream:error"):tag(reason.condition, stream_xmlns_attr):up();
+ stream_error:tag(reason.condition, stream_xmlns_attr):up();
if reason.text then
- stanza:tag("text", stream_xmlns_attr):text(reason.text):up();
+ stream_error:tag("text", stream_xmlns_attr):text(reason.text):up();
end
if reason.extra then
- stanza:add_child(reason.extra);
+ stream_error:add_child(reason.extra);
end
- log("debug", "Disconnecting client, <stream:error> is: %s", tostring(stanza));
- session.send(stanza);
elseif reason.name then -- a stanza
- log("debug", "Disconnecting client, <stream:error> is: %s", tostring(reason));
- session.send(reason);
+ stream_error = reason;
end
end
+ stream_error = tostring(stream_error);
+ log("debug", "Disconnecting client, <stream:error> is: %s", stream_error);
+ session.send(stream_error);
end
session.send("</stream:stream>");