aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/muc
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2014-03-19 13:59:59 -0400
committerdaurnimator <quae@daurnimator.com>2014-03-19 13:59:59 -0400
commit37e1117b7809b10db45ecbd2e9eb3cfa957ec652 (patch)
tree6def91f30569d0806689d089cf2829394bb8724f /plugins/muc
parentcda8656a4e20360af37c389a3751625b528259ff (diff)
downloadprosody-37e1117b7809b10db45ecbd2e9eb3cfa957ec652.tar.gz
prosody-37e1117b7809b10db45ecbd2e9eb3cfa957ec652.zip
plugins/muc/muc.lib: Tidy up is_kickable_error: it didn't need to return the condition.
Also removes `get_error_condition`; it was a one liner used in one place
Diffstat (limited to 'plugins/muc')
-rw-r--r--plugins/muc/muc.lib.lua44
1 files changed, 19 insertions, 25 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index f3d69f8d..2d45f17e 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -27,7 +27,6 @@ local md5 = require "util.hashes".md5;
local default_history_length, max_history_length = 20, math.huge;
-------------
local presence_filters = {["http://jabber.org/protocol/muc"]=true;["http://jabber.org/protocol/muc#user"]=true};
local function presence_filter(tag)
if presence_filters[tag.attr.xmlns] then
@@ -35,33 +34,28 @@ local function presence_filter(tag)
end
return tag;
end
-
local function get_filtered_presence(stanza)
return st.clone(stanza):maptags(presence_filter);
end
-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;
-};
-
-local function get_error_condition(stanza)
- local _, condition = stanza:get_error();
- return condition or "malformed error";
-end
-
-local function is_kickable_error(stanza)
- local cond = get_error_condition(stanza);
- return kickable_error_conditions[cond] and cond;
-end
------------
+
+local is_kickable_error do
+ 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 is_kickable_error(stanza)
+ local cond = select(2, stanza:get_error()) or "malformed error";
+ return kickable_error_conditions[cond];
+ end
+end
local room_mt = {};
room_mt.__index = room_mt;