aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-01-29 14:26:54 +0000
committerMatthew Wild <mwild1@gmail.com>2010-01-29 14:26:54 +0000
commit119072d7d8a3a5e2c60229786eb746a8e1d04670 (patch)
tree82f89fd2588129a47bf8bd1d05c9649897c325c0
parent35d65ca55b849e4cd36853dbee802fa1b78e7856 (diff)
downloadprosody-119072d7d8a3a5e2c60229786eb746a8e1d04670.tar.gz
prosody-119072d7d8a3a5e2c60229786eb746a8e1d04670.zip
MUC: Have get_error_condition() use the new stanza:get_error() (muc.lib.lua 11 lines shorter \o/)
-rw-r--r--plugins/muc/muc.lib.lua15
1 files changed, 4 insertions, 11 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index f27cf191..896a977f 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -59,19 +59,12 @@ local kickable_error_conditions = {
["service-unavailable"] = true;
["malformed error"] = true;
};
+
local function get_error_condition(stanza)
- for _, tag in ipairs(stanza.tags) do
- if tag.name == "error" and (not(tag.attr.xmlns) or tag.attr.xmlns == "jabber:client") then
- for _, cond in ipairs(tag.tags) do
- if cond.attr.xmlns == "urn:ietf:params:xml:ns:xmpp-stanzas" then
- return cond.name;
- end
- end
- return "malformed error";
- end
- end
- return "malformed error";
+ 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;