IMPORTANT: due to a drive failure, as of 13-Mar-2021, the Mercurial repository had to be re-mirrored, which changed every commit SHA. The old SHAs and trees are backed up in the vault branches. Please migrate to the new branches as soon as you can.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
prosody/plugins/muc/util.lib.lua

58 lines
1.2 KiB

-- Prosody IM
-- Copyright (C) 2008-2010 Matthew Wild
-- Copyright (C) 2008-2010 Waqas Hussain
-- Copyright (C) 2014 Daurnimator
--
-- This project is MIT/X11 licensed. Please see the
-- COPYING file in the source package for more information.
--
local _M = {};
_M.valid_affiliations = {
outcast = -1;
none = 0;
member = 1;
admin = 2;
owner = 3;
};
_M.valid_roles = {
none = 0;
visitor = 1;
participant = 2;
moderator = 3;
};
local kickable_error_conditions = {
["gone"] = true;
["internal-server-error"] = true;
["item-not-found"] = true;
["jid-malformed"] = true;
["recipient-unavailable"] = true;
["redirect"] = true;
["remote-server-not-found"] = true;
["remote-server-timeout"] = true;
["service-unavailable"] = true;
["malformed error"] = true;
};
function _M.is_kickable_error(stanza)
local cond = select(2, stanza:get_error()) or "malformed error";
return kickable_error_conditions[cond];
end
local muc_x_filters = {
["http://jabber.org/protocol/muc"] = true;
["http://jabber.org/protocol/muc#user"] = true;
}
local function muc_x_filter(tag)
if muc_x_filters[tag.attr.xmlns] then
return nil;
end
return tag;
end
function _M.filter_muc_x(stanza)
return stanza:maptags(muc_x_filter);
end
return _M;