Diff

plugins/mod_c2s.lua @ 9910:7a703af90c9c

mod_c2s: Fire an event when outgoing buffers have been emptied
author Kim Alvefur <zash@zash.se>
date Sun, 24 Mar 2019 18:30:51 +0100
parent 9784:7fa273f8869e
child 10017:994cccebb597
line wrap: on
line diff
--- a/plugins/mod_c2s.lua	Sat Nov 24 02:25:44 2018 +0100
+++ b/plugins/mod_c2s.lua	Sun Mar 24 18:30:51 2019 +0100
@@ -332,6 +332,13 @@
 	end
 end
 
+function listener.ondrain(conn)
+	local session = sessions[conn];
+	if session then
+		return (hosts[session.host] or prosody).events.fire_event("c2s-ondrain", { session = session });
+	end
+end
+
 local function keepalive(event)
 	local session = event.session;
 	if not session.notopen then