Comparison

plugins/mod_pep.lua @ 4207:06eb75d071ec

mod_pep: Fix comparison between incoming hash and the cached hash for a JID, fixes repeated PEP events on presence (fixes #225)
author Matthew Wild <mwild1@gmail.com>
date Fri, 25 Feb 2011 00:07:38 +0000
parent 3858:b76ac6c3a037
child 4394:676b0845eae4
comparison
equal deleted inserted replaced
4205:ffa5384130a7 4207:06eb75d071ec
122 if not t then -- available presence 122 if not t then -- available presence
123 if self or subscription_presence(user, stanza.attr.from) then 123 if self or subscription_presence(user, stanza.attr.from) then
124 local recipient = stanza.attr.from; 124 local recipient = stanza.attr.from;
125 local current = recipients[user] and recipients[user][recipient]; 125 local current = recipients[user] and recipients[user][recipient];
126 local hash = get_caps_hash_from_presence(stanza, current); 126 local hash = get_caps_hash_from_presence(stanza, current);
127 if current == hash then return; end 127 if current == hash or (current and current == hash_map[hash]) then return; end
128 if not hash then 128 if not hash then
129 if recipients[user] then recipients[user][recipient] = nil; end 129 if recipients[user] then recipients[user][recipient] = nil; end
130 else 130 else
131 recipients[user] = recipients[user] or {}; 131 recipients[user] = recipients[user] or {};
132 if hash_map[hash] then 132 if hash_map[hash] then