mod_pep: Only resend last item on successful subscription
authorKim Alvefur <zash@zash.se>
Sun, 05 Aug 2018 01:53:48 +0200
changeset 9143 415a6d26709e
parent 9142 24a1e7a9d463
child 9144 c1368fb756bf
mod_pep: Only resend last item on successful subscription
plugins/mod_pep.lua
--- a/plugins/mod_pep.lua	Mon Aug 06 18:33:33 2018 +0200
+++ b/plugins/mod_pep.lua	Sun Aug 05 01:53:48 2018 +0200
@@ -362,8 +362,9 @@
 	end
 
 	for node in nodes - current do
-		service:add_subscription(node, recipient, recipient, { presence = true });
-		resend_last_item(recipient, node, service);
+		if service:add_subscription(node, recipient, recipient, { presence = true }) then
+			resend_last_item(recipient, node, service);
+		end
 	end
 
 	if nodes == empty_set or nodes:empty() then