Comparison

mod_csi_battery_saver/mod_csi_battery_saver.lua @ 2747:a688b31295ea

mod_csi_battery_saver: only depend on mod_track_muc_joins if actually used
author tmolitor <thilo@eightysoft.de>
date Sat, 19 Aug 2017 17:09:59 +0200
parent 2746:d3a2f4bdaf09
child 2754:d1aa5fc005f7
comparison
equal deleted inserted replaced
2746:d3a2f4bdaf09 2747:a688b31295ea
1 -- Copyright (C) 2016 Kim Alvefur 1 -- Copyright (C) 2016 Kim Alvefur
2 -- Copyright (C) 2017 Thilo Molitor 2 -- Copyright (C) 2017 Thilo Molitor
3 -- 3 --
4 4
5 local filter_muc = module:get_option_boolean("csi_battery_saver_filter_muc", false);
6
5 module:depends"csi" 7 module:depends"csi"
6 module:depends"track_muc_joins" 8 if filter_muc then module:depends"track_muc_joins"; end -- only depend on this module if we actually use it
7 local s_match = string.match; 9 local s_match = string.match;
8 local s_sub = string.sub; 10 local s_sub = string.sub;
9 local jid = require "util.jid"; 11 local jid = require "util.jid";
10 local new_queue = require "util.queue".new; 12 local new_queue = require "util.queue".new;
11 local datetime = require "util.datetime"; 13 local datetime = require "util.datetime";
13 15
14 local xmlns_delay = "urn:xmpp:delay"; 16 local xmlns_delay = "urn:xmpp:delay";
15 17
16 -- a log id for this module instance 18 -- a log id for this module instance
17 local id = s_sub(require "util.hashes".sha256(datetime.datetime(), true), 1, 4); 19 local id = s_sub(require "util.hashes".sha256(datetime.datetime(), true), 1, 4);
18
19 local filter_muc = module:get_option_boolean("csi_battery_saver_filter_muc", false);
20 20
21 21
22 -- Patched version of util.stanza:find() that supports giving stanza names 22 -- Patched version of util.stanza:find() that supports giving stanza names
23 -- without their namespace, allowing for every namespace. 23 -- without their namespace, allowing for every namespace.
24 local function find(self, path) 24 local function find(self, path)