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 |