Software /
code /
prosody
Changeset
3323:5228a395999b
mod_roster: Use value returned by pairs() during roster iteration to avoid dozens of wasteful table lookups
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 05 Jul 2010 02:20:37 +0100 |
parents | 3322:c4e107e7c883 |
children | 3324:070c8ba71b76 |
files | plugins/mod_roster.lua |
diffstat | 1 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_roster.lua Sun Jul 04 19:38:33 2010 +0100 +++ b/plugins/mod_roster.lua Mon Jul 05 02:20:37 2010 +0100 @@ -42,15 +42,15 @@ 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