Changeset

151:75016d851648

doc/example_component.lua: Add code to echo stanzas
author Matthew Wild <mwild1@gmail.com>
date Tue, 09 Nov 2010 19:59:02 +0000
parents 150:728cc7f2f0c2
children 152:55ea7ffafd7f
files doc/example_component.lua
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/doc/example_component.lua	Tue Nov 09 19:57:52 2010 +0000
+++ b/doc/example_component.lua	Tue Nov 09 19:59:02 2010 +0000
@@ -33,5 +33,11 @@
 	c.version:set{ name = "verse example component" };
 end);
 
+-- Echo, echo, echo, echo...
+c:hook("stanza", function (stanza)
+	stanza.attr.from, stanza.attr.to = stanza.attr.to, stanza.attr.from;
+	c:send(stanza);
+end)
+
 print("Starting loop...")
 verse.loop()