# HG changeset patch # User Kim Alvefur # Date 1531016274 -7200 # Node ID 8c4dd4375823daf829492de85ef3f22a3245190e # Parent 2df7dc99566ab564448f3565dd326e93d03768a7 MUC/password: Set room password on creation if included in join stanza This fixes room creation/joining from Gajim if a password has been set. Otherwise the muc-occupant-pre-join event hook determines that the given password differs from the unset password and joining is rejected, which seems unhelpful. diff -r 2df7dc99566a -r 8c4dd4375823 plugins/muc/password.lib.lua --- a/plugins/muc/password.lib.lua Sun Jul 08 03:43:47 2018 +0200 +++ b/plugins/muc/password.lib.lua Sun Jul 08 04:17:54 2018 +0200 @@ -65,6 +65,14 @@ end end); +module:hook("muc-room-pre-create", function (event) + local stanza, room = event.stanza, event.room; + local muc_x = stanza:get_child("x", "http://jabber.org/protocol/muc"); + if not muc_x then return end + local password = muc_x:get_child_text("password", "http://jabber.org/protocol/muc"); + set_password(room, password); +end); + return { get = get_password; set = set_password;