scansion/objects/client.lua

changeset 24
3c572d238d9e
parent 23
af7a51d78b7b
child 25
9f8166238993
equal deleted inserted replaced
23:af7a51d78b7b 24:3c572d238d9e
46 wait(); 46 wait();
47 client.full_jid = client.stream.jid; 47 client.full_jid = client.stream.jid;
48 end; 48 end;
49 49
50 sends = function (client, data) 50 sends = function (client, data)
51 local stanza = fill_vars(client.script, parse_xml(table.concat(data))); 51 local stanza = fill_vars(client.script, assert(parse_xml((table.concat(data):gsub("\t", " ")))));
52 client.stream:send(stanza); 52 client.stream:send(stanza);
53 end; 53 end;
54 54
55 receives = function (client, data) 55 receives = function (client, data)
56 local expected_stanza = fill_vars(client.script, parse_xml(table.concat(data))); 56 local expected_stanza = fill_vars(client.script, assert(parse_xml((table.concat(data):gsub("\t", " ")))));
57 local function stanza_handler(received_stanza) 57 local function stanza_handler(received_stanza)
58 if not stanzacmp.stanzas_match(expected_stanza, received_stanza) then 58 if not stanzacmp.stanzas_match(expected_stanza, received_stanza) then
59 verse.quit(); 59 verse.quit();
60 client.log("NOT IT!") 60 client.log("NOT IT!")
61 client.log("Expected: %s", expected_stanza); 61 client.log("Expected: %s", expected_stanza);

mercurial