scansion/objects/client.lua

changeset 17
610917f3ea97
parent 16
59f176aa3465
child 20
cd1fc52f1b26
equal deleted inserted replaced
16:59f176aa3465 17:610917f3ea97
41 41
42 connects = function (client) 42 connects = function (client)
43 local wait, done = async.waiter(); 43 local wait, done = async.waiter();
44 client.stream:hook("ready", function () print"aha" done() end); 44 client.stream:hook("ready", function () print"aha" done() end);
45 client.stream:connect_client(client.jid, client.password); 45 client.stream:connect_client(client.jid, client.password);
46 print("waiting")
47 wait(); 46 wait();
48 client.full_jid = client.stream.jid; 47 client.full_jid = client.stream.jid;
49 end; 48 end;
50 49
51 sends = function (client, data) 50 sends = function (client, data)
65 expected_stanza = nil; 64 expected_stanza = nil;
66 end 65 end
67 client.stream:hook("stanza", stanza_handler, 100); 66 client.stream:hook("stanza", stanza_handler, 100);
68 verse.add_task(stanza_timeout, function () 67 verse.add_task(stanza_timeout, function ()
69 if not expected_stanza then return; end 68 if not expected_stanza then return; end
69 print("TIMEOUT")
70 end); 70 end);
71 end; 71 end;
72 72
73 disconnects = function (client) 73 disconnects = function (client)
74 end; 74 end;

mercurial