Changeset

8878:7c3e16fdaf1d

mod_muc_unique: Use util.id for more compact identifiers
author Kim Alvefur <zash@zash.se>
date Wed, 06 Jun 2018 13:33:37 +0200
parents 8877:9182398c64b9
children 8879:4dee8c439afc
files plugins/mod_muc_unique.lua
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_muc_unique.lua	Wed Jun 06 00:35:42 2018 +0200
+++ b/plugins/mod_muc_unique.lua	Wed Jun 06 13:33:37 2018 +0200
@@ -1,12 +1,12 @@
 -- XEP-0307: Unique Room Names for Multi-User Chat
 local st = require "util.stanza";
-local uuid_gen = require "util.uuid".generate;
+local unique_name = require "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(uuid_gen()) -- FIXME Random UUIDs can theoretically have collisions
+		:text(unique_name():lower())
 	);
 	return true;
 end,-1);