Comparison

mod_cache_c2s_caps/mod_cache_c2s_caps.lua @ 3475:820c891a54cc

mod_cache_c2s_caps: Use the correct argument, and check for origin’s nil-ness
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 06 Mar 2019 01:30:54 +0100
parent 3464:13b394b0db82
child 4018:f27becd421bd
comparison
equal deleted inserted replaced
3474:c3b886331de7 3475:820c891a54cc
48 origin.log("info", "Stored caps %s", ver); 48 origin.log("info", "Stored caps %s", ver);
49 module:fire_event("c2s-capabilities-changed", { origin = origin }); 49 module:fire_event("c2s-capabilities-changed", { origin = origin });
50 return true; 50 return true;
51 end 51 end
52 52
53 local function iq_error_handler(event) 53 local function iq_error_handler(err)
54 local origin = event.origin; 54 local origin = err.context.origin;
55 origin.caps_cache = nil; 55 if origin ~= nil then
56 module:fire_event("c2s-capabilities-changed", { origin = origin }); 56 origin.caps_cache = nil;
57 module:fire_event("c2s-capabilities-changed", { origin = origin });
58 end
57 end 59 end
58 60
59 local function presence_stanza_handler(event) 61 local function presence_stanza_handler(event)
60 local origin, stanza = event.origin, event.stanza; 62 local origin, stanza = event.origin, event.stanza;
61 63