Mercurial > prosody-modules
comparison mod_turncredentials/mod_turncredentials.lua @ 1171:a18effacd384
mod_turncredentials: No need to check tag name, we're already in the event handler for the 'services' tag
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 28 Aug 2013 10:37:23 +0100 |
parents | 6695c3098025 |
children | 853a382c9bd6 |
comparison
equal
deleted
inserted
replaced
1170:6695c3098025 | 1171:a18effacd384 |
---|---|
15 return; | 15 return; |
16 end | 16 end |
17 | 17 |
18 module:hook("iq-get/host/urn:xmpp:extdisco:1:services", function(event) | 18 module:hook("iq-get/host/urn:xmpp:extdisco:1:services", function(event) |
19 local origin, stanza = event.origin, event.stanza; | 19 local origin, stanza = event.origin, event.stanza; |
20 if stanza.tags[1].name ~= "services" or origin.type ~= "c2s" then | 20 if origin.type ~= "c2s" then |
21 return; | 21 return; |
22 end | 22 end |
23 local now = os_time() + ttl; | 23 local now = os_time() + ttl; |
24 local userpart = tostring(now); | 24 local userpart = tostring(now); |
25 local nonce = base64.encode(hmac_sha1(secret, tostring(userpart), false)); | 25 local nonce = base64.encode(hmac_sha1(secret, tostring(userpart), false)); |