Comparison

plugins/mod_csi_simple.lua @ 10724:7835b9f14cb8

mod_csi_simple: Allow configuring extra tags indicating importance
author Kim Alvefur <zash@zash.se>
date Sat, 18 Apr 2020 16:18:41 +0200
parent 10414:51ebfdeccad7
child 10733:89e0f5cb60a1
comparison
equal deleted inserted replaced
10723:144a1ee24a4e 10724:7835b9f14cb8
1 -- Copyright (C) 2016-2018 Kim Alvefur 1 -- Copyright (C) 2016-2020 Kim Alvefur
2 -- 2 --
3 -- This project is MIT/X11 licensed. Please see the 3 -- This project is MIT/X11 licensed. Please see the
4 -- COPYING file in the source package for more information. 4 -- COPYING file in the source package for more information.
5 -- 5 --
6 6
10 local st = require "util.stanza"; 10 local st = require "util.stanza";
11 local dt = require "util.datetime"; 11 local dt = require "util.datetime";
12 local filters = require "util.filters"; 12 local filters = require "util.filters";
13 13
14 local queue_size = module:get_option_number("csi_queue_size", 256); 14 local queue_size = module:get_option_number("csi_queue_size", 256);
15
16 local important_payloads = module:get_option_set("csi_important_payloads", { });
15 17
16 module:hook("csi-is-stanza-important", function (event) 18 module:hook("csi-is-stanza-important", function (event)
17 local stanza = event.stanza; 19 local stanza = event.stanza;
18 if not st.is_stanza(stanza) then 20 if not st.is_stanza(stanza) then
19 return true; 21 return true;
43 if stanza:get_child("subject") then 45 if stanza:get_child("subject") then
44 return true; 46 return true;
45 end 47 end
46 if stanza:get_child("encryption", "urn:xmpp:eme:0") then 48 if stanza:get_child("encryption", "urn:xmpp:eme:0") then
47 return true; 49 return true;
50 end
51 for important in important_payloads do
52 if stanza:find(important) then
53 return true;
54 end
48 end 55 end
49 return false; 56 return false;
50 end 57 end
51 return true; 58 return true;
52 end, -1); 59 end, -1);