Software / code / prosody-modules
Comparison
mod_groups_shell/mod_groups_shell.lua @ 4431:8b69e0b56db2
mod_groups_shell: add an admin shell command for updating bookmarks
| author | Jonas Schäfer <jonas@wielicki.name> |
|---|---|
| date | Fri, 05 Feb 2021 15:45:55 +0100 |
comparison
equal
deleted
inserted
replaced
| 4430:71c495fa03f3 | 4431:8b69e0b56db2 |
|---|---|
| 1 module:set_global() | |
| 2 | |
| 3 local modulemanager = require "core.modulemanager"; | |
| 4 | |
| 5 local shell_env = module:shared("/*/admin_shell/env") | |
| 6 | |
| 7 shell_env.groups = {}; | |
| 8 | |
| 9 function shell_env.groups:sync_group(host, group_id) | |
| 10 local print = self.session.print; | |
| 11 | |
| 12 if not host then | |
| 13 return false, "host not given" | |
| 14 end | |
| 15 | |
| 16 local mod_groups = modulemanager.get_module(host, "groups_internal") | |
| 17 if not mod_groups then | |
| 18 return false, host .. " does not have mod_groups_internal loaded" | |
| 19 end | |
| 20 | |
| 21 if not group_id then | |
| 22 return false, "group id not given" | |
| 23 end | |
| 24 | |
| 25 local ok, err = mod_groups.emit_member_events(group_id) | |
| 26 if ok then | |
| 27 return true, "Synchronised members" | |
| 28 else | |
| 29 return ok, err | |
| 30 end | |
| 31 end |