# HG changeset patch
# User Matthew Wild <mwild1@gmail.com>
# Date 1264775214 0
# Node ID 3fe3dbb27b6f3e206eea6ac016dde3526cb69833
# Parent  401ff68413a14eba4ead28a0c946e97e5fb41f3b
MUC: Have get_error_condition() use the new stanza:get_error() (muc.lib.lua 11 lines shorter \o/)

diff -r 401ff68413a1 -r 3fe3dbb27b6f plugins/muc/muc.lib.lua
--- a/plugins/muc/muc.lib.lua	Fri Jan 29 14:22:03 2010 +0000
+++ b/plugins/muc/muc.lib.lua	Fri Jan 29 14:26:54 2010 +0000
@@ -59,19 +59,12 @@
 	["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;