Mercurial > prosody-modules
diff 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 |
parents | d3a2f4bdaf09 |
children | d1aa5fc005f7 |
line wrap: on
line diff
--- a/mod_csi_battery_saver/mod_csi_battery_saver.lua Fri Aug 18 22:56:28 2017 +0200 +++ b/mod_csi_battery_saver/mod_csi_battery_saver.lua Sat Aug 19 17:09:59 2017 +0200 @@ -2,8 +2,10 @@ -- Copyright (C) 2017 Thilo Molitor -- +local filter_muc = module:get_option_boolean("csi_battery_saver_filter_muc", false); + module:depends"csi" -module:depends"track_muc_joins" +if filter_muc then module:depends"track_muc_joins"; end -- only depend on this module if we actually use it local s_match = string.match; local s_sub = string.sub; local jid = require "util.jid"; @@ -16,8 +18,6 @@ -- a log id for this module instance local id = s_sub(require "util.hashes".sha256(datetime.datetime(), true), 1, 4); -local filter_muc = module:get_option_boolean("csi_battery_saver_filter_muc", false); - -- Patched version of util.stanza:find() that supports giving stanza names -- without their namespace, allowing for every namespace.