Software /
code /
prosody
Diff
plugins/muc/moderated.lib.lua @ 8860:0bb46a1bb398
MUC: Handle and return error in role change when granting voice
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 01 Jun 2018 10:26:18 +0200 |
parent | 8859:11176f47a03a |
child | 8865:2a8bbfcb6868 |
line wrap: on
line diff
--- a/plugins/muc/moderated.lib.lua Fri Jun 01 09:56:22 2018 +0200 +++ b/plugins/muc/moderated.lib.lua Fri Jun 01 10:26:18 2018 +0200 @@ -90,8 +90,13 @@ return; end - module:log("debug", "%s granted voice to %s", jid_resource(occupant.nick), jid_resource(occupant.jid)); - event.room:set_role(actor, affected_occupant.nick, "participant", "Voice granted"); + module:log("debug", "%s granted voice to %s", jid_resource(event.occupant.nick), jid_resource(occupant.jid)); + local ok, errtype, err = event.room:set_role(actor, affected_occupant.nick, "participant", "Voice granted"); + + if not ok then + module:log("debug", "Error granting voice: %s", err or errtype); + event.origin.send(st.error_reply(event.stanza, errtype, err)); + end end);