+function set_active(trigger, sections)
+ if triggers == nil then
+ load_state()
+ end
+ if not triggers.list[trigger] then
+ return
+ end
+ if triggers.active[trigger] == nil then
+ tctx:set("uci_trigger", trigger, "trigger")
+ triggers.active[trigger] = {}
+ end
+ local active = triggers.active[trigger]
+ if triggers.list[trigger].section_only or sections ~= nil then
+ for i, t in ipairs(sections) do
+ triggers.active[trigger][t] = true
+ end
+ end
+ save_trigger(trigger)
+ tctx:save("uci_trigger")
+end
+
+function clear_active(trigger, sections)
+ if triggers == nil then
+ load_state()
+ end
+ if triggers.list[trigger] == nil or triggers.active[trigger] == nil then
+ return
+ end
+ local active = triggers.active[trigger]
+ if not triggers.list[trigger].section_only or sections == nil then
+ triggers.active[trigger] = nil
+ else
+ for i, t in ipairs(sections) do
+ triggers.active[trigger][t] = false
+ end
+ end
+ save_trigger(trigger)
+ tctx:save("uci_trigger")
+end
+