--- Used to update everything that is affected by the configuration
-function OmaRF:RefreshConfig()
- self:OnDisable(); -- clear everything
- if self.db.profile.enabled then
- CompactRaidFrameContainer_ApplyToFrames(CompactRaidFrameContainer, "normal", configureIndicators);
- -- Format aura strings
- watchedAuras = {};
- for _, pos in ipairs(positions) do
- for _, aura in ipairs(self.db.profile.indicators[pos]["auras"]) do
- watchedAuras[aura] = pos; -- TODO single aura only in one position
+function M.UpdateAuras(frame, unit)
+ local current = GetTime();
+ if frame.throttled then
+ print("updateAuras throttled for ", unit); -- TODO debug print
+ return;
+ elseif frame.prevUpdate - current < 0.1 then
+ frame.throttled = true;
+ return CTimerAfter(0.1, frame.throttle);
+ end
+
+ for _, ind in pairs(frame.inds) do
+ hideInd(ind);
+ end
+ local icon, count, expires, id;
+ local showInds, needUpdate = false, false;
+ local i = 1;
+ while true do
+ _, _, icon, count, _, _, expires, _, _, _, id = UnitAura(unit, i, "PLAYER HELPFUL");
+ if not id then break end
+ local pos = watchedAuras[id];
+ if pos then
+ needUpdate = showInd(frame.inds[pos], expires, current, count, icon) or needUpdate;
+ showInds = true;
+ end
+ i = i + 1;
+ end
+
+ if showInds then
+ frame.indBase:Show();
+ if needUpdate and not updating[frame] then
+ updating[frame] = true; -- race?
+ -- create a function for updating the indicator
+ local func = updaters[frame];
+ if not func then
+ func = function() updateIndicators(frame) end;
+ updaters[frame] = func;