2 -- Copyright (C) 2008-2010 Matthew Wild
3 -- Copyright (C) 2008-2010 Waqas Hussain
4 -- Copyright (C) 2014 Daurnimator
6 -- This project is MIT/X11 licensed. Please see the
7 -- COPYING file in the source package for more information.
12 _M
.valid_affiliations
= {
27 local kickable_error_conditions
= {
29 ["internal-server-error"] = true;
30 ["item-not-found"] = true;
31 ["jid-malformed"] = true;
32 ["recipient-unavailable"] = true;
34 ["remote-server-not-found"] = true;
35 ["remote-server-timeout"] = true;
36 ["service-unavailable"] = true;
37 ["malformed error"] = true;
39 function _M
.is_kickable_error(stanza
)
40 local cond
= select(2, stanza
:get_error()) or "malformed error";
41 return kickable_error_conditions
[cond
];
44 local muc_x_filters
= {
45 ["http://jabber.org/protocol/muc"] = true;
46 ["http://jabber.org/protocol/muc#user"] = true;
48 local function muc_x_filter(tag)
49 if muc_x_filters
[tag.attr
.xmlns
] then
54 function _M
.filter_muc_x(stanza
)
55 return stanza
:maptags(muc_x_filter
);
58 function _M
.only_with_min_role(role
)
59 local min_role_value
= _M
.valid_roles
[role
];
60 return function (nick
, occupant
) --luacheck: ignore 212/nick
61 if _M
.valid_roles
[occupant
.role
or "none"] >= min_role_value
then