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