Comparison

plugins/mod_saslauth.lua @ 6302:76699a0ae4c4

mod_lastactivity, mod_legacyauth, mod_presence, mod_saslauth, mod_tls: Use the newer stanza:get_child APIs and optimize away some table lookups
author Kim Alvefur <zash@zash.se>
date Fri, 04 Jul 2014 22:52:34 +0200
parent 6038:b3ceb7627e27
child 6424:89c42aff8510
comparison
equal deleted inserted replaced
6301:2fdd71b08126 6302:76699a0ae4c4
282 module:hook("iq/self/urn:ietf:params:xml:ns:xmpp-bind:bind", function(event) 282 module:hook("iq/self/urn:ietf:params:xml:ns:xmpp-bind:bind", function(event)
283 local origin, stanza = event.origin, event.stanza; 283 local origin, stanza = event.origin, event.stanza;
284 local resource; 284 local resource;
285 if stanza.attr.type == "set" then 285 if stanza.attr.type == "set" then
286 local bind = stanza.tags[1]; 286 local bind = stanza.tags[1];
287 resource = bind:child_with_name("resource"); 287 resource = bind:get_child("resource");
288 resource = resource and #resource.tags == 0 and resource[1] or nil; 288 resource = resource and #resource.tags == 0 and resource[1] or nil;
289 end 289 end
290 local success, err_type, err, err_msg = sm_bind_resource(origin, resource); 290 local success, err_type, err, err_msg = sm_bind_resource(origin, resource);
291 if success then 291 if success then
292 origin.send(st.reply(stanza) 292 origin.send(st.reply(stanza)