Mercurial > prosody-hg
comparison plugins/mod_pubsub/pubsub.lib.lua @ 9182:ec48c02ded0c
mod_pubsub: Add support for "quiet nodes" (disabling notifications)
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 16 Aug 2018 14:49:42 +0200 |
| parents | cc68cb03f85e |
| children | 8239f24e38df |
comparison
equal
deleted
inserted
replaced
| 9181:79cf1f74738f | 9182:ec48c02ded0c |
|---|---|
| 96 "subscribers"; | 96 "subscribers"; |
| 97 "open"; | 97 "open"; |
| 98 }; | 98 }; |
| 99 }; | 99 }; |
| 100 { | 100 { |
| 101 type = "boolean"; | |
| 102 label = "Whether to deliver payloads with event notifications"; | |
| 103 name = "pubsub#deliver_payloads"; | |
| 104 }; | |
| 105 { | |
| 101 type = "list-single"; | 106 type = "list-single"; |
| 102 name = "pubsub#notification_type"; | 107 name = "pubsub#notification_type"; |
| 103 label = "Specify the delivery style for notifications"; | 108 label = "Specify the delivery style for notifications"; |
| 104 options = { | 109 options = { |
| 105 { label = "Messages of type normal", value = "normal" }, | 110 { label = "Messages of type normal", value = "normal" }, |
| 148 max_items = "pubsub#max_items"; | 153 max_items = "pubsub#max_items"; |
| 149 persist_items = "pubsub#persist_items"; | 154 persist_items = "pubsub#persist_items"; |
| 150 notification_type = "pubsub#notification_type"; | 155 notification_type = "pubsub#notification_type"; |
| 151 access_model = "pubsub#access_model"; | 156 access_model = "pubsub#access_model"; |
| 152 publish_model = "pubsub#publish_model"; | 157 publish_model = "pubsub#publish_model"; |
| 158 notify_items = "pubsub#deliver_notifications"; | |
| 153 }; | 159 }; |
| 154 local reverse_config_field_map = {}; | 160 local reverse_config_field_map = {}; |
| 155 for k, v in pairs(config_field_map) do reverse_config_field_map[v] = k; end | 161 for k, v in pairs(config_field_map) do reverse_config_field_map[v] = k; end |
| 156 | 162 |
| 157 -- util.pubsub is meant to be agnostic to XEP-0060 | 163 -- util.pubsub is meant to be agnostic to XEP-0060 |
| 163 ["pubsub#max_items"] = tostring(node_config["max_items"]); | 169 ["pubsub#max_items"] = tostring(node_config["max_items"]); |
| 164 ["pubsub#persist_items"] = node_config["persist_items"]; | 170 ["pubsub#persist_items"] = node_config["persist_items"]; |
| 165 ["pubsub#notification_type"] = node_config["notification_type"]; | 171 ["pubsub#notification_type"] = node_config["notification_type"]; |
| 166 ["pubsub#access_model"] = node_config["access_model"]; | 172 ["pubsub#access_model"] = node_config["access_model"]; |
| 167 ["pubsub#publish_model"] = node_config["publish_model"]; | 173 ["pubsub#publish_model"] = node_config["publish_model"]; |
| 174 ["pubsub#deliver_notifications"] = node_config["notify_items"]; | |
| 168 } | 175 } |
| 169 end | 176 end |
| 170 | 177 |
| 171 local function config_from_xep0060(config, strict) | 178 local function config_from_xep0060(config, strict) |
| 172 local ret = {}; | 179 local ret = {}; |
