aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/muc
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
commit783e6e065f4f962542e49d445eb52dfbf36569c4 (patch)
treeb1301e452b307c98aed1de582a3a5ab5c6c51103 /plugins/muc
parent4a83d6a5563fbf4d52940a3ed148e2a37793c772 (diff)
downloadprosody-783e6e065f4f962542e49d445eb52dfbf36569c4.tar.gz
prosody-783e6e065f4f962542e49d445eb52dfbf36569c4.zip
MUC: Handle and return error in role change when granting voice
Diffstat (limited to 'plugins/muc')
-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);