From ec28fe98377d225e2c19fb3e2e4d5757a3322d3e Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Tue, 28 Sep 2010 16:36:17 +0500 Subject: MUC: Make the room node be the default room name (thanks Zash). --- plugins/muc/mod_muc.lua | 2 +- plugins/muc/muc.lib.lua | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/muc/mod_muc.lua b/plugins/muc/mod_muc.lua index a9d9336c..3eab0cf5 100644 --- a/plugins/muc/mod_muc.lua +++ b/plugins/muc/mod_muc.lua @@ -87,7 +87,7 @@ local function get_disco_items(stanza) 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 diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua index 0752abc0..a3163349 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -260,14 +260,14 @@ local function build_unavailable_presence_from_error(stanza) 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 -- cgit v1.2.3