Comparison

plugins/mod_pubsub/pubsub.lib.lua @ 9183:8239f24e38df

mod_pubsub: Make notification of node deletion configurable
author Kim Alvefur <zash@zash.se>
date Thu, 16 Aug 2018 14:42:36 +0200
parent 9182:ec48c02ded0c
child 9184:9fbddb80803b
comparison
equal deleted inserted replaced
9182:ec48c02ded0c 9183:8239f24e38df
109 options = { 109 options = {
110 { label = "Messages of type normal", value = "normal" }, 110 { label = "Messages of type normal", value = "normal" },
111 { label = "Messages of type headline", value = "headline", default = true }, 111 { label = "Messages of type headline", value = "headline", default = true },
112 }; 112 };
113 }; 113 };
114 {
115 type = "boolean";
116 label = "Whether to notify subscribers when the node is deleted";
117 name = "pubsub#notify_delete";
118 };
114 }; 119 };
115 120
116 local subscribe_options_form = dataform { 121 local subscribe_options_form = dataform {
117 { 122 {
118 type = "hidden"; 123 type = "hidden";
154 persist_items = "pubsub#persist_items"; 159 persist_items = "pubsub#persist_items";
155 notification_type = "pubsub#notification_type"; 160 notification_type = "pubsub#notification_type";
156 access_model = "pubsub#access_model"; 161 access_model = "pubsub#access_model";
157 publish_model = "pubsub#publish_model"; 162 publish_model = "pubsub#publish_model";
158 notify_items = "pubsub#deliver_notifications"; 163 notify_items = "pubsub#deliver_notifications";
164 notify_delete = "pubsub#notify_delete";
159 }; 165 };
160 local reverse_config_field_map = {}; 166 local reverse_config_field_map = {};
161 for k, v in pairs(config_field_map) do reverse_config_field_map[v] = k; end 167 for k, v in pairs(config_field_map) do reverse_config_field_map[v] = k; end
162 168
163 -- util.pubsub is meant to be agnostic to XEP-0060 169 -- util.pubsub is meant to be agnostic to XEP-0060
170 ["pubsub#persist_items"] = node_config["persist_items"]; 176 ["pubsub#persist_items"] = node_config["persist_items"];
171 ["pubsub#notification_type"] = node_config["notification_type"]; 177 ["pubsub#notification_type"] = node_config["notification_type"];
172 ["pubsub#access_model"] = node_config["access_model"]; 178 ["pubsub#access_model"] = node_config["access_model"];
173 ["pubsub#publish_model"] = node_config["publish_model"]; 179 ["pubsub#publish_model"] = node_config["publish_model"];
174 ["pubsub#deliver_notifications"] = node_config["notify_items"]; 180 ["pubsub#deliver_notifications"] = node_config["notify_items"];
181 ["pubsub#notify_delete"] = node_config["notify_delete"];
175 } 182 }
176 end 183 end
177 184
178 local function config_from_xep0060(config, strict) 185 local function config_from_xep0060(config, strict)
179 local ret = {}; 186 local ret = {};