Comparison

mod_groups_internal/mod_groups_internal.lua @ 4415:c7424b96c75e

mod_groups_internal: maintain the name of the associated MUC
author Jonas Schäfer <jonas@wielicki.name>
date Sat, 30 Jan 2021 16:25:12 +0100
parent 4407:105586ca9a79
child 4417:7e379ccb8ed6
comparison
equal deleted inserted replaced
4414:dbfa830e4504 4415:c7424b96c75e
107 room:set_persistent(true) 107 room:set_persistent(true)
108 room:set_members_only(true) 108 room:set_members_only(true)
109 room:set_allow_member_invites(false) 109 room:set_allow_member_invites(false)
110 room:set_moderated(false) 110 room:set_moderated(false)
111 room:set_whois("anyone") 111 room:set_whois("anyone")
112 room:set_name(group_info.name)
112 end 113 end
113 114
114 local ok = group_info_store:set(group_id, { 115 local ok = group_info_store:set(group_id, {
115 name = group_info.name; 116 name = group_info.name;
116 muc_jid = muc_jid; 117 muc_jid = muc_jid;
134 return nil, "bad-request" 135 return nil, "bad-request"
135 end 136 end
136 137
137 if not info.name or #info.name == 0 then 138 if not info.name or #info.name == 0 then
138 return nil, "bad-request" 139 return nil, "bad-request"
140 end
141
142 -- TODO: we should probably prohibit changing/removing the MUC JID of
143 -- an existing group.
144 if info.muc_jid then
145 room = muc_host.get_room_from_jid(info.muc_jid);
146 room:set_name(info.name);
139 end 147 end
140 148
141 local ok = group_info_store:set(group_id, info); 149 local ok = group_info_store:set(group_id, info);
142 if not ok then 150 if not ok then
143 return nil, "internal-server-error"; 151 return nil, "internal-server-error";