aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/muc/util.lib.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2015-03-27 22:24:57 +0000
committerMatthew Wild <mwild1@gmail.com>2015-03-27 22:24:57 +0000
commit315e3b3b937c22224c4530a194420f1b2fd77316 (patch)
treef7d0930c79494da535857eaf4f2a976bb052fa35 /plugins/muc/util.lib.lua
parent2f531bc782386106af9c8f297594a13c81ae660c (diff)
parent847f4204accf62ae15f623698c4842b08440a2cd (diff)
downloadprosody-315e3b3b937c22224c4530a194420f1b2fd77316.tar.gz
prosody-315e3b3b937c22224c4530a194420f1b2fd77316.zip
Merge 0.10->trunk
Diffstat (limited to 'plugins/muc/util.lib.lua')
-rw-r--r--plugins/muc/util.lib.lua58
1 files changed, 58 insertions, 0 deletions
diff --git a/plugins/muc/util.lib.lua b/plugins/muc/util.lib.lua
new file mode 100644
index 00000000..16deb543
--- /dev/null
+++ b/plugins/muc/util.lib.lua
@@ -0,0 +1,58 @@
+-- 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;