Software /
code /
verse
Comparison
doc/example.lua @ 77:7af3e57501c2
doc/example.lua: Update to use 'ready' event
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 30 May 2010 02:49:58 +0100 |
parent | 58:f9d025fde8dc |
child | 108:c67ed3fc5571 |
comparison
equal
deleted
inserted
replaced
76:927167321283 | 77:7af3e57501c2 |
---|---|
28 c:hook("disconnected", function () print("Disconnected!"); os.exit(); end); | 28 c:hook("disconnected", function () print("Disconnected!"); os.exit(); end); |
29 | 29 |
30 -- Now, actually start the connection: | 30 -- Now, actually start the connection: |
31 c:connect_client(jid, password); | 31 c:connect_client(jid, password); |
32 | 32 |
33 -- Catch binding-success which is (currently) how you know when a stream is ready | 33 -- Catch the "ready" event to know when the stream is ready to use |
34 c:hook("binding-success", function () | 34 c:hook("ready", function () |
35 print("Stream ready!"); | 35 print("Stream ready!"); |
36 c.version:set{ name = "verse example client" }; | 36 c.version:set{ name = "verse example client" }; |
37 c:query_version(c.jid, function (v) print("I am using "..(v.name or "<unknown>")); end); | 37 c:query_version(c.jid, function (v) print("I am using "..(v.name or "<unknown>")); end); |
38 end); | 38 end); |
39 | 39 |