aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-03-22 01:54:22 +0000
committerMatthew Wild <mwild1@gmail.com>2010-03-22 01:54:22 +0000
commit172d9baed4f493e04e93659d485f1a75624b84c1 (patch)
tree02c785f6ecf8290bebcc621605af7d6f4bed970f /plugins
parentfc48cf2a70ea426b7b5ffec3f2719085c0550659 (diff)
downloadprosody-172d9baed4f493e04e93659d485f1a75624b84c1.tar.gz
prosody-172d9baed4f493e04e93659d485f1a75624b84c1.zip
mod_roster: Tidier code for the roster versioning logic
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_roster.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/plugins/mod_roster.lua b/plugins/mod_roster.lua
index 4362dca2..d301dd78 100644
--- a/plugins/mod_roster.lua
+++ b/plugins/mod_roster.lua
@@ -36,9 +36,10 @@ module:add_iq_handler("c2s", "jabber:iq:roster",
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 @@ module:add_iq_handler("c2s", "jabber:iq:roster",
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