mirror of
https://github.com/bjc/prosody.git
synced 2025-04-05 14:17:37 +03:00
mod_roster: Use value returned by pairs() during roster iteration to avoid dozens of wasteful table lookups
This commit is contained in:
parent
88a0d25218
commit
180f79f833
1 changed files with 5 additions and 5 deletions
|
@ -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
|
if not (client_ver and server_ver) or client_ver ~= server_ver then
|
||||||
roster:query("jabber:iq:roster");
|
roster:query("jabber:iq:roster");
|
||||||
-- Client does not support versioning, or has stale 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
|
if jid ~= "pending" and jid then
|
||||||
roster:tag("item", {
|
roster:tag("item", {
|
||||||
jid = jid,
|
jid = jid,
|
||||||
subscription = session.roster[jid].subscription,
|
subscription = item.subscription,
|
||||||
ask = session.roster[jid].ask,
|
ask = item.ask,
|
||||||
name = session.roster[jid].name,
|
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();
|
roster:tag("group"):text(group):up();
|
||||||
end
|
end
|
||||||
roster:up(); -- move out from item
|
roster:up(); -- move out from item
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue