aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/muc/moderated.lib.lua
diff options
context:
space:
mode:
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);