Mercurial > prosody-hg
diff plugins/muc/password.lib.lua @ 8997:8c4dd4375823
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.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sun, 08 Jul 2018 04:17:54 +0200 |
| parents | 2df7dc99566a |
| children | 173c0e16e704 |
line wrap: on
line diff
--- 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;
