Software /
code /
prosody
Changeset
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 |
parents | 8859:11176f47a03a |
children | 8861:2a48255f889b |
files | plugins/muc/moderated.lib.lua |
diffstat | 1 files changed, 7 insertions(+), 2 deletions(-) [+] |
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);