diff options
author | Kim Alvefur <zash@zash.se> | 2018-06-01 09:56:22 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-06-01 09:56:22 +0200 |
commit | 9703baeb6f50c7488337ca107315bc1086802c0d (patch) | |
tree | ff58eed42d56da1bef4023bf4259593dc781b7cb /plugins | |
parent | 83d84ee5d9ce7d667ed64c670c067d7a06e05575 (diff) | |
download | prosody-9703baeb6f50c7488337ca107315bc1086802c0d.tar.gz prosody-9703baeb6f50c7488337ca107315bc1086802c0d.zip |
MUC: Add some debug logging for voice requests
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/muc/moderated.lib.lua | 5 | ||||
-rw-r--r-- | plugins/muc/muc.lib.lua | 2 |
2 files changed, 7 insertions, 0 deletions
diff --git a/plugins/muc/moderated.lib.lua b/plugins/muc/moderated.lib.lua index 4ec8686a..74ce3db8 100644 --- a/plugins/muc/moderated.lib.lua +++ b/plugins/muc/moderated.lib.lua @@ -71,21 +71,26 @@ module:hook("muc-voice-response", function(event) local occupant = event.occupant; if occupant.role ~= "moderator" then + module:log("debug", "%s tried to grant voice but wasn't a moderator", jid_resource(occupant.nick)); return; end if not event.fields["muc#request_allow"] then + module:log("debug", "%s did not grant voice", jid_resource(occupant.nick)); return; end if not affected_occupant then + module:log("debug", "%s tried to grant voice to unknown occupant %s", jid_resource(occupant.nick), event.fields["muc#jid"]); return; end if affected_occupant.role ~= "visitor" then + module:log("debug", "%s tried to grant voice to %s but they already have it", jid_resource(occupant.nick), jid_resource(occupant.jid)); 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"); end); diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua index 409d684e..eb6e2257 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -1194,8 +1194,10 @@ function room_mt:handle_message_to_room(origin, stanza) occupant = occupant; }; if occupant.role == "moderator" then + module:log("debug", "%s responded to a voice request in %s", jid_resource(occupant.nick), self.jid); module:fire_event("muc-voice-response", event); else + module:log("debug", "%s requested voice in %s", jid_resource(occupant.nick), self.jid); module:fire_event("muc-voice-request", event); end return true; |