diff options
author | Kim Alvefur <zash@zash.se> | 2018-07-08 04:17:54 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-07-08 04:17:54 +0200 |
commit | d3db6ff3baeb1e8b4e8ff442b000c594d22b2645 (patch) | |
tree | 0957b902b9d6715a82681217ed8e4ab46a3f7b05 /plugins/muc | |
parent | e60ade466c7269589cb471ed12d688dc33a35d53 (diff) | |
download | prosody-d3db6ff3baeb1e8b4e8ff442b000c594d22b2645.tar.gz prosody-d3db6ff3baeb1e8b4e8ff442b000c594d22b2645.zip |
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.
Diffstat (limited to 'plugins/muc')
-rw-r--r-- | plugins/muc/password.lib.lua | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/plugins/muc/password.lib.lua b/plugins/muc/password.lib.lua index 7edab767..fb603d88 100644 --- a/plugins/muc/password.lib.lua +++ b/plugins/muc/password.lib.lua @@ -65,6 +65,14 @@ module:hook("muc-invite", function(event) 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; |