# HG changeset patch # User Kim Alvefur # Date 1443197305 -7200 # Node ID dcf9ceac92653fc8d7481db09d201394d460774b # Parent 7a81fb23de5d31f9d60ad06528e956882b95a84f# Parent de32d195e932d5a5224ecf686e2a71e3180eb59a Merge 0.10->trunk diff -r 7a81fb23de5d -r dcf9ceac9265 net/dns.lua --- a/net/dns.lua Fri Sep 25 18:07:08 2015 +0200 +++ b/net/dns.lua Fri Sep 25 18:08:25 2015 +0200 @@ -853,9 +853,7 @@ --self.print(response); for j,rr in pairs(response.answer) do - if rr.name:sub(-#response.question[1].name, -1) == response.question[1].name then - self:remember(rr, response.question[1].type) - end + self:remember(rr, response.question[1].type) end -- retire the query diff -r 7a81fb23de5d -r dcf9ceac9265 plugins/mod_pep.lua --- a/plugins/mod_pep.lua Fri Sep 25 18:07:08 2015 +0200 +++ b/plugins/mod_pep.lua Fri Sep 25 18:08:25 2015 +0200 @@ -16,10 +16,15 @@ local type = type; local calculate_hash = require "util.caps".calculate_hash; local core_post_stanza = prosody.core_post_stanza; +local bare_sessions = prosody.bare_sessions; +-- Used as canonical 'empty table' local NULL = {}; +-- data[user_bare_jid][node] = item_stanza local data = {}; +--- recipients[user_bare_jid][contact_full_jid][subscribed_node] = true local recipients = {}; +-- hash_map[hash][subscribed_nodes] = true local hash_map = {}; module.save = function() @@ -120,6 +125,9 @@ local t = stanza.attr.type; local self = not stanza.attr.to; + -- Only cache subscriptions if user is online + if not bare_sessions[user] then return; end + if not t then -- available presence if self or subscription_presence(user, stanza.attr.from) then local recipient = stanza.attr.from; @@ -283,3 +291,11 @@ end end end); + +module:hook("resource-unbind", function (event) + local user_bare_jid = event.session.username.."@"..event.session.host; + if not bare_sessions[user_bare_jid] then -- User went offline + -- We don't need this info cached anymore, clear it. + recipients[user_bare_jid] = nil; + end +end);