aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-10-23 22:54:15 +0200
committerKim Alvefur <zash@zash.se>2018-10-23 22:54:15 +0200
commitb182e48f8dcb34e23345639dd325d935cff0e98b (patch)
treecd5d1ce2ff7acc2513415da27489a1a9ad232c55
parentf58d3968868889973e32cff3fb3bc47ef7686a39 (diff)
downloadprosody-b182e48f8dcb34e23345639dd325d935cff0e98b.tar.gz
prosody-b182e48f8dcb34e23345639dd325d935cff0e98b.zip
mod_pep: Remove use of recipients table for signaling pending disco#items
It stored the caps hash as a string in the recipients table while waiting for a disco#info response, then replaces it with the set of nodes that had +notify. This mixing of types is bad, so here it gets removed. This can be improved once an IQ tracking API (#714) is added.
-rw-r--r--plugins/mod_pep.lua23
1 files changed, 7 insertions, 16 deletions
diff --git a/plugins/mod_pep.lua b/plugins/mod_pep.lua
index f1228b5a..60a5285b 100644
--- a/plugins/mod_pep.lua
+++ b/plugins/mod_pep.lua
@@ -271,7 +271,7 @@ local function update_subscriptions(recipient, service_name, nodes)
end
local current = service_recipients[recipient];
- if not current or type(current) ~= "table" then
+ if not current then
current = empty_set;
end
@@ -322,15 +322,11 @@ module:hook("presence/bare", function(event)
if hash_map[hash] then
update_subscriptions(recipient, username, hash_map[hash]);
else
- recipients[username][recipient] = hash;
- local from_bare = origin.type == "c2s" and origin.username.."@"..origin.host;
- if is_self or origin.type ~= "c2s" or (recipients[from_bare] and recipients[from_bare][origin.full_jid]) ~= hash then
- -- COMPAT from ~= stanza.attr.to because OneTeam can't deal with missing from attribute
- origin.send(
- st.stanza("iq", {from=user_bare, to=stanza.attr.from, id="disco", type="get"})
- :tag("query", {xmlns = "http://jabber.org/protocol/disco#info", node = query_node})
- );
- end
+ -- COMPAT from ~= stanza.attr.to because OneTeam can't deal with missing from attribute
+ origin.send(
+ st.stanza("iq", {from=user_bare, to=stanza.attr.from, id="disco", type="get"})
+ :tag("query", {xmlns = "http://jabber.org/protocol/disco#info", node = query_node})
+ );
end
end
end
@@ -365,12 +361,7 @@ module:hook("iq-result/bare/disco", function(event)
user_bare = jid_join(username, host);
end
local contact = stanza.attr.from;
- local current = recipients[username] and recipients[username][contact];
- if type(current) ~= "string" then return; end -- check if waiting for recipient's response
- local ver = current;
- if not string.find(current, "#") then
- ver = calculate_hash(disco.tags); -- calculate hash
- end
+ local ver = calculate_hash(disco.tags); -- calculate hash
local notify = set_new();
for _, feature in pairs(disco.tags) do
if feature.name == "feature" and feature.attr.var then