Software /
code /
prosody
Comparison
plugins/mod_external_services.lua @ 11037:936ee55e1ae3
mod_external_services: Support adding services via items API
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 25 Jul 2020 10:22:37 +0200 |
parent | 11036:79e410cd7f6e |
child | 11038:efefdf71373b |
comparison
equal
deleted
inserted
replaced
11036:79e410cd7f6e | 11037:936ee55e1ae3 |
---|---|
103 origin.send(st.error_reply(stanza, "auth", "forbidden")); | 103 origin.send(st.error_reply(stanza, "auth", "forbidden")); |
104 return true; | 104 return true; |
105 end | 105 end |
106 | 106 |
107 local reply = st.reply(stanza):tag("services", { xmlns = action.attr.xmlns }); | 107 local reply = st.reply(stanza):tag("services", { xmlns = action.attr.xmlns }); |
108 local services = configured_services / prepare; | 108 local extras = module:get_host_items("external_service"); |
109 local services = ( configured_services + extras ) / prepare; | |
109 | 110 |
110 local requested_type = action.attr.type; | 111 local requested_type = action.attr.type; |
111 if requested_type then | 112 if requested_type then |
112 services:filter(function(item) | 113 services:filter(function(item) |
113 return item.type == requested_type; | 114 return item.type == requested_type; |
147 origin.send(st.error_reply(stanza, "auth", "forbidden")); | 148 origin.send(st.error_reply(stanza, "auth", "forbidden")); |
148 return true; | 149 return true; |
149 end | 150 end |
150 | 151 |
151 local reply = st.reply(stanza):tag("credentials", { xmlns = action.attr.xmlns }); | 152 local reply = st.reply(stanza):tag("credentials", { xmlns = action.attr.xmlns }); |
152 local services = configured_services / prepare; | 153 local extras = module:get_host_items("external_service"); |
154 local services = ( configured_services + extras ) / prepare; | |
153 services:filter(function (item) | 155 services:filter(function (item) |
154 return item.restricted; | 156 return item.restricted; |
155 end) | 157 end) |
156 | 158 |
157 local requested_credentials = {}; | 159 local requested_credentials = {}; |