Software /
code /
prosody
Diff
plugins/mod_presence.lua @ 4967:b7bcf088e723
mod_presence: Handle nil disconnection error
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 22 Jul 2012 17:02:18 +0100 |
parent | 4139:eef75a0c85e3 |
child | 4993:5243b74a4cbb |
line wrap: on
line diff
--- a/plugins/mod_presence.lua Sun Jul 22 17:01:52 2012 +0100 +++ b/plugins/mod_presence.lua Sun Jul 22 17:02:18 2012 +0100 @@ -352,13 +352,15 @@ -- Send unavailable presence if session.presence then local pres = st.presence{ type = "unavailable" }; - if not(err) or err == "closed" then err = "connection closed"; end - pres:tag("status"):text("Disconnected: "..err):up(); + if err then + pres:tag("status"):text("Disconnected: "..err):up(); + end session:dispatch_stanza(pres); elseif session.directed then local pres = st.presence{ type = "unavailable", from = session.full_jid }; - if not(err) or err == "closed" then err = "connection closed"; end - pres:tag("status"):text("Disconnected: "..err):up(); + if err then + pres:tag("status"):text("Disconnected: "..err):up(); + end for jid in pairs(session.directed) do pres.attr.to = jid; core_post_stanza(session, pres, true);