12 stream:send_iq(verse.iq({ type = "set" }):tag("session", {xmlns=xmlns_session}), |
12 stream:send_iq(verse.iq({ type = "set" }):tag("session", {xmlns=xmlns_session}), |
13 function (reply) |
13 function (reply) |
14 if reply.attr.type == "result" then |
14 if reply.attr.type == "result" then |
15 stream:event("session-success"); |
15 stream:event("session-success"); |
16 elseif reply.attr.type == "error" then |
16 elseif reply.attr.type == "error" then |
17 local err = reply:child_with_name("error"); |
|
18 local type, condition, text = reply:get_error(); |
17 local type, condition, text = reply:get_error(); |
19 stream:event("session-failure", { error = condition, text = text, type = type }); |
18 stream:event("session-failure", { error = condition, text = text, type = type }); |
20 end |
19 end |
21 end); |
20 end); |
22 return true; |
21 return true; |