# HG changeset patch # User Kim Alvefur <zash@zash.se> # Date 1327759804 -3600 # Node ID ce2798a1bc56217b3ba5a8028b3798d56cfd80b9 # Parent 1c2fc3b845f266fae33f1bfb5358a781fb90a484 mod_carbons: Don't try to send carbons for entirely offline users. diff -r 1c2fc3b845f2 -r ce2798a1bc56 mod_carbons/mod_carbons.lua --- a/mod_carbons/mod_carbons.lua Thu Jan 26 19:38:03 2012 +0100 +++ b/mod_carbons/mod_carbons.lua Sat Jan 28 15:10:04 2012 +0100 @@ -54,14 +54,20 @@ user_sessions = host_sessions[username]; if resource then no_carbon_to[resource] = true; - else + elseif user_sessions then local top_resources = user_sessions.top_resources; - for _, session in ipairs(top_resources) do - no_carbon_to[session.resource] = true; + if top_resources then + for _, session in ipairs(top_resources) do + no_carbon_to[session.resource] = true; + end end end end + if not user_sessions then + return -- No use in sending carbons to an offline user + end + if not c2s and stanza:get_child("private", xmlns_carbons) then stanza:maptags(function(tag) return tag.attr.xmlns == xmlns_carbons