Mercurial > prosody-modules
comparison mod_srvinjection/mod_srvinjection.lua @ 1324:853a382c9bd6
mod_turncredentials: Advertise the XEP-0215 feature (thanks Gryffus)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 28 Feb 2014 15:36:06 +0100 |
parents | 69f7840923f5 |
children | b21236b6b8d8 |
comparison
equal
deleted
inserted
replaced
1323:c84ff82658cb | 1324:853a382c9bd6 |
---|---|
1 local s = require"util.serialization".new"oneline".serialize; | |
1 | 2 |
2 module:set_global(); | 3 module:set_global(); |
3 | 4 |
4 local adns = require "net.adns"; | 5 local adns = require "net.adns"; |
5 | 6 |
23 end | 24 end |
24 end | 25 end |
25 | 26 |
26 local original_lookup = adns.lookup; | 27 local original_lookup = adns.lookup; |
27 function adns.lookup(handler, qname, qtype, qclass) | 28 function adns.lookup(handler, qname, qtype, qclass) |
29 module:log("debug", "adns.lookup(%s, %s, %s)", s(qname), s(qtype), s(qclass)); | |
28 if qtype == "SRV" then | 30 if qtype == "SRV" then |
29 local host = qname:match("^_xmpp%-server%._tcp%.(.*)%.$"); | 31 local host = qname:match("^_xmpp%-server%._tcp%.(.*)%.$"); |
32 module:log("debug", "qname:match(...) → %s", s(host)); | |
33 local mapping = map[host] or map["*"]; | |
34 module:log("debug", "map[%s] → %s", s(host), s(mapping)); | |
30 local mapping = map[host] or map["*"]; | 35 local mapping = map[host] or map["*"]; |
31 if mapping then | 36 if mapping then |
32 handler(mapping); | 37 handler(mapping); |
33 return; | 38 return; |
34 end | 39 end |