Comparison

core/stanza_router.lua @ 7648:d91ef1e6afc2

stanza_router: Make 'unhandled stanza' errors more informative
author Matthew Wild <mwild1@gmail.com>
date Wed, 31 Aug 2016 16:40:26 +0100
parent 7448:34678ce8a6ac
child 7739:0356216c474c
comparison
equal deleted inserted replaced
7646:6210dfaec84f 7648:d91ef1e6afc2
34 local name, xmlns, origin_type = stanza.name, stanza.attr.xmlns or "jabber:client", origin.type; 34 local name, xmlns, origin_type = stanza.name, stanza.attr.xmlns or "jabber:client", origin.type;
35 if xmlns == "jabber:client" and valid_stanzas[name] then 35 if xmlns == "jabber:client" and valid_stanzas[name] then
36 -- A normal stanza 36 -- A normal stanza
37 local st_type = stanza.attr.type; 37 local st_type = stanza.attr.type;
38 if st_type == "error" or (name == "iq" and st_type == "result") then 38 if st_type == "error" or (name == "iq" and st_type == "result") then
39 log("debug", "Discarding %s from %s of type: %s", name, origin_type, st_type or '<nil>'); 39 if st_type == "error" then
40 local err_type, err_condition, err_message = stanza:get_error();
41 log("debug", "Discarding unhandled error %s (%s, %s) from %s: %s", name, err_type, err_condition or "unknown condition", origin_type, stanza:top_tag());
42 else
43 log("debug", "Discarding %s from %s of type: %s", name, origin_type, st_type or '<nil>');
44 end
40 return; 45 return;
41 end 46 end
42 if name == "iq" and (st_type == "get" or st_type == "set") and stanza.tags[1] then 47 if name == "iq" and (st_type == "get" or st_type == "set") and stanza.tags[1] then
43 xmlns = stanza.tags[1].attr.xmlns or "jabber:client"; 48 xmlns = stanza.tags[1].attr.xmlns or "jabber:client";
44 end 49 end