Changeset

15:be4154ed4e3a

util.xstanza: Fix and rename error_from_stanza() -> get_error()
author Matthew Wild <mwild1@gmail.com>
date Mon, 30 Nov 2009 15:52:52 +0000
parents 14:53246b2b933b
children 16:13444ae6e3c4
files libs/xstanza.lua
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libs/xstanza.lua	Sun Nov 29 03:43:24 2009 +0000
+++ b/libs/xstanza.lua	Mon Nov 30 15:52:52 2009 +0000
@@ -1,13 +1,15 @@
 local stanza_mt = getmetatable(require "util.stanza".stanza());
 
-function stanza_mt:error_from_stanza()
+local xmlns_stanzas = "urn:ietf:params:xml:ns:xmpp-stanzas";
+
+function stanza_mt:get_error()
 	local type, condition, text;
 	
-	local error_tag = self:get_child("error", "urn:ietf:params:xml:ns:xmpp-stanzas");
+	local error_tag = self:get_child("error");
 	if not error_tag then
 		return nil, nil;
 	end
-	type = error.attr.type;
+	type = error_tag.attr.type;
 	
 	for child in error_tag:children() do
 		if child.attr.xmlns == xmlns_stanzas then