aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2021-05-10 17:01:38 +0100
committerMatthew Wild <mwild1@gmail.com>2021-05-10 17:01:38 +0100
commit1e42cdef094e3c34d0c3791d5d2b55d1726d8313 (patch)
tree4d67373f025e0a34d46f4e8b7f0eebb26cc68a69
parent6a54d2d2c483de3824f57fffc3ab3375fde4e21e (diff)
downloadprosody-1e42cdef094e3c34d0c3791d5d2b55d1726d8313.tar.gz
prosody-1e42cdef094e3c34d0c3791d5d2b55d1726d8313.zip
MUC: Add support for advertising muc#roomconfig_allowinvites in room disco#info
The de-facto interpretation of this (undocumented) option is to indicate to the client whether it is allowed to invite other users to the MUC. This is differs from the existing option in our config form, which only controls the behaviour of sending of invites in a members-only MUC (we always allow invites in open rooms). Conversations is one client known to use this disco#info item to determine whether it may send invites.
-rw-r--r--plugins/muc/members_only.lib.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/plugins/muc/members_only.lib.lua b/plugins/muc/members_only.lib.lua
index 4194c5c7..3220225f 100644
--- a/plugins/muc/members_only.lib.lua
+++ b/plugins/muc/members_only.lib.lua
@@ -61,12 +61,20 @@ local function set_allow_member_invites(room, allow_member_invites)
end
module:hook("muc-disco#info", function(event)
- event.reply:tag("feature", {var = get_members_only(event.room) and "muc_membersonly" or "muc_open"}):up();
+ local members_only_room = not not get_members_only(event.room);
+ local members_can_invite = not not get_allow_member_invites(event.room);
+ event.reply:tag("feature", {var = members_only_room and "muc_membersonly" or "muc_open"}):up();
table.insert(event.form, {
name = "{http://prosody.im/protocol/muc}roomconfig_allowmemberinvites";
label = "Allow members to invite new members";
type = "boolean";
- value = not not get_allow_member_invites(event.room);
+ value = members_can_invite;
+ });
+ table.insert(event.form, {
+ name = "muc#roomconfig_allowinvites";
+ label = "Allow users to invite other users";
+ type = "boolean";
+ value = not members_only_room or members_can_invite;
});
end);