Mercurial > prosody-hg
comparison plugins/mod_pubsub/pubsub.lib.lua @ 9188:ef2616ade453
mod_pubsub: Add support for thin notifications (without the full payload)
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 16 Aug 2018 15:20:29 +0200 |
| parents | 9f33a13eb011 |
| children | 2ce27be5fdd1 |
comparison
equal
deleted
inserted
replaced
| 9187:bd452e4f5a13 | 9188:ef2616ade453 |
|---|---|
| 102 value = "true"; | 102 value = "true"; |
| 103 label = "Whether to deliver event notifications"; | 103 label = "Whether to deliver event notifications"; |
| 104 name = "pubsub#deliver_notifications"; | 104 name = "pubsub#deliver_notifications"; |
| 105 }; | 105 }; |
| 106 { | 106 { |
| 107 type = "boolean"; | |
| 108 label = "Whether to deliver payloads with event notifications"; | |
| 109 name = "pubsub#deliver_payloads"; | |
| 110 }; | |
| 111 { | |
| 107 type = "list-single"; | 112 type = "list-single"; |
| 108 name = "pubsub#notification_type"; | 113 name = "pubsub#notification_type"; |
| 109 label = "Specify the delivery style for notifications"; | 114 label = "Specify the delivery style for notifications"; |
| 110 options = { | 115 options = { |
| 111 { label = "Messages of type normal", value = "normal" }, | 116 { label = "Messages of type normal", value = "normal" }, |
| 169 access_model = "pubsub#access_model"; | 174 access_model = "pubsub#access_model"; |
| 170 publish_model = "pubsub#publish_model"; | 175 publish_model = "pubsub#publish_model"; |
| 171 notify_items = "pubsub#deliver_notifications"; | 176 notify_items = "pubsub#deliver_notifications"; |
| 172 notify_delete = "pubsub#notify_delete"; | 177 notify_delete = "pubsub#notify_delete"; |
| 173 notify_retract = "pubsub#notify_retract"; | 178 notify_retract = "pubsub#notify_retract"; |
| 179 include_payload = "pubsub#deliver_payloads"; | |
| 174 }; | 180 }; |
| 175 local reverse_config_field_map = {}; | 181 local reverse_config_field_map = {}; |
| 176 for k, v in pairs(config_field_map) do reverse_config_field_map[v] = k; end | 182 for k, v in pairs(config_field_map) do reverse_config_field_map[v] = k; end |
| 177 | 183 |
| 178 -- util.pubsub is meant to be agnostic to XEP-0060 | 184 -- util.pubsub is meant to be agnostic to XEP-0060 |
| 187 ["pubsub#access_model"] = node_config["access_model"]; | 193 ["pubsub#access_model"] = node_config["access_model"]; |
| 188 ["pubsub#publish_model"] = node_config["publish_model"]; | 194 ["pubsub#publish_model"] = node_config["publish_model"]; |
| 189 ["pubsub#deliver_notifications"] = node_config["notify_items"]; | 195 ["pubsub#deliver_notifications"] = node_config["notify_items"]; |
| 190 ["pubsub#notify_delete"] = node_config["notify_delete"]; | 196 ["pubsub#notify_delete"] = node_config["notify_delete"]; |
| 191 ["pubsub#notify_retract"] = node_config["notify_retract"]; | 197 ["pubsub#notify_retract"] = node_config["notify_retract"]; |
| 198 ["pubsub#deliver_payloads"] = node_config["include_payload"] | |
| 192 } | 199 } |
| 193 end | 200 end |
| 194 | 201 |
| 195 local function config_from_xep0060(config, strict) | 202 local function config_from_xep0060(config, strict) |
| 196 local ret = {}; | 203 local ret = {}; |
