Software /
code /
prosody-modules
Comparison
mod_presence_cache/mod_presence_cache.lua @ 3373:322e8e7ba7d4
mod_presence_cache: Set delay source to bare JID instead of host
Could be argued that this is more correct, since the cache is per user.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 07 Nov 2018 22:20:56 +0100 |
parent | 3183:b718092e442f |
child | 3760:830a01443a2f |
comparison
equal
deleted
inserted
replaced
3372:866167118d23 | 3373:322e8e7ba7d4 |
---|---|
84 | 84 |
85 local bare_cache_key = username .. "\0" .. contact_bare; | 85 local bare_cache_key = username .. "\0" .. contact_bare; |
86 | 86 |
87 local cached = bare_cache[bare_cache_key]; | 87 local cached = bare_cache[bare_cache_key]; |
88 if not cached then return end | 88 if not cached then return end |
89 local user_bare = jid_bare(origin.full_jid); | |
89 for jid, presence_bits in pairs(cached) do | 90 for jid, presence_bits in pairs(cached) do |
90 local presence = st.presence({ to = origin.full_jid, from = jid }) | 91 local presence = st.presence({ to = origin.full_jid, from = jid }) |
91 if presence_bits.show then | 92 if presence_bits.show then |
92 presence:tag("show"):text(presence_bits.show):up(); | 93 presence:tag("show"):text(presence_bits.show):up(); |
93 end | 94 end |
94 if presence_bits.stamp then | 95 if presence_bits.stamp then |
95 presence:tag("delay", { xmlns = "urn:xmpp:delay", from = module.host, stamp = presence_bits.stamp }):up(); | 96 presence:tag("delay", { xmlns = "urn:xmpp:delay", from = user_bare, stamp = presence_bits.stamp }):up(); |
96 end | 97 end |
97 origin.send(presence); | 98 origin.send(presence); |
98 end | 99 end |
99 end | 100 end |
100 | 101 |