diff options
author | Kim Alvefur <zash@zash.se> | 2024-11-08 02:15:10 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2024-11-08 02:15:10 +0100 |
commit | 3b079188006e47fdea16e267492033c56bdc6391 (patch) | |
tree | ffd3afe8c98f52caba91fd1f50418ce570314215 /plugins/mod_pubsub | |
parent | e32aba4c5379e98d40e7f1a73dbb172f5a30c151 (diff) | |
download | prosody-3b079188006e47fdea16e267492033c56bdc6391.tar.gz prosody-3b079188006e47fdea16e267492033c56bdc6391.zip |
mod_pubsub: Pass metadata directly into form
Reduces duplication and need to edit in two places when adding another
metadata field.
Diffstat (limited to 'plugins/mod_pubsub')
-rw-r--r-- | plugins/mod_pubsub/pubsub.lib.lua | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/plugins/mod_pubsub/pubsub.lib.lua b/plugins/mod_pubsub/pubsub.lib.lua index 92586518..f4d44f36 100644 --- a/plugins/mod_pubsub/pubsub.lib.lua +++ b/plugins/mod_pubsub/pubsub.lib.lua @@ -202,23 +202,28 @@ local node_metadata_form = dataform { }; { type = "text-single"; - name = "pubsub#title"; + name = "title"; + var = "pubsub#title"; }; { type = "text-single"; - name = "pubsub#description"; + name = "description"; + var = "pubsub#description"; }; { type = "text-single"; - name = "pubsub#type"; + name = "payload_type"; + var = "pubsub#type"; }; { type = "text-single"; - name = "pubsub#access_model"; + name = "access_model"; + var = "pubsub#access_model"; }; { type = "text-single"; - name = "pubsub#publish_model"; + name = "publish_model"; + var = "pubsub#publish_model"; }; }; _M.node_metadata_form = node_metadata_form; @@ -297,13 +302,7 @@ function _M.handle_disco_info_node(event, service) end event.exists = true; reply:tag("identity", { category = "pubsub", type = "leaf" }):up(); - reply:add_child(node_metadata_form:form({ - ["pubsub#title"] = meta.title; - ["pubsub#description"] = meta.description; - ["pubsub#type"] = meta.payload_type; - ["pubsub#access_model"] = meta.access_model; - ["pubsub#publish_model"] = meta.publish_model; - }, "result")); + reply:add_child(node_metadata_form:form(meta, "result")); end function _M.handle_disco_items_node(event, service) |