Diff

plugins/mod_pep_plus.lua @ 8377:58cdbbe3b86a

mod_pep_plus: Broadcast only the last item (thanks lovetox)
author Kim Alvefur <zash@zash.se>
date Tue, 07 Nov 2017 02:32:45 +0100
parent 8342:0c0990a575de
child 8696:164da3186511
line wrap: on
line diff
--- a/plugins/mod_pep_plus.lua	Tue Nov 07 00:40:52 2017 +0100
+++ b/plugins/mod_pep_plus.lua	Tue Nov 07 02:32:45 2017 +0100
@@ -256,11 +256,10 @@
 end
 
 local function resend_last_item(jid, node, service)
-	local ok, items = service:get_items(node, jid);
+	local ok, id, item = service:get_last_item(node, jid);
 	if not ok then return; end
-	for _, id in ipairs(items) do
-		service.config.broadcaster("items", node, { [jid] = true }, items[id]);
-	end
+	if not id then return; end
+	service.config.broadcaster("items", node, { [jid] = true }, item);
 end
 
 local function update_subscriptions(recipient, service_name, nodes)