Comparison

plugins/mod_pubsub/pubsub.lib.lua @ 11714:d783716103c1

mod_pubsub: Fix inclusion of publisher (fixes #1399)
author Kim Alvefur <zash@zash.se>
date Wed, 01 May 2019 22:33:22 +0200
parent 11631:6641ca266d94
child 11715:ddd6e21e58bf
comparison
equal deleted inserted replaced
11713:7623767df468 11714:d783716103c1
605 id = uuid_generate(); 605 id = uuid_generate();
606 if item then 606 if item then
607 item.attr.id = id; 607 item.attr.id = id;
608 end 608 end
609 end 609 end
610 if item then
611 item.attr.publisher = service.config.normalize_jid(stanza.attr.from);
612 end
610 local ok, ret = service:publish(node, stanza.attr.from, id, item, required_config); 613 local ok, ret = service:publish(node, stanza.attr.from, id, item, required_config);
611 local reply; 614 local reply;
612 if ok then 615 if ok then
613 if type(ok) == "string" then 616 if type(ok) == "string" then
614 id = ok; 617 id = ok;
793 local reply = st.reply(stanza); 796 local reply = st.reply(stanza);
794 origin.send(reply); 797 origin.send(reply);
795 return true; 798 return true;
796 end 799 end
797 800
798 local function create_encapsulating_item(id, payload) 801 local function create_encapsulating_item(id, payload, publisher)
799 local item = st.stanza("item", { id = id, xmlns = xmlns_pubsub }); 802 local item = st.stanza("item", { id = id, publisher = publisher, xmlns = xmlns_pubsub });
800 item:add_child(payload); 803 item:add_child(payload);
801 return item; 804 return item;
802 end 805 end
803 806
804 local function archive_itemstore(archive, max_items, user, node) 807 local function archive_itemstore(archive, max_items, user, node)