Software /
code /
prosody-modules
Diff
mod_candy/mod_candy.lua @ 2451:56bab95e57f0
mod_candy: If no room list is set, try to find a MUC domain and guess a room name of 'candy'
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 20 Jan 2017 01:25:11 +0100 |
parent | 2450:36ffe9d11132 |
child | 2453:f36a6dcc05ef |
line wrap: on
line diff
--- a/mod_candy/mod_candy.lua Fri Jan 20 01:24:32 2017 +0100 +++ b/mod_candy/mod_candy.lua Fri Jan 20 01:25:11 2017 +0100 @@ -2,6 +2,7 @@ -- Copyright (C) 2013-2017 Kim Alvefur local json_encode = require"util.json".encode; +local get_host_children = require "core.hostmanager".get_children; local is_module_loaded = require "core.modulemanager".is_loaded; local serve = module:depends"http_files".serve; @@ -13,6 +14,13 @@ -- Configured room list, if any return candy_rooms; end + for subdomain in pairs(get_host_children(module.host)) do + -- Attempt autodetect a MUC host + if is_module_loaded(subdomain, "muc") then + return { "candy@" .. subdomain } + end + end + -- Autojoin bookmarks then? -- Check out mod_default_bookmarks return true; end