Software /
code /
prosody
Comparison
plugins/muc/members_only.lib.lua @ 11545:7b8a482f4efd 0.11
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.
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 10 May 2021 17:01:38 +0100 |
parent | 9716:5281a795d6df |
child | 11560:3bbb1af92514 |
comparison
equal
deleted
inserted
replaced
11544:c98aebe601f9 | 11545:7b8a482f4efd |
---|---|
59 room._data.allow_member_invites = allow_member_invites; | 59 room._data.allow_member_invites = allow_member_invites; |
60 return true; | 60 return true; |
61 end | 61 end |
62 | 62 |
63 module:hook("muc-disco#info", function(event) | 63 module:hook("muc-disco#info", function(event) |
64 event.reply:tag("feature", {var = get_members_only(event.room) and "muc_membersonly" or "muc_open"}):up(); | 64 local members_only_room = not not get_members_only(event.room); |
65 local members_can_invite = not not get_allow_member_invites(event.room); | |
66 event.reply:tag("feature", {var = members_only_room and "muc_membersonly" or "muc_open"}):up(); | |
65 table.insert(event.form, { | 67 table.insert(event.form, { |
66 name = "{http://prosody.im/protocol/muc}roomconfig_allowmemberinvites"; | 68 name = "{http://prosody.im/protocol/muc}roomconfig_allowmemberinvites"; |
67 label = "Allow members to invite new members"; | 69 label = "Allow members to invite new members"; |
68 type = "boolean"; | 70 type = "boolean"; |
69 value = not not get_allow_member_invites(event.room); | 71 value = members_can_invite; |
72 }); | |
73 table.insert(event.form, { | |
74 name = "muc#roomconfig_allowinvites"; | |
75 label = "Allow users to invite other users"; | |
76 type = "boolean"; | |
77 value = not members_only_room or members_can_invite; | |
70 }); | 78 }); |
71 end); | 79 end); |
72 | 80 |
73 | 81 |
74 module:hook("muc-config-form", function(event) | 82 module:hook("muc-config-form", function(event) |