mirror of
https://github.com/Lacustat/Freewood-OctoWoW-Core.git
synced 2026-11-04 14:36:58 +00:00
0.1.230: Service-Kanal LFT wird nicht mehr gespeichert (nur Arbeitsspeicher), keine /who-Abfragen fuer LFT, alter LFT-Verlauf wird beim Login geloescht [ungeprueft]
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016onJCSHLwhs9udhC9ZLzk9
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
ae241c5dfb
commit
f1a73c831a
+19
-6
@@ -239,7 +239,15 @@ end
|
||||
-- Verlauf
|
||||
------------------------------------------------------------------------
|
||||
|
||||
-- Service-Kanaele (LFT) werden NICHT gespeichert: nur im Arbeitsspeicher, kurze Liste
|
||||
CL.mem = {}
|
||||
local MEM_CAP = 150
|
||||
local function Volatile(key)
|
||||
return type(key) == "string" and string.lower(key) == "c:lft"
|
||||
end
|
||||
|
||||
function CL.Lines(key)
|
||||
if Volatile(key) then return CL.mem[key] end
|
||||
local c = DB()
|
||||
return c and c.lines[key] or nil
|
||||
end
|
||||
@@ -247,20 +255,22 @@ end
|
||||
function CL.Add(key, sender, text, out)
|
||||
local c = DB()
|
||||
if not c or not key then return end
|
||||
local list = c.lines[key]
|
||||
if not list then list = {}; c.lines[key] = list end
|
||||
local vol = Volatile(key)
|
||||
local store = vol and CL.mem or c.lines
|
||||
local list = store[key]
|
||||
if not list then list = {}; store[key] = list end
|
||||
local n = table.getn(list) + 1
|
||||
list[n] = { t = Now(), s = sender, m = text, o = out and 1 or nil }
|
||||
local cap = (string.sub(key, 1, 2) == "c:") and CAP_CH or CAP_OTHER
|
||||
if n > cap + 50 then
|
||||
local cap = vol and MEM_CAP or ((string.sub(key, 1, 2) == "c:") and CAP_CH or CAP_OTHER)
|
||||
if n > cap + (vol and 20 or 50) then
|
||||
local new, i, j = {}, n - cap + 1, 1
|
||||
while i <= n do new[j] = list[i]; i = i + 1; j = j + 1 end
|
||||
c.lines[key] = new
|
||||
store[key] = new
|
||||
end
|
||||
if not (CL.viewVisible and CL.viewKey == key) then
|
||||
CL.unread[key] = (CL.unread[key] or 0) + 1
|
||||
end
|
||||
if sender and not out then CL.Ask(sender) end
|
||||
if sender and not out and not vol then CL.Ask(sender) end
|
||||
CL.version = CL.version + 1
|
||||
end
|
||||
|
||||
@@ -268,6 +278,9 @@ function CL.Prune()
|
||||
local c = DB()
|
||||
if c then
|
||||
local limit = Now() - KEEP
|
||||
for key in pairs(c.lines) do
|
||||
if Volatile(key) then c.lines[key] = nil end
|
||||
end
|
||||
for key, list in pairs(c.lines) do
|
||||
local n = table.getn(list)
|
||||
local first = 1
|
||||
|
||||
Reference in New Issue
Block a user