Diff

plugins/mod_component.lua @ 7300:66e7517bd8f3

mod_component: Fire event when component disconnects
author Matthew Wild <mwild1@gmail.com>
date Fri, 18 Mar 2016 13:58:55 +0000
parent 6913:c7a0d5299933
child 7301:995777582044
line wrap: on
line diff
--- a/plugins/mod_component.lua	Fri Mar 18 11:55:40 2016 +0100
+++ b/plugins/mod_component.lua	Fri Mar 18 13:58:55 2016 +0000
@@ -314,6 +314,7 @@
 	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.on_destroy then session:on_destroy(err); end
 		sessions[conn] = nil;
 		for k in pairs(session) do