Changeset

1741:2919f3b985fc

MUC: Added support for generating unique room names
author Waqas Hussain <waqas20@gmail.com>
date Mon, 07 Sep 2009 20:29:04 +0500
parents 1740:b37ccf9bec89
children 1742:1483a62d69bb
files plugins/muc/mod_muc.lua
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/muc/mod_muc.lua	Mon Sep 07 20:27:52 2009 +0500
+++ b/plugins/muc/mod_muc.lua	Mon Sep 07 20:29:04 2009 +0500
@@ -20,6 +20,7 @@
 local deregister_component = require "core.componentmanager".deregister_component;
 local jid_split = require "util.jid".split;
 local st = require "util.stanza";
+local uuid_gen = require "util.uuid".generate;
 
 local rooms = {};
 local component;
@@ -48,6 +49,8 @@
 			origin.send(get_disco_info(stanza));
 		elseif xmlns == "http://jabber.org/protocol/disco#items" then
 			origin.send(get_disco_items(stanza));
+		elseif xmlns == "http://jabber.org/protocol/muc#unique" then
+			origin.send(st.reply(stanza):tag("unique", {xmlns = xmlns}):text(uuid_gen())); -- FIXME Random UUIDs can theoretically have collisions
 		else
 			origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); -- TODO disco/etc
 		end