Software /
code /
prosody
Changeset
2908:4d9a73abb237
mod_roster: Tidier code for the roster versioning logic
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 22 Mar 2010 01:54:22 +0000 |
parents | 2905:b924d915c4d0 |
children | 2909:bcfd76cc9b7d |
files | plugins/mod_roster.lua |
diffstat | 1 files changed, 4 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_roster.lua Sat Mar 20 14:16:33 2010 +0000 +++ b/plugins/mod_roster.lua Mon Mar 22 01:54:22 2010 +0000 @@ -36,9 +36,10 @@ if stanza.attr.type == "get" then local roster = st.reply(stanza); - local ver = stanza.tags[1].attr.ver + local client_ver = tonumber(stanza.tags[1].attr.ver); + local server_ver = tonumber(session.roster[false].version or 1); - if (not ver) or tonumber(ver) ~= (session.roster[false].version or 1) then + 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 @@ -55,7 +56,7 @@ roster:up(); -- move out from item end end - roster.tags[1].attr.ver = tostring(session.roster[false].version or "1"); + roster.tags[1].attr.ver = server_ver; end session.send(roster); session.interested = true; -- resource is interested in roster updates