Mercurial > prosody-modules
comparison mod_srvinjection/mod_srvinjection.lua @ 1248:69f7840923f5
mod_srvinjection: Make the map a shared table so that other plugins can use/modify it
author | daurnimator <quae@daurnimator.com> |
---|---|
date | Tue, 10 Dec 2013 23:15:15 +0000 |
parents | b3d130e4b3ae |
children | 853a382c9bd6 |
comparison
equal
deleted
inserted
replaced
1247:34fbe58d19da | 1248:69f7840923f5 |
---|---|
1 | 1 |
2 module:set_global(); | 2 module:set_global(); |
3 | 3 |
4 local adns = require "net.adns"; | 4 local adns = require "net.adns"; |
5 | 5 |
6 local map = module:get_option("srvinjection") or {}; | 6 local map_config = module:get_option("srvinjection") or {}; |
7 local map = module:shared "s2s_map" | |
7 | 8 |
8 for host, mapping in pairs(map) do | 9 for host, mapping in pairs(map_config) do |
9 if type(mapping) == "table" and type(mapping[1]) == "string" and (type(mapping[2]) == "number") then | 10 if type(mapping) == "table" and type(mapping[1]) == "string" and (type(mapping[2]) == "number") then |
10 local connecthost, connectport = mapping[1], mapping[2] or 5269; | 11 local connecthost, connectport = mapping[1], mapping[2] or 5269; |
11 map[host] = {{ | 12 map[host] = {{ |
12 srv = { | 13 srv = { |
13 target = connecthost.."."; | 14 target = connecthost.."."; |