Software /
code /
prosody
Comparison
plugins/muc/muc.lib.lua @ 7396:71a7140200fc
MUC: Return item-not-found as error when attempting to change role of non-existant occupant
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 19 Apr 2016 18:43:15 +0200 |
parent | 7386:5a9af30d5737 |
child | 7397:e49737de9872 |
comparison
equal
deleted
inserted
replaced
7395:97fe648176ab | 7396:71a7140200fc |
---|---|
1182 | 1182 |
1183 function room_mt:set_role(actor, occupant_jid, role, reason) | 1183 function room_mt:set_role(actor, occupant_jid, role, reason) |
1184 if not actor then return nil, "modify", "not-acceptable"; end | 1184 if not actor then return nil, "modify", "not-acceptable"; end |
1185 | 1185 |
1186 local occupant = self:get_occupant_by_nick(occupant_jid); | 1186 local occupant = self:get_occupant_by_nick(occupant_jid); |
1187 if not occupant then return nil, "modify", "not-acceptable"; end | 1187 if not occupant then return nil, "modify", "item-not-found"; end |
1188 | 1188 |
1189 if valid_roles[role or "none"] == nil then | 1189 if valid_roles[role or "none"] == nil then |
1190 return nil, "modify", "not-acceptable"; | 1190 return nil, "modify", "not-acceptable"; |
1191 end | 1191 end |
1192 role = role ~= "none" and role or nil; -- coerces `role == false` to `nil` | 1192 role = role ~= "none" and role or nil; -- coerces `role == false` to `nil` |