Diff

util/stanza.lua @ 373:dd0345edeaf4

Add helper function for adding message bodies to stanzas
author Matthew Wild <mwild1@gmail.com>
date Sat, 22 Nov 2008 19:07:41 +0000
parent 338:804f5e62a41f
child 519:cccd610a0ef9
line wrap: on
line diff
--- a/util/stanza.lua	Fri Nov 21 05:59:03 2008 +0000
+++ b/util/stanza.lua	Sat Nov 22 19:07:41 2008 +0000
@@ -30,6 +30,11 @@
 function stanza_mt:query(xmlns)
 	return self:tag("query", { xmlns = xmlns });
 end
+
+function stanza_mt:body(text, attr)
+	return self:tag("body", attr):text(text);
+end
+
 function stanza_mt:tag(name, attrs)
 	local s = stanza(name, attrs);
 	(self.last_add[#self.last_add] or self):add_direct_child(s);