7 stream:send_iq(verse.iq({ type = "set" }):tag("bind", {xmlns=xmlns_bind}):tag("resource"):text(stream.resource), |
7 stream:send_iq(verse.iq({ type = "set" }):tag("bind", {xmlns=xmlns_bind}):tag("resource"):text(stream.resource), |
8 function (reply) |
8 function (reply) |
9 if reply.attr.type == "result" then |
9 if reply.attr.type == "result" then |
10 local result_jid = reply |
10 local result_jid = reply |
11 :get_child("bind", xmlns_bind) |
11 :get_child("bind", xmlns_bind) |
12 :get_child("jid") |
12 :get_child_text("jid"); |
13 :get_text(); |
|
14 stream.username, stream.host, stream.resource = jid.split(result_jid); |
13 stream.username, stream.host, stream.resource = jid.split(result_jid); |
15 stream.jid, stream.bound = result_jid, true; |
14 stream.jid, stream.bound = result_jid, true; |
16 stream:event("bind-success", { jid = result_jid }); |
15 stream:event("bind-success", { jid = result_jid }); |
17 elseif reply.attr.type == "error" then |
16 elseif reply.attr.type == "error" then |
18 local err = reply:child_with_name("error"); |
17 local err = reply:child_with_name("error"); |