Software /
code /
prosody
Comparison
plugins/mod_component.lua @ 7666:03aa330562ed
Merge 0.10->trunk
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 12 Sep 2016 22:31:25 +0100 |
parent | 7359:a5a080c12c96 |
parent | 7665:2e553f80aedd |
child | 7874:de3c6fb74759 |
comparison
equal
deleted
inserted
replaced
7661:37ab6c6326fe | 7666:03aa330562ed |
---|---|
312 end | 312 end |
313 function listener.ondisconnect(conn, err) | 313 function listener.ondisconnect(conn, err) |
314 local session = sessions[conn]; | 314 local session = sessions[conn]; |
315 if session then | 315 if session then |
316 (session.log or log)("info", "component disconnected: %s (%s)", tostring(session.host), tostring(err)); | 316 (session.log or log)("info", "component disconnected: %s (%s)", tostring(session.host), tostring(err)); |
317 module:fire_event("component-disconnected", { session = session, reason = err }); | 317 if session.host then |
318 module:context(session.host):fire_event("component-disconnected", { session = session, reason = err }); | |
319 end | |
318 if session.on_destroy then session:on_destroy(err); end | 320 if session.on_destroy then session:on_destroy(err); end |
319 sessions[conn] = nil; | 321 sessions[conn] = nil; |
320 for k in pairs(session) do | 322 for k in pairs(session) do |
321 if k ~= "log" and k ~= "close" then | 323 if k ~= "log" and k ~= "close" then |
322 session[k] = nil; | 324 session[k] = nil; |