Mercurial > prosody-modules
diff mod_carbons/mod_carbons.lua @ 603:efc9d88b70ab
merged.
| author | Marco Cirillo <maranda@lightwitch.org> |
|---|---|
| date | Thu, 09 Feb 2012 00:54:39 +0000 |
| parents | ce2798a1bc56 |
| children | 5175f6d33470 |
line wrap: on
line diff
--- a/mod_carbons/mod_carbons.lua Thu Feb 09 00:53:32 2012 +0000 +++ b/mod_carbons/mod_carbons.lua Thu Feb 09 00:54:39 2012 +0000 @@ -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
