Software /
code /
prosody-modules
Changeset
585:ce2798a1bc56
mod_carbons: Don't try to send carbons for entirely offline users.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 28 Jan 2012 15:10:04 +0100 |
parents | 584:1c2fc3b845f2 |
children | 586:f733e7599ed6 |
files | mod_carbons/mod_carbons.lua |
diffstat | 1 files changed, 9 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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