aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/muc
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-07-08 04:17:54 +0200
committerKim Alvefur <zash@zash.se>2018-07-08 04:17:54 +0200
commitf91c907f94bc2d91c733a08a9cd5a58a304d1f8f (patch)
tree0957b902b9d6715a82681217ed8e4ab46a3f7b05 /plugins/muc
parentb2ab7522b3c0213124f892aef6a1fad74ac4c271 (diff)
downloadprosody-f91c907f94bc2d91c733a08a9cd5a58a304d1f8f.tar.gz
prosody-f91c907f94bc2d91c733a08a9cd5a58a304d1f8f.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.lua8
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;