Software / code / verse
Comparison
plugins/bind.lua @ 457:73d4eb93657b
Update to use util.id for random ids instead of counters (thanks Zash)
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 16 Mar 2023 11:41:52 +0000 |
| parent | 300:b1d50f9a04c7 |
| child | 490:6b2f31da9610 |
comparison
equal
deleted
inserted
replaced
| 456:6a65142052c8 | 457:73d4eb93657b |
|---|---|
| 5 | 5 |
| 6 function verse.plugins.bind(stream) | 6 function verse.plugins.bind(stream) |
| 7 local function handle_features(features) | 7 local function handle_features(features) |
| 8 if stream.bound then return; end | 8 if stream.bound then return; end |
| 9 stream:debug("Binding resource..."); | 9 stream:debug("Binding resource..."); |
| 10 stream:send_iq(verse.iq({ type = "set" }):tag("bind", {xmlns=xmlns_bind}):tag("resource"):text(stream.resource), | 10 stream:send_iq(verse.iq({ id="bind",type = "set" }):tag("bind", {xmlns=xmlns_bind}):tag("resource"):text(stream.resource), |
| 11 function (reply) | 11 function (reply) |
| 12 if reply.attr.type == "result" then | 12 if reply.attr.type == "result" then |
| 13 local result_jid = reply | 13 local result_jid = reply |
| 14 :get_child("bind", xmlns_bind) | 14 :get_child("bind", xmlns_bind) |
| 15 :get_child_text("jid"); | 15 :get_child_text("jid"); |