12 :get_child("bind", xmlns_bind) |
12 :get_child("bind", xmlns_bind) |
13 :get_child("jid") |
13 :get_child("jid") |
14 :get_text(); |
14 :get_text(); |
15 stream.username, stream.host, stream.resource = jid.split(result_jid); |
15 stream.username, stream.host, stream.resource = jid.split(result_jid); |
16 stream.jid, stream.bound = result_jid, true; |
16 stream.jid, stream.bound = result_jid, true; |
17 stream:event("bind-success", full_jid); |
17 stream:event("bind-success", { jid = result_jid }); |
18 elseif reply.attr.type == "error" then |
18 elseif reply.attr.type == "error" then |
19 local err = reply:child_with_name("error"); |
19 local err = reply:child_with_name("error"); |
20 local type, condition, text = reply:get_error(); |
20 local type, condition, text = reply:get_error(); |
21 stream:event("bind-failure", { error = condition, text = text, type = type }); |
21 stream:event("bind-failure", { error = condition, text = text, type = type }); |
22 end |
22 end |