Since these are indeed rooms the user can and should know about.
-- You received this message because you are subscribed to the Google Groups "prosody-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prosody-dev/ZZ7FWQcd5cuGzxbA%40singpolyma-beefy.lan.
# HG changeset patch # User Stephen Paul Weber <[email protected]> # Date 1704903818 18000 # Wed Jan 10 11:23:38 2024 -0500 # Node ID b3302142d28182b536253eb7be3542a727cf51cf # Parent 95d8875c90dc9ac9d8f0e7a90ac8c7ba222bf89a mod_muc: include affiliated rooms in list of known rooms diff -r 95d8875c90dc -r b3302142d281 plugins/muc/mod_muc.lua --- a/plugins/muc/mod_muc.lua Sun Dec 17 19:02:56 2023 +0100 +++ b/plugins/muc/mod_muc.lua Wed Jan 10 11:23:38 2024 -0500 @@ -359,10 +359,12 @@ return; end local reply = event.reply; + local seen = {}; -- Don't iterate over cached rooms twice if next(room_items_cache) ~= nil then for jid, room_name in pairs(room_items_cache) do if room_name == "" then room_name = nil; end reply:tag("item", { jid = jid, name = room_name }):up(); + seen[jid] = true end else for room in all_rooms() do @@ -370,9 +372,21 @@ local jid, room_name = room.jid, room:get_name(); room_items_cache[jid] = room_name or ""; reply:tag("item", { jid = jid, name = room_name }):up(); + seen[jid] = true end end end + + local store = module:open_store("config", "map") + local affiliations = store:get_all(jid_bare(event.stanza.attr.from)) or {} + for roomnode, affiliation in pairs(affiliations) do + local roomjid = roomnode .. "@" .. module.host + if affiliation ~= "outcast" and not seen[roomjid] then + local room = get_room_from_jid(roomjid) + local room_name = room:get_name() or "" + reply:tag("item", { jid = roomjid, name = room_name }):up(); + end + end end); module:hook("muc-room-pre-create", function (event)
signature.asc
Description: PGP signature
