Software /
code /
prosody
Changeset
13533:c885594f7f9a
mod_pubsub: Allow passing additional error context
Sometimes it is useful to pass additional information along.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 27 Oct 2024 15:23:45 +0100 |
parents | 13532:9970d333a63f |
children | 13534:d532176d4334 |
files | plugins/mod_pubsub/pubsub.lib.lua |
diffstat | 1 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_pubsub/pubsub.lib.lua Sun Oct 27 15:18:24 2024 +0100 +++ b/plugins/mod_pubsub/pubsub.lib.lua Sun Oct 27 15:23:45 2024 +0100 @@ -33,11 +33,11 @@ ["invalid-item"] = { "modify", "bad-request", "invalid item" }; ["persistent-items-unsupported"] = { "cancel", "feature-not-implemented", nil, "persistent-items" }; }); -local function pubsub_error_reply(stanza, error) +local function pubsub_error_reply(stanza, error, context) if type(error) == "table" and type(error.pubsub_condition) == "string" then error.extra = { namespace = xmlns_pubsub_errors; condition = error.pubsub_condition } end - local reply = st.error_reply(stanza, pubsub_errors.wrap(error)); + local reply = st.error_reply(stanza, pubsub_errors.wrap(error, context)); return reply; end _M.pubsub_error_reply = pubsub_error_reply; @@ -680,7 +680,7 @@ if item then item.attr.publisher = service.config.normalize_jid(stanza.attr.from); end - local ok, ret = service:publish(node, stanza.attr.from, id, item, required_config); + local ok, ret, context = service:publish(node, stanza.attr.from, id, item, required_config); local reply; if ok then if type(ok) == "string" then @@ -691,7 +691,7 @@ :tag("publish", { node = node }) :tag("item", { id = id }); else - reply = pubsub_error_reply(stanza, ret); + reply = pubsub_error_reply(stanza, ret, context); end origin.send(reply); return true;