Changeset

3510:711eb5bf94b4

MUC: Make the room node be the default room name (thanks Zash).
author Waqas Hussain <waqas20@gmail.com>
date Tue, 28 Sep 2010 16:36:17 +0500
parents 3509:72cb8b6536b9
children 3511:4495403470cb
files plugins/muc/mod_muc.lua plugins/muc/muc.lib.lua
diffstat 2 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/muc/mod_muc.lua	Mon Sep 27 19:51:14 2010 +0500
+++ b/plugins/muc/mod_muc.lua	Tue Sep 28 16:36:17 2010 +0500
@@ -87,7 +87,7 @@
 	local reply = st.iq({type='result', id=stanza.attr.id, from=muc_host, to=stanza.attr.from}):query("http://jabber.org/protocol/disco#items");
 	for jid, room in pairs(rooms) do
 		if not room:is_hidden() then
-			reply:tag("item", {jid=jid, name=jid}):up();
+			reply:tag("item", {jid=jid, name=room:get_name()}):up();
 		end
 	end
 	return reply; -- TODO cache disco reply
--- a/plugins/muc/muc.lib.lua	Mon Sep 27 19:51:14 2010 +0500
+++ b/plugins/muc/muc.lib.lua	Tue Sep 28 16:36:17 2010 +0500
@@ -260,14 +260,14 @@
 end
 
 function room_mt:set_name(name)
-	if name == "" or type(name) ~= "string" then name = nil; end
+	if name == "" or type(name) ~= "string" or name == (jid_split(self.jid)) then name = nil; end
 	if self._data.name ~= name then
 		self._data.name = name;
 		if self.save then self:save(true); end
 	end
 end
 function room_mt:get_name()
-	return self._data.name;
+	return self._data.name or jid_split(self.jid);
 end
 function room_mt:set_description(description)
 	if description == "" or type(description) ~= "string" then description = nil; end