if attr and not attr.id then attr.id = new_id(); end
end
end
local function iq(attr)
if attr and not attr.id then attr.id = new_id(); end
- return stanza("iq", attr or { id = new_id() });
+ return new_stanza("iq", attr or { id = new_id() });
end
local function reply(orig)
end
local function reply(orig)
- return stanza(orig.name, orig.attr and { to = orig.attr.from, from = orig.attr.to, id = orig.attr.id, type = ((orig.name == "iq" and "result") or orig.attr.type) });
+ return new_stanza(orig.name, orig.attr and { to = orig.attr.from, from = orig.attr.to, id = orig.attr.id, type = ((orig.name == "iq" and "result") or orig.attr.type) });
end
local xmpp_stanzas_attr = { xmlns = xmlns_stanzas };
end
local xmpp_stanzas_attr = { xmlns = xmlns_stanzas };
-local function error_reply(orig, type, condition, message)
+local function error_reply(orig, error_type, condition, error_message)
local t = reply(orig);
t.attr.type = "error";
local t = reply(orig);
t.attr.type = "error";
- t:tag("error", {type = type}) --COMPAT: Some day xmlns:stanzas goes here
+ t:tag("error", {type = error_type}) --COMPAT: Some day xmlns:stanzas goes here
:tag(condition, xmpp_stanzas_attr):up();
:tag(condition, xmpp_stanzas_attr):up();
- if (message) then t:tag("text", xmpp_stanzas_attr):text(message):up(); end
+ if error_message then t:tag("text", xmpp_stanzas_attr):text(error_message):up(); end
return t; -- stanza ready for adding app-specific errors
end
local function presence(attr)
return t; -- stanza ready for adding app-specific errors