# HG changeset patch # User Waqas Hussain # Date 1304785023 -18000 # Node ID 513485a11b85576e456f1d28be5482e92972bd82 # Parent d56c26c258e4e425847b3e08adabce62548cdb44 MUC: Include occupant count in room disco#info response. diff -r d56c26c258e4 -r 513485a11b85 plugins/muc/muc.lib.lua --- a/plugins/muc/muc.lib.lua Sat May 07 21:16:25 2011 +0500 +++ b/plugins/muc/muc.lib.lua Sat May 07 21:17:03 2011 +0500 @@ -213,6 +213,7 @@ end function room_mt:get_disco_info(stanza) + local count = 0; for _ in pairs(self._occupants) do count = count + 1; end return st.reply(stanza):query("http://jabber.org/protocol/disco#info") :tag("identity", {category="conference", type="text", name=self:get_name()}):up() :tag("feature", {var="http://jabber.org/protocol/muc"}):up() @@ -224,7 +225,8 @@ :tag("feature", {var=self._data.whois ~= "anyone" and "muc_semianonymous" or "muc_nonanonymous"}):up() :add_child(dataform.new({ { name = "FORM_TYPE", type = "hidden", value = "http://jabber.org/protocol/muc#roominfo" }, - { name = "muc#roominfo_description", label = "Description"} + { name = "muc#roominfo_description", label = "Description"}, + { name = "muc#roominfo_occupants", label = "Number of occupants", value = tostring(count) } }):form({["muc#roominfo_description"] = self:get_description()}, 'result')) ; end