Changeset

8854:5cd7813d4e94

MUC: Split out the nickname from the full room JID in voice request from
author Kim Alvefur <zash@zash.se>
date Sat, 21 Oct 2017 21:24:07 +0200
parents 8853:f84f566dea58
children 8855:dba528970aa5
files plugins/muc/moderated.lib.lua
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/muc/moderated.lib.lua	Fri Oct 20 05:45:40 2017 +0200
+++ b/plugins/muc/moderated.lib.lua	Sat Oct 21 21:24:07 2017 +0200
@@ -8,6 +8,7 @@
 --
 
 local st = require "util.stanza";
+local jid_resource = require "util.jid".resource;
 
 local function get_moderated(room)
 	return room._data.moderated;
@@ -50,9 +51,10 @@
 module:hook("muc-voice-request", function(event)
 	if event.occupant.role == "visitor" then
 		local form = event.room:get_voice_form_layout()
+		local nick = jid_resource(event.occupant.nick);
 		local formdata = {
 			["muc#jid"] = event.stanza.attr.from;
-			["muc#roomnick"] = event.occupant.nick;
+			["muc#roomnick"] = nick;
 		};
 
 		local message = st.message({ type = "normal"; from = event.room.jid }):add_child(form:form(formdata)):up();