aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2011-05-07 21:17:03 +0500
committerWaqas Hussain <waqas20@gmail.com>2011-05-07 21:17:03 +0500
commitb66c11930e82ff90be4677d67dbeded2a634db0d (patch)
treef55ae028d23866f3b38601f01815518a52631901 /plugins
parentfb9045ba583c00d462ba153febd2a60c7b9de3b8 (diff)
downloadprosody-b66c11930e82ff90be4677d67dbeded2a634db0d.tar.gz
prosody-b66c11930e82ff90be4677d67dbeded2a634db0d.zip
MUC: Include occupant count in room disco#info response.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/muc/muc.lib.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index 647bf915..ec85d185 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -213,6 +213,7 @@ function room_mt:send_history(to, stanza)
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 @@ function room_mt:get_disco_info(stanza)
: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