Mercurial > prosody-hg
comparison plugins/mod_pubsub/pubsub.lib.lua @ 9096:7de4eec02ece
mod_pubsub: Add access model to configuration form
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sat, 04 Aug 2018 03:38:38 +0200 |
| parents | 00d89430d77e |
| children | f3a1ecc46f20 |
comparison
equal
deleted
inserted
replaced
| 9095:5639dc1a3f85 | 9096:7de4eec02ece |
|---|---|
| 46 ["pubsub#title"] = node_config["title"]; | 46 ["pubsub#title"] = node_config["title"]; |
| 47 ["pubsub#description"] = node_config["description"]; | 47 ["pubsub#description"] = node_config["description"]; |
| 48 ["pubsub#max_items"] = tostring(node_config["max_items"]); | 48 ["pubsub#max_items"] = tostring(node_config["max_items"]); |
| 49 ["pubsub#persist_items"] = node_config["persist_items"]; | 49 ["pubsub#persist_items"] = node_config["persist_items"]; |
| 50 ["pubsub#notification_type"] = node_config["notification_type"]; | 50 ["pubsub#notification_type"] = node_config["notification_type"]; |
| 51 ["pubsub#access_model"] = node_config["access_model"]; | |
| 51 } | 52 } |
| 52 end | 53 end |
| 53 | 54 |
| 54 local function config_from_xep0060(config) | 55 local function config_from_xep0060(config) |
| 55 return { | 56 return { |
| 56 ["title"] = config["pubsub#title"]; | 57 ["title"] = config["pubsub#title"]; |
| 57 ["description"] = config["pubsub#description"]; | 58 ["description"] = config["pubsub#description"]; |
| 58 ["max_items"] = tonumber(config["pubsub#max_items"]); | 59 ["max_items"] = tonumber(config["pubsub#max_items"]); |
| 59 ["persist_items"] = config["pubsub#persist_items"]; | 60 ["persist_items"] = config["pubsub#persist_items"]; |
| 60 ["notification_type"] = config["pubsub#notification_type"]; | 61 ["notification_type"] = config["pubsub#notification_type"]; |
| 62 ["access_model"] = config["pubsub#access_model"]; | |
| 61 } | 63 } |
| 62 end | 64 end |
| 63 | 65 |
| 64 local node_config_form = dataform { | 66 local node_config_form = dataform { |
| 65 { | 67 { |
| 84 }; | 86 }; |
| 85 { | 87 { |
| 86 type = "boolean"; | 88 type = "boolean"; |
| 87 name = "pubsub#persist_items"; | 89 name = "pubsub#persist_items"; |
| 88 label = "Persist items to storage"; | 90 label = "Persist items to storage"; |
| 91 }; | |
| 92 { | |
| 93 type = "list-single"; | |
| 94 name = "pubsub#access_model"; | |
| 95 label = "Specify the subscriber model"; | |
| 96 options = { | |
| 97 { value = "authorize" }, | |
| 98 { value = "open" }, | |
| 99 { value = "presence" }, | |
| 100 { value = "roster" }, | |
| 101 { value = "whitelist" }, | |
| 102 }; | |
| 89 }; | 103 }; |
| 90 { | 104 { |
| 91 type = "list-single"; | 105 type = "list-single"; |
| 92 name = "pubsub#notification_type"; | 106 name = "pubsub#notification_type"; |
| 93 label = "Specify the delivery style for notifications"; | 107 label = "Specify the delivery style for notifications"; |
