Software / code / prosody
Comparison
plugins/mod_admin_telnet.lua @ 10658:52c6dfa04dba
mod_admin_telnet: Fix host selection filter, fixes loading on components
get_hosts_with_module(a component, mod) would still filter out
components since they don't have type="component" instead of "local"
Introduced in 4d3549e64489
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sat, 22 Feb 2020 18:32:50 +0100 |
| parent | 10657:197ba9539390 |
| child | 10663:fd651ba2317f |
comparison
equal
deleted
inserted
replaced
| 10657:197ba9539390 | 10658:52c6dfa04dba |
|---|---|
| 383 -- Hosts with a module or all virtualhosts if no module given | 383 -- Hosts with a module or all virtualhosts if no module given |
| 384 -- matching modules_enabled in the global section | 384 -- matching modules_enabled in the global section |
| 385 local function get_hosts_with_module(hosts, module) | 385 local function get_hosts_with_module(hosts, module) |
| 386 local hosts_set = get_hosts_set(hosts) | 386 local hosts_set = get_hosts_set(hosts) |
| 387 / function (host) | 387 / function (host) |
| 388 if prosody.hosts[host].type == "local" or module and modulemanager.is_loaded(host, module) then | 388 if module then |
| 389 return host; | 389 -- Module given, filter in hosts with this module loaded |
| 390 if modulemanager.is_loaded(host, module) then | |
| 391 return host; | |
| 392 else | |
| 393 return nil; | |
| 394 end | |
| 395 end | |
| 396 if not hosts then | |
| 397 -- No hosts given, filter in VirtualHosts | |
| 398 if prosody.hosts[host].type == "local" then | |
| 399 return host; | |
| 400 else | |
| 401 return nil | |
| 402 end | |
| 390 end; | 403 end; |
| 391 return nil; | 404 -- No module given, but hosts are, don't filter at all |
| 405 return host; | |
| 392 end; | 406 end; |
| 393 if module and modulemanager.get_module("*", module) then | 407 if module and modulemanager.get_module("*", module) then |
| 394 hosts_set:add("*"); | 408 hosts_set:add("*"); |
| 395 end | 409 end |
| 396 return hosts_set; | 410 return hosts_set; |