aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-07-05 02:20:37 +0100
committerMatthew Wild <mwild1@gmail.com>2010-07-05 02:20:37 +0100
commit180f79f833d4b119794af21ae9cb1736e319ae1f (patch)
tree0ecb939ff1bd2e2161a4bd309582fd1e2af976b9
parent88a0d25218bc3f3263d3d734c265c32f8a8a6a8b (diff)
downloadprosody-180f79f833d4b119794af21ae9cb1736e319ae1f.tar.gz
prosody-180f79f833d4b119794af21ae9cb1736e319ae1f.zip
mod_roster: Use value returned by pairs() during roster iteration to avoid dozens of wasteful table lookups
-rw-r--r--plugins/mod_roster.lua10
1 files changed, 5 insertions, 5 deletions
diff --git a/plugins/mod_roster.lua b/plugins/mod_roster.lua
index ddf02f2f..af92e24e 100644
--- a/plugins/mod_roster.lua
+++ b/plugins/mod_roster.lua
@@ -42,15 +42,15 @@ module:add_iq_handler("c2s", "jabber:iq:roster",
if not (client_ver and server_ver) or client_ver ~= server_ver then
roster:query("jabber:iq:roster");
-- Client does not support versioning, or has stale roster
- for jid in pairs(session.roster) do
+ for jid, item in pairs(session.roster) do
if jid ~= "pending" and jid then
roster:tag("item", {
jid = jid,
- subscription = session.roster[jid].subscription,
- ask = session.roster[jid].ask,
- name = session.roster[jid].name,
+ subscription = item.subscription,
+ ask = item.ask,
+ name = item.name,
});
- for group in pairs(session.roster[jid].groups) do
+ for group in pairs(item.groups) do
roster:tag("group"):text(group):up();
end
roster:up(); -- move out from item