Changeset

12459:c0bc8025acf4

Merge 0.12->trunk
author Kim Alvefur <zash@zash.se>
date Fri, 08 Apr 2022 15:17:11 +0200
parents 12455:e703a9d71360 (current diff) 12458:10cc52e4b310 (diff)
children 12461:972671506251
files
diffstat 1 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_storage_xep0227.lua	Thu Apr 07 17:22:22 2022 +0100
+++ b/plugins/mod_storage_xep0227.lua	Fri Apr 08 15:17:11 2022 +0200
@@ -59,7 +59,7 @@
 			end
 		end
 	end
-	module:log("warn", "Unable to find user element");
+	module:log("warn", "Unable to find user element in %s", xml and xml:top_tag() or "nothing");
 end
 local function createOuterXml(user, host)
 	return st.stanza("server-data", {xmlns='urn:xmpp:pie:0'})
@@ -72,7 +72,7 @@
 end
 
 local function base64_to_hex(s)
-	return base64.encode(hex.decode(s));
+	return hex.encode(base64.decode(s));
 end
 
 local handlers = {};
@@ -279,6 +279,7 @@
 };
 
 -- PEP node configuration/etc. (not items)
+local xmlns_pubsub = "http://jabber.org/protocol/pubsub";
 local xmlns_pubsub_owner = "http://jabber.org/protocol/pubsub#owner";
 local lib_pubsub = module:require "pubsub";
 handlers.pep = {
@@ -300,7 +301,16 @@
 		};
 		local owner_el = user_el:get_child("pubsub", xmlns_pubsub_owner);
 		if not owner_el then
-			return nil;
+			local pubsub_el = user_el:get_child("pubsub", xmlns_pubsub);
+			if not pubsub_el then
+				return nil;
+			end
+			for node_el in pubsub_el:childtags("items") do
+				nodes[node_el.attr.node] = {
+					node = node_el.attr.node;
+				}
+			end
+			return nodes;
 		end
 		for node_el in owner_el:childtags() do
 			local node_name = node_el.attr.node;
@@ -396,7 +406,6 @@
 };
 
 -- PEP items
-local xmlns_pubsub = "http://jabber.org/protocol/pubsub";
 handlers.pep_ = {
 	_stores = function (self, xml) --luacheck: ignore 212/self
 		local store_names = set.new();