aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/muc/moderated.lib.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-06-01 10:26:18 +0200
committerKim Alvefur <zash@zash.se>2018-06-01 10:26:18 +0200
commit740a38cafe15d76c52aca1dffb8899676fbdc392 (patch)
treeb1301e452b307c98aed1de582a3a5ab5c6c51103 /plugins/muc/moderated.lib.lua
parent9703baeb6f50c7488337ca107315bc1086802c0d (diff)
downloadprosody-740a38cafe15d76c52aca1dffb8899676fbdc392.tar.gz
prosody-740a38cafe15d76c52aca1dffb8899676fbdc392.zip
MUC: Handle and return error in role change when granting voice
Diffstat (limited to 'plugins/muc/moderated.lib.lua')
-rw-r--r--plugins/muc/moderated.lib.lua9
1 files changed, 7 insertions, 2 deletions
diff --git a/plugins/muc/moderated.lib.lua b/plugins/muc/moderated.lib.lua
index 74ce3db8..6e82c71f 100644
--- a/plugins/muc/moderated.lib.lua
+++ b/plugins/muc/moderated.lib.lua
@@ -90,8 +90,13 @@ module:hook("muc-voice-response", function(event)
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);