Diff

plugins/mod_pubsub/pubsub.lib.lua @ 10356:0a2d7efca039

util.pubsub, pubsub.lib and tests: Add text to precondition-not-met error (fixes #1455)
author Matthew Wild <mwild1@gmail.com>
date Sun, 27 Oct 2019 14:45:57 +0000
parent 10276:4e4ce7400b39
child 10554:e1de29c41259
line wrap: on
line diff
--- a/plugins/mod_pubsub/pubsub.lib.lua	Sun Oct 20 23:47:48 2019 +0200
+++ b/plugins/mod_pubsub/pubsub.lib.lua	Sun Oct 27 14:45:57 2019 +0000
@@ -7,6 +7,7 @@
 local it = require "util.iterators";
 local uuid_generate = require "util.uuid".generate;
 local dataform = require"util.dataforms".new;
+local errors = require "util.error";
 
 local xmlns_pubsub = "http://jabber.org/protocol/pubsub";
 local xmlns_pubsub_errors = "http://jabber.org/protocol/pubsub#errors";
@@ -34,6 +35,9 @@
 };
 local function pubsub_error_reply(stanza, error)
 	local e = pubsub_errors[error];
+	if not e and errors.is_err(error) then
+		e = { error.type, error.condition, error.text, error.pubsub_condition };
+	end
 	local reply = st.error_reply(stanza, t_unpack(e, 1, 3));
 	if e[4] then
 		reply:tag(e[4], { xmlns = xmlns_pubsub_errors }):up();