aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/dnsregistry.lua7
-rw-r--r--util/pubsub.lua26
-rw-r--r--util/xtemplate.lua6
3 files changed, 27 insertions, 12 deletions
diff --git a/util/dnsregistry.lua b/util/dnsregistry.lua
index c52abee9..b65debe0 100644
--- a/util/dnsregistry.lua
+++ b/util/dnsregistry.lua
@@ -1,5 +1,5 @@
-- Source: https://www.iana.org/assignments/dns-parameters/dns-parameters.xml
--- Generated on 2023-01-20
+-- Generated on 2024-10-26
return {
classes = {
["IN"] = 1; [1] = "IN";
@@ -79,6 +79,7 @@ return {
["LP"] = 107; [107] = "LP";
["EUI48"] = 108; [108] = "EUI48";
["EUI64"] = 109; [109] = "EUI64";
+ ["NXNAME"] = 128; [128] = "NXNAME";
["TKEY"] = 249; [249] = "TKEY";
["TSIG"] = 250; [250] = "TSIG";
["IXFR"] = 251; [251] = "IXFR";
@@ -91,6 +92,10 @@ return {
["AVC"] = 258; [258] = "AVC";
["DOA"] = 259; [259] = "DOA";
["AMTRELAY"] = 260; [260] = "AMTRELAY";
+ ["RESINFO"] = 261; [261] = "RESINFO";
+ ["WALLET"] = 262; [262] = "WALLET";
+ ["CLA"] = 263; [263] = "CLA";
+ ["IPN"] = 264; [264] = "IPN";
["TA"] = 32768; [32768] = "TA";
["DLV"] = 32769; [32769] = "DLV";
};
diff --git a/util/pubsub.lua b/util/pubsub.lua
index ccde8b53..d6779736 100644
--- a/util/pubsub.lua
+++ b/util/pubsub.lua
@@ -1,6 +1,5 @@
local events = require "prosody.util.events";
local cache = require "prosody.util.cache";
-local errors = require "prosody.util.error";
local service_mt = {};
@@ -12,6 +11,7 @@ local default_config = {
itemcheck = function () return true; end;
get_affiliation = function () end;
normalize_jid = function (jid) return jid; end;
+ metadata_subset = {};
capabilities = {
outcast = {
create = false;
@@ -46,6 +46,7 @@ local default_config = {
get_subscription = true;
get_subscriptions = true;
get_items = false;
+ get_metadata = true;
subscribe_other = false;
unsubscribe_other = false;
@@ -68,6 +69,7 @@ local default_config = {
get_subscription = true;
get_subscriptions = true;
get_items = true;
+ get_metadata = true;
subscribe_other = false;
unsubscribe_other = false;
@@ -91,6 +93,7 @@ local default_config = {
get_subscription = true;
get_subscriptions = true;
get_items = true;
+ get_metadata = true;
subscribe_other = false;
unsubscribe_other = false;
@@ -116,6 +119,7 @@ local default_config = {
get_subscription = true;
get_subscriptions = true;
get_items = true;
+ get_metadata = true;
subscribe_other = true;
@@ -562,11 +566,7 @@ function service:publish(node, actor, id, item, requested_config) --> ok, err
-- Check that node has the requested config before we publish
local ok, field = check_preconditions(node_obj.config, requested_config);
if not ok then
- local err = errors.new({
- type = "cancel", condition = "conflict", text = "Field does not match: "..field;
- });
- err.pubsub_condition = "precondition-not-met";
- return false, err;
+ return false, "precondition-not-met", { field = field };
end
end
if not self.config.itemcheck(item) then
@@ -877,6 +877,20 @@ function service:get_node_config(node, actor) --> (true, config) or (false, err)
return true, config_table;
end
+function service:get_node_metadata(node, actor)
+ if not self:may(node, actor, "get_metadata") then
+ return false, "forbidden";
+ end
+
+ local ok, config = self:get_node_config(node, true);
+ if not ok then return ok, config; end
+ local meta = {};
+ for _, k in ipairs(self.config.metadata_subset) do
+ meta[k] = config[k];
+ end
+ return true, meta;
+end
+
return {
new = new;
};
diff --git a/util/xtemplate.lua b/util/xtemplate.lua
index e23b1a01..446d7d1f 100644
--- a/util/xtemplate.lua
+++ b/util/xtemplate.lua
@@ -70,11 +70,7 @@ local function render(template, root, escape, filters)
end
elseif filters and filters[func] then
local f = filters[func];
- if args == nil then
- value, is_escaped = f(value, tmpl);
- else
- value, is_escaped = f(args, value, tmpl);
- end
+ value, is_escaped = f(value, args, tmpl);
else
error("No such filter function: " .. func);
end