aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_pubsub/pubsub.lib.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-08-13 20:44:01 +0200
committerKim Alvefur <zash@zash.se>2018-08-13 20:44:01 +0200
commited8c19ee7a47bfddbab9e81c520a6cfc3454ac9b (patch)
tree756a854cea66aa0406949a9db53abc2a3764fcec /plugins/mod_pubsub/pubsub.lib.lua
parent98c9778cc77d1d81300742e34c81c20a44accef1 (diff)
downloadprosody-ed8c19ee7a47bfddbab9e81c520a6cfc3454ac9b.tar.gz
prosody-ed8c19ee7a47bfddbab9e81c520a6cfc3454ac9b.zip
mod_pubsub: Add payload type metadata field
Diffstat (limited to 'plugins/mod_pubsub/pubsub.lib.lua')
-rw-r--r--plugins/mod_pubsub/pubsub.lib.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/plugins/mod_pubsub/pubsub.lib.lua b/plugins/mod_pubsub/pubsub.lib.lua
index 6f397c23..a7ac8787 100644
--- a/plugins/mod_pubsub/pubsub.lib.lua
+++ b/plugins/mod_pubsub/pubsub.lib.lua
@@ -62,6 +62,11 @@ local node_config_form = dataform {
};
{
type = "text-single";
+ name = "pubsub#type";
+ label = "The type of node data, usually specified by the namespace of the payload (if any)";
+ };
+ {
+ type = "text-single";
name = "pubsub#max_items";
label = "Max # of items to persist";
};
@@ -130,11 +135,16 @@ local node_metadata_form = dataform {
type = "text-single";
name = "pubsub#description";
};
+ {
+ type = "text-single";
+ name = "pubsub#type";
+ };
};
local config_field_map = {
title = "pubsub#title";
description = "pubsub#description";
+ payload_type = "pubsub#type";
max_items = "pubsub#max_items";
persist_items = "pubsub#persist_items";
notification_type = "pubsub#notification_type";
@@ -149,6 +159,7 @@ local function config_to_xep0060(node_config)
return {
["pubsub#title"] = node_config["title"];
["pubsub#description"] = node_config["description"];
+ ["pubsub#type"] = node_config["payload_type"];
["pubsub#max_items"] = tostring(node_config["max_items"]);
["pubsub#persist_items"] = node_config["persist_items"];
["pubsub#notification_type"] = node_config["notification_type"];
@@ -259,6 +270,7 @@ function _M.handle_disco_info_node(event, service)
reply:add_child(node_metadata_form:form({
["pubsub#title"] = node_obj.config.title;
["pubsub#description"] = node_obj.config.description;
+ ["pubsub#type"] = node_obj.config.payload_type;
}, "result"));
end
end