Comparison

mod_muc_members_json/mod_muc_members_json.lua @ 5587:dd4df71166ea

mod_muc_members_json: Set imported hats to active by default
author Matthew Wild <mwild1@gmail.com>
date Fri, 07 Jul 2023 02:02:09 +0100
parent 5586:30b9f78b5058
child 5680:80abda15a1e9
comparison
equal deleted inserted replaced
5586:30b9f78b5058 5587:dd4df71166ea
34 local function get_hats(member_info, muc_config) 34 local function get_hats(member_info, muc_config)
35 local hats = {}; 35 local hats = {};
36 if muc_config.member_hat then 36 if muc_config.member_hat then
37 hats[muc_config.member_hat.id] = { 37 hats[muc_config.member_hat.id] = {
38 title = muc_config.member_hat.title; 38 title = muc_config.member_hat.title;
39 active = true;
39 }; 40 };
40 end 41 end
41 if muc_config.team_hats and member_info.roles then 42 if muc_config.team_hats and member_info.roles then
42 for _, role in ipairs(member_info.roles) do 43 for _, role in ipairs(member_info.roles) do
43 local hat = muc_config.team_hats[role]; 44 local hat = muc_config.team_hats[role];
44 if hat then 45 if hat then
45 hats[hat.id] = { 46 hats[hat.id] = {
46 title = hat.title; 47 title = hat.title;
48 active = true;
47 }; 49 };
48 end 50 end
49 end 51 end
50 end 52 end
51 return hats; 53 return hats;