Mercurial > prosody-modules
comparison mod_delegation/mod_delegation.lua @ 1994:f263fcf1b0ed
Merge with Goffi
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 21 Dec 2015 12:24:21 +0100 |
parents | a1d5214bd369 |
children | 107147ca77f7 |
comparison
equal
deleted
inserted
replaced
1987:6d7699eda594 | 1994:f263fcf1b0ed |
---|---|
7 -- This module manage namespace delegation, a way to delegate server features | 7 -- This module manage namespace delegation, a way to delegate server features |
8 -- to an external entity/component. Only the admin mode is implemented so far | 8 -- to an external entity/component. Only the admin mode is implemented so far |
9 | 9 |
10 -- TODO: client mode | 10 -- TODO: client mode |
11 | 11 |
12 local jid = require("util/jid") | 12 local jid = require("util.jid") |
13 local st = require("util/stanza") | 13 local st = require("util.stanza") |
14 local set = require("util/set") | 14 local set = require("util.set") |
15 | 15 |
16 local delegation_session = module:shared("/*/delegation/session") | 16 local delegation_session = module:shared("/*/delegation/session") |
17 | 17 |
18 if delegation_session.connected_cb == nil then | 18 if delegation_session.connected_cb == nil then |
19 -- set used to have connected event listeners | 19 -- set used to have connected event listeners |
263 -- we don't forward stanzas from managing entity itself | 263 -- we don't forward stanzas from managing entity itself |
264 return | 264 return |
265 end | 265 end |
266 if ns_data.filtering then | 266 if ns_data.filtering then |
267 local first_child = stanza.tags[1] | 267 local first_child = stanza.tags[1] |
268 for _, attribute in ns_data.filtering do | 268 for _, attribute in pairs(ns_data.filtering) do |
269 -- if any filtered attribute if not present, | 269 -- if any filtered attribute if not present, |
270 -- we must continue the normal bahaviour | 270 -- we must continue the normal bahaviour |
271 if not first_child.attr[attribute] then | 271 if not first_child.attr[attribute] then |
272 -- Filtered attribute is not present, we do normal workflow | 272 -- Filtered attribute is not present, we do normal workflow |
273 return; | 273 return; |