# HG changeset patch # User Kim Alvefur # Date 1508613847 -7200 # Node ID 5cd7813d4e949cffb69780c326213a2f10bf770a # Parent f84f566dea58631ca32795ebbecc29d2aeb4a0c5 MUC: Split out the nickname from the full room JID in voice request from diff -r f84f566dea58 -r 5cd7813d4e94 plugins/muc/moderated.lib.lua --- 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();