Comparison

plugins/mod_csi_simple.lua @ 10801:2b97aac0ea3c

mod_csi_simple: Don't consider presence errors as important A large share of `<presence type=error>` appears to be noise from large public channels and failed presence probes. The later at least should count as presence updates, which are currently considered unimportant. See also 8cecb85e4bc4 which is partly reverted here. The intent there was probably mostly about message (delivery) errors, which should be considered important.
author Kim Alvefur <zash@zash.se>
date Tue, 05 May 2020 23:08:47 +0200
parent 10772:31e702c5f475
child 10806:24e2b571d29a
comparison
equal deleted inserted replaced
10800:62794e065e33 10801:2b97aac0ea3c
26 return true; 26 return true;
27 end 27 end
28 local st_name = stanza.name; 28 local st_name = stanza.name;
29 if not st_name then return false; end 29 if not st_name then return false; end
30 local st_type = stanza.attr.type; 30 local st_type = stanza.attr.type;
31 if st_type == "error" then
32 return true;
33 end
34 if st_name == "presence" then 31 if st_name == "presence" then
35 if st_type == nil or st_type == "unavailable" then 32 if st_type == nil or st_type == "unavailable" or st_name == "error" then
36 return false; 33 return false;
37 end 34 end
35 -- TODO Some MUC awareness, e.g. check for the 'this relates to you' status code
38 return true; 36 return true;
39 elseif st_name == "message" then 37 elseif st_name == "message" then
40 if st_type == "headline" then 38 if st_type == "headline" then
41 return false; 39 return false;
40 end
41 if st_type == "error" then
42 return true;
42 end 43 end
43 if stanza:get_child("sent", "urn:xmpp:carbons:2") then 44 if stanza:get_child("sent", "urn:xmpp:carbons:2") then
44 return true; 45 return true;
45 end 46 end
46 local forwarded = stanza:find("{urn:xmpp:carbons:2}received/{urn:xmpp:forward:0}/{jabber:client}message"); 47 local forwarded = stanza:find("{urn:xmpp:carbons:2}received/{urn:xmpp:forward:0}/{jabber:client}message");