diff options
author | Matthew Wild <mwild1@gmail.com> | 2016-09-12 22:30:37 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2016-09-12 22:30:37 +0100 |
commit | f04d5613829f64ceed87e0652fcbcd6f602833d3 (patch) | |
tree | 0e87a2026d0e578f734a6160a15a597ec42baa38 | |
parent | fc848ee5ebaac232985b855b0348bf3f4d6b9b03 (diff) | |
download | prosody-f04d5613829f64ceed87e0652fcbcd6f602833d3.tar.gz prosody-f04d5613829f64ceed87e0652fcbcd6f602833d3.zip |
mod_component: Fire 'component-disconnected' event on host, to maintain consistency - sessions with no host never authenticated. Fixes #737
-rw-r--r-- | plugins/mod_component.lua | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/plugins/mod_component.lua b/plugins/mod_component.lua index eebaaf3e..0de4d23f 100644 --- a/plugins/mod_component.lua +++ b/plugins/mod_component.lua @@ -314,7 +314,9 @@ function listener.ondisconnect(conn, err) local session = sessions[conn]; if session then (session.log or log)("info", "component disconnected: %s (%s)", tostring(session.host), tostring(err)); - module:fire_event("component-disconnected", { session = session, reason = err }); + if session.host then + module:context(session.host):fire_event("component-disconnected", { session = session, reason = err }); + end if session.on_destroy then session:on_destroy(err); end sessions[conn] = nil; for k in pairs(session) do |