Software /
code /
verse
Comparison
plugins/bind.lua @ 197:7e98cf2c1d8d
plugins.*: Use verse.stanza() & co instead of require util.stanza
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 17 Mar 2011 18:33:52 +0100 |
parent | 160:5cbbfe42212e |
child | 245:19356e2150f3 |
comparison
equal
deleted
inserted
replaced
196:eb9d69d3f0b5 | 197:7e98cf2c1d8d |
---|---|
1 local st = require "util.stanza"; | |
2 local xmlns_bind = "urn:ietf:params:xml:ns:xmpp-bind"; | 1 local xmlns_bind = "urn:ietf:params:xml:ns:xmpp-bind"; |
3 | 2 |
4 function verse.plugins.bind(stream) | 3 function verse.plugins.bind(stream) |
5 local function handle_features(features) | 4 local function handle_features(features) |
6 if stream.bound then return; end | 5 if stream.bound then return; end |
7 stream:debug("Binding resource..."); | 6 stream:debug("Binding resource..."); |
8 stream:send_iq(st.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), |
9 function (reply) | 8 function (reply) |
10 if reply.attr.type == "result" then | 9 if reply.attr.type == "result" then |
11 local result_jid = reply | 10 local result_jid = reply |
12 :get_child("bind", xmlns_bind) | 11 :get_child("bind", xmlns_bind) |
13 :get_child("jid") | 12 :get_child("jid") |