Software / code / verse
Comparison
doc/example_pep.lua @ 168:7285e04a4797
plugins.pep: Update for new disco/caps code
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Wed, 15 Dec 2010 14:57:48 +0000 |
| parent | 128:720b9ccd7ea4 |
| child | 243:20842f98f9ff |
comparison
equal
deleted
inserted
replaced
| 167:a2ae7a9d360f | 168:7285e04a4797 |
|---|---|
| 32 c:connect_client(jid, password); | 32 c:connect_client(jid, password); |
| 33 | 33 |
| 34 -- Catch the "ready" event to know when the stream is ready to use | 34 -- Catch the "ready" event to know when the stream is ready to use |
| 35 c:hook("ready", function () | 35 c:hook("ready", function () |
| 36 print("Stream ready!"); | 36 print("Stream ready!"); |
| 37 c:send(verse.presence()); | |
| 37 c.version:set{ name = "verse example client" }; | 38 c.version:set{ name = "verse example client" }; |
| 38 c:publish_pep(verse.stanza("tune", { xmlns = "http://jabber.org/protocol/tune" }) | 39 c:publish_pep(verse.stanza("tune", { xmlns = "http://jabber.org/protocol/tune" }) |
| 39 :tag("title"):text("Beautiful Cedars"):up() | 40 :tag("title"):text("Beautiful Cedars"):up() |
| 40 :tag("artist"):text("The Spinners"):up() | 41 :tag("artist"):text("The Spinners"):up() |
| 41 :tag("source"):text("Not Quite Folk"):up() | 42 :tag("source"):text("Not Quite Folk"):up() |
| 43 ); | 44 ); |
| 44 | 45 |
| 45 c:hook_pep("http://jabber.org/protocol/mood", function (event) | 46 c:hook_pep("http://jabber.org/protocol/mood", function (event) |
| 46 print(event.from.." is "..event.item.tags[1].name); | 47 print(event.from.." is "..event.item.tags[1].name); |
| 47 end); | 48 end); |
| 48 c:send(verse.presence():add_child(c:caps())); | 49 |
| 50 c:hook_pep("http://jabber.org/protocol/tune", function (event) | |
| 51 print(event.from.." is listening to "..event.item:get_child("title"):get_text()); | |
| 52 end); | |
| 49 end); | 53 end); |
| 50 | 54 |
| 51 print("Starting loop...") | 55 print("Starting loop...") |
| 52 verse.loop() | 56 verse.loop() |