mirror of
https://github.com/bjc/prosody.git
synced 2025-04-04 13:47:41 +03:00
Fix logging of disconnect reason, and also sending of unavailable presence on disconnect
This commit is contained in:
parent
62ee1df6b6
commit
cd80b1c71d
1 changed files with 4 additions and 3 deletions
|
@ -73,15 +73,16 @@ function xmppclient.listener(conn, data)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function xmppclient.disconnect(conn)
|
function xmppclient.disconnect(conn, err)
|
||||||
local session = sessions[conn];
|
local session = sessions[conn];
|
||||||
if session then
|
if session then
|
||||||
if session.last_presence and session.last_presence.attr.type ~= "unavailable" then
|
if session.presence and session.presence.attr.type ~= "unavailable" then
|
||||||
local pres = st.presence{ type = "unavailable" };
|
local pres = st.presence{ type = "unavailable" };
|
||||||
if err == "closed" then err = "connection closed"; end --FIXME where did err come from?
|
if err == "closed" then err = "connection closed"; end
|
||||||
pres:tag("status"):text("Disconnected: "..err);
|
pres:tag("status"):text("Disconnected: "..err);
|
||||||
session.stanza_dispatch(pres);
|
session.stanza_dispatch(pres);
|
||||||
end
|
end
|
||||||
|
session.log("info", "Client disconnected: %s", err);
|
||||||
sm_destroy_session(session);
|
sm_destroy_session(session);
|
||||||
sessions[conn] = nil;
|
sessions[conn] = nil;
|
||||||
session = nil;
|
session = nil;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue