diff options
author | Kim Alvefur <zash@zash.se> | 2024-10-27 15:23:45 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2024-10-27 15:23:45 +0100 |
commit | ff05b0773d91b5449e382db943d99db4dd7bbfbb (patch) | |
tree | e8e7b58c8e85321b52b28467dfa22b9e1a0de5a0 /plugins | |
parent | 9dd5775dce8ca965899a9198584311ccce6c1732 (diff) | |
download | prosody-ff05b0773d91b5449e382db943d99db4dd7bbfbb.tar.gz prosody-ff05b0773d91b5449e382db943d99db4dd7bbfbb.zip |
mod_pubsub: Allow passing additional error context
Sometimes it is useful to pass additional information along.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_pubsub/pubsub.lib.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/plugins/mod_pubsub/pubsub.lib.lua b/plugins/mod_pubsub/pubsub.lib.lua index a7379ab3..f2980c18 100644 --- a/plugins/mod_pubsub/pubsub.lib.lua +++ b/plugins/mod_pubsub/pubsub.lib.lua @@ -33,11 +33,11 @@ local pubsub_errors = errors.init("pubsub", xmlns_pubsub_errors, { ["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 @@ function handlers.set_publish(origin, stanza, publish, service) 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 @@ function handlers.set_publish(origin, stanza, publish, service) :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; |