util/stanza.lua
changeset 10507 e25a1a9a6e7e
parent 10450 5c2d1b13537c
child 10721 05e4645fc9b3
equal deleted inserted replaced
10506:f1c0aa521dd5 10507:e25a1a9a6e7e
   456 	local t = reply(orig);
   456 	local t = reply(orig);
   457 	t.attr.type = "error";
   457 	t.attr.type = "error";
   458 	if t.attr.from == error_by then
   458 	if t.attr.from == error_by then
   459 		error_by = nil;
   459 		error_by = nil;
   460 	end
   460 	end
       
   461 	if type(error_type) == "table" then -- an util.error or similar object
       
   462 		error_type, condition, error_message = error_type.type, error_type.condition, error_type.text;
       
   463 	end
   461 	t:tag("error", {type = error_type, by = error_by}) --COMPAT: Some day xmlns:stanzas goes here
   464 	t:tag("error", {type = error_type, by = error_by}) --COMPAT: Some day xmlns:stanzas goes here
   462 	:tag(condition, xmpp_stanzas_attr):up();
   465 	:tag(condition, xmpp_stanzas_attr):up();
   463 	if error_message then t:text_tag("text", error_message, xmpp_stanzas_attr); end
   466 	if error_message then t:text_tag("text", error_message, xmpp_stanzas_attr); end
   464 	return t; -- stanza ready for adding app-specific errors
   467 	return t; -- stanza ready for adding app-specific errors
   465 end
   468 end