mod_carbons: Don't try to send carbons for entirely offline users.
--- 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