# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1527839782 -7200
# Node ID 11176f47a03a66fcb3416784fb90057a7dfcac5d
# Parent  2096742859c13bcbb60db4d2944872d1ef8c0016
MUC: Add some debug logging for voice requests

diff -r 2096742859c1 -r 11176f47a03a plugins/muc/moderated.lib.lua
--- a/plugins/muc/moderated.lib.lua	Fri Jun 01 10:21:54 2018 +0200
+++ b/plugins/muc/moderated.lib.lua	Fri Jun 01 09:56:22 2018 +0200
@@ -71,21 +71,26 @@
 	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 -r 2096742859c1 -r 11176f47a03a plugins/muc/muc.lib.lua
--- a/plugins/muc/muc.lib.lua	Fri Jun 01 10:21:54 2018 +0200
+++ b/plugins/muc/muc.lib.lua	Fri Jun 01 09:56:22 2018 +0200
@@ -1194,8 +1194,10 @@
 					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;