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 | cd10e4439e1c9b6209f87bb6c77e51fb2f7992fc (patch) | |
tree | 0e87a2026d0e578f734a6160a15a597ec42baa38 | |
parent | 503a9c65cd8e53dfd721e2fcc9797649299b1e75 (diff) | |
download | prosody-cd10e4439e1c9b6209f87bb6c77e51fb2f7992fc.tar.gz prosody-cd10e4439e1c9b6209f87bb6c77e51fb2f7992fc.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 |