aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/muc/muc.lib.lua
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
commit0187db99aed68ccd4cb38ef5988303b5782d94eb (patch)
treef6af72395e1235f2f982af8365c740b580e48059 /plugins/muc/muc.lib.lua
parentd8832205ef2728e337ff016a71b96e3aaffea912 (diff)
downloadprosody-0187db99aed68ccd4cb38ef5988303b5782d94eb.tar.gz
prosody-0187db99aed68ccd4cb38ef5988303b5782d94eb.zip
plugins/muc/muc.lib: Use util.iterators to count occupants
Diffstat (limited to 'plugins/muc/muc.lib.lua')
-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);