Changeset

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
parents 8376:eb6a9c314c86
children 8379:2a0915aa6131
files plugins/mod_pep_plus.lua
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
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)