Software /
code /
prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
10355:cb9755d7a36e | 10356:0a2d7efca039 |
---|---|
5 local set = require "util.set"; | 5 local set = require "util.set"; |
6 local st = require "util.stanza"; | 6 local st = require "util.stanza"; |
7 local it = require "util.iterators"; | 7 local it = require "util.iterators"; |
8 local uuid_generate = require "util.uuid".generate; | 8 local uuid_generate = require "util.uuid".generate; |
9 local dataform = require"util.dataforms".new; | 9 local dataform = require"util.dataforms".new; |
10 local errors = require "util.error"; | |
10 | 11 |
11 local xmlns_pubsub = "http://jabber.org/protocol/pubsub"; | 12 local xmlns_pubsub = "http://jabber.org/protocol/pubsub"; |
12 local xmlns_pubsub_errors = "http://jabber.org/protocol/pubsub#errors"; | 13 local xmlns_pubsub_errors = "http://jabber.org/protocol/pubsub#errors"; |
13 local xmlns_pubsub_owner = "http://jabber.org/protocol/pubsub#owner"; | 14 local xmlns_pubsub_owner = "http://jabber.org/protocol/pubsub#owner"; |
14 | 15 |
32 ["precondition-not-met"] = { "cancel", "conflict", nil, "precondition-not-met" }; | 33 ["precondition-not-met"] = { "cancel", "conflict", nil, "precondition-not-met" }; |
33 ["invalid-item"] = { "modify", "bad-request", "invalid item" }; | 34 ["invalid-item"] = { "modify", "bad-request", "invalid item" }; |
34 }; | 35 }; |
35 local function pubsub_error_reply(stanza, error) | 36 local function pubsub_error_reply(stanza, error) |
36 local e = pubsub_errors[error]; | 37 local e = pubsub_errors[error]; |
38 if not e and errors.is_err(error) then | |
39 e = { error.type, error.condition, error.text, error.pubsub_condition }; | |
40 end | |
37 local reply = st.error_reply(stanza, t_unpack(e, 1, 3)); | 41 local reply = st.error_reply(stanza, t_unpack(e, 1, 3)); |
38 if e[4] then | 42 if e[4] then |
39 reply:tag(e[4], { xmlns = xmlns_pubsub_errors }):up(); | 43 reply:tag(e[4], { xmlns = xmlns_pubsub_errors }):up(); |
40 end | 44 end |
41 return reply; | 45 return reply; |