Changeset

9180:cc68cb03f85e

mod_pubsub: Add payload type metadata field
author Kim Alvefur <zash@zash.se>
date Mon, 13 Aug 2018 20:44:01 +0200
parents 9179:82fad995a149
children 9181:79cf1f74738f
files plugins/mod_pubsub/pubsub.lib.lua
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_pubsub/pubsub.lib.lua	Thu Aug 16 14:32:21 2018 +0200
+++ b/plugins/mod_pubsub/pubsub.lib.lua	Mon Aug 13 20:44:01 2018 +0200
@@ -62,6 +62,11 @@
 	};
 	{
 		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 @@
 		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 @@
 	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 @@
 		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