Mercurial > prosody-hg
comparison plugins/muc/util.lib.lua @ 11200:bf8f2da84007
Merge 0.11->trunk
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 05 Nov 2020 22:31:25 +0100 |
| parents | 38159b9adf9f |
| children |
comparison
equal
deleted
inserted
replaced
| 11199:6c7c50a4de32 | 11200:bf8f2da84007 |
|---|---|
| 39 function _M.is_kickable_error(stanza) | 39 function _M.is_kickable_error(stanza) |
| 40 local cond = select(2, stanza:get_error()) or "malformed error"; | 40 local cond = select(2, stanza:get_error()) or "malformed error"; |
| 41 return kickable_error_conditions[cond]; | 41 return kickable_error_conditions[cond]; |
| 42 end | 42 end |
| 43 | 43 |
| 44 local muc_x_filters = { | 44 local filtered_namespaces = module:shared("filtered-namespaces"); |
| 45 ["http://jabber.org/protocol/muc"] = true; | 45 filtered_namespaces["http://jabber.org/protocol/muc"] = true; |
| 46 ["http://jabber.org/protocol/muc#user"] = true; | 46 filtered_namespaces["http://jabber.org/protocol/muc#user"] = true; |
| 47 } | 47 |
| 48 local function muc_x_filter(tag) | 48 local function muc_ns_filter(tag) |
| 49 if muc_x_filters[tag.attr.xmlns] then | 49 if filtered_namespaces[tag.attr.xmlns] then |
| 50 return nil; | 50 return nil; |
| 51 end | 51 end |
| 52 return tag; | 52 return tag; |
| 53 end | 53 end |
| 54 function _M.filter_muc_x(stanza) | 54 function _M.filter_muc_x(stanza) |
| 55 return stanza:maptags(muc_x_filter); | 55 return stanza:maptags(muc_ns_filter); |
| 56 end | |
| 57 | |
| 58 function _M.add_filtered_namespace(xmlns) | |
| 59 filtered_namespaces[xmlns] = true; | |
| 56 end | 60 end |
| 57 | 61 |
| 58 function _M.only_with_min_role(role) | 62 function _M.only_with_min_role(role) |
| 59 local min_role_value = _M.valid_roles[role]; | 63 local min_role_value = _M.valid_roles[role]; |
| 60 return function (nick, occupant) --luacheck: ignore 212/nick | 64 return function (nick, occupant) --luacheck: ignore 212/nick |
