comparison mod_cache_c2s_caps/mod_cache_c2s_caps.lua @ 3111:7a3ac037e57f

mod_cache_c2s_caps: Fix traceback on invalid payload in disco#info result.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 08 Jun 2018 21:59:42 +0200
parents b003d72d9ce6
children c424bfb927b1
comparison
equal deleted inserted replaced
3110:06e07b483805 3111:7a3ac037e57f
8 -- Some clients (*ahem* poezio…) don’t include the @node in their result iq. 8 -- Some clients (*ahem* poezio…) don’t include the @node in their result iq.
9 local iq_node_map = {} 9 local iq_node_map = {}
10 10
11 local function iq_result_handler(event) 11 local function iq_result_handler(event)
12 local origin, stanza = event.origin, event.stanza; 12 local origin, stanza = event.origin, event.stanza;
13
14 local query = stanza:get_child("query", "http://jabber.org/protocol/disco#info");
15 if not query then
16 origin.log("debug", "Wrong iq payload in disco#info result: %s", stanza);
17 return;
18 end
19
13 local from = stanza.attr.from; 20 local from = stanza.attr.from;
14 local id = stanza.attr.id; 21 local id = stanza.attr.id;
15
16 local query = stanza:get_child("query", "http://jabber.org/protocol/disco#info");
17
18 local node_string = query.attr.node; 22 local node_string = query.attr.node;
19 local node_query = iq_node_map[from..id]; 23 local node_query = iq_node_map[from..id];
20 if node_string == nil then 24 if node_string == nil then
21 node_string = node_query; 25 node_string = node_query;
22 query.attr.node = node_query; 26 query.attr.node = node_query;