doc/example_pep.lua

changeset 168
7285e04a4797
parent 128
720b9ccd7ea4
child 243
20842f98f9ff
--- a/doc/example_pep.lua	Wed Dec 15 14:56:10 2010 +0000
+++ b/doc/example_pep.lua	Wed Dec 15 14:57:48 2010 +0000
@@ -34,6 +34,7 @@
 -- Catch the "ready" event to know when the stream is ready to use
 c:hook("ready", function ()
 	print("Stream ready!");
+	c:send(verse.presence());
 	c.version:set{ name = "verse example client" };
 	c:publish_pep(verse.stanza("tune", { xmlns = "http://jabber.org/protocol/tune" })
 		:tag("title"):text("Beautiful Cedars"):up()
@@ -45,7 +46,10 @@
 	c:hook_pep("http://jabber.org/protocol/mood", function (event)
 		print(event.from.." is "..event.item.tags[1].name);
 	end);
-	c:send(verse.presence():add_child(c:caps()));
+	
+	c:hook_pep("http://jabber.org/protocol/tune", function (event)
+		print(event.from.." is listening to "..event.item:get_child("title"):get_text());
+	end);
 end);
 
 print("Starting loop...")

mercurial