view plugins/mod_muc_unique.lua @ 14011:f77911437539 13.0

mod_storage_internal: Return item-not-found for unknown before/after ids This is required per XEP-0313, otherwise clients cannot tell the difference between an empty successful query and a query where their sync point is no longer within the archive.
author Matthew Wild <mwild1@gmail.com>
date Fri, 12 Dec 2025 12:43:23 +0000
parents 74b9e05af71e
children
line wrap: on
line source

-- XEP-0307: Unique Room Names for Multi-User Chat
local st = require "prosody.util.stanza";
local unique_name = require "prosody.util.id".medium;
module:add_feature "http://jabber.org/protocol/muc#unique"
module:hook("iq-get/host/http://jabber.org/protocol/muc#unique:unique", function(event)
	local origin, stanza = event.origin, event.stanza;
	origin.send(st.reply(stanza)
		:tag("unique", {xmlns = "http://jabber.org/protocol/muc#unique"})
		:text(unique_name():lower())
	);
	return true;
end,-1);