aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/muc
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2014-04-03 16:10:43 -0400
committerdaurnimator <quae@daurnimator.com>2014-04-03 16:10:43 -0400
commite14f89d1d228c410f3a67cfd59792f660ad9562d (patch)
treef6af72395e1235f2f982af8365c740b580e48059 /plugins/muc
parent185f0d33268c363466e638cbf14bd4ba492be13d (diff)
downloadprosody-e14f89d1d228c410f3a67cfd59792f660ad9562d.tar.gz
prosody-e14f89d1d228c410f3a67cfd59792f660ad9562d.zip
plugins/muc/muc.lib: Use util.iterators to count occupants
Diffstat (limited to 'plugins/muc')
-rw-r--r--plugins/muc/muc.lib.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index 694e13ff..59069cae 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -13,6 +13,7 @@ local next = next;
local setmetatable = setmetatable;
local dataform = require "util.dataforms";
+local iterators = require "util.iterators";
local jid_split = require "util.jid".split;
local jid_bare = require "util.jid".bare;
local jid_prep = require "util.jid".prep;
@@ -313,7 +314,7 @@ module:hook("muc-disco#info", function(event)
event.reply:tag("feature", {var = event.room:get_hidden() and "muc_hidden" or "muc_public"}):up();
end);
module:hook("muc-disco#info", function(event)
- local count = 0; for _ in event.room:each_occupant() do count = count + 1; end
+ local count = iterators.count(event.room:each_occupant());
table.insert(event.form, { name = "muc#roominfo_occupants", label = "Number of occupants", value = tostring(count) });
end);