Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions EllesmereUIChat/EllesmereUIChat_Engine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -904,9 +904,24 @@ local function ChatFrameWheel(cf, delta)
end
end

-- Blizzard opens a new permanent window (ChatFrameUtil.PopOutChat) or a
-- temporary whisper window by taking one it considers unopened and seeding it
-- from the source frame inside its own copy loop: GetMessageInfo, compare the
-- line's accessID, AddMessage, next line. An AddMessage hook taints the rest of
-- that loop, so the NEXT GetMessageInfo answers with a secret accessID and the
-- compare throws (ChatFrameUtil.lua:711) with the pop-out half done. Unopened
-- frames therefore stay unbridged; the first integrate pass after Blizzard
-- opens one installs the bridge and backfills our window from its buffer.
local function IsChatFrameOpen(cf)
if cf.isTemporary then return cf.inUse == true end
local id = cf:GetID()
return id > 0 and FCF_IsChatWindowIndexActive(id)
end

local function InstallBridge(cf)
local d = CFD(cf)
if d.bridged then return end
if d.bridged then return false end
if not IsChatFrameOpen(cf) then return false end
d.bridged = true
-- EngineTail's signature matches the hook's (self arrives as its cf);
-- the trailing MessageFormatter argument is dropped by arity.
Expand All @@ -921,6 +936,7 @@ local function InstallBridge(cf)
end
cf:SetScript("OnMouseWheel", ChatFrameWheel)
cf:EnableMouseWheel(true)
return true
end

-------------------------------------------------------------------------------
Expand Down Expand Up @@ -1000,7 +1016,14 @@ local function IntegrateChatFrame(cf)
RebuildWindowFromBuffer(cf)
return
end
InstallBridge(cf)
-- A frame bridged only now was opened since the last pass (a pop-out, a
-- reused temporary window): its lines were copied in behind our back. The
-- empty check keeps a late bridge on a window we already render (session
-- history replayed into it) from wiping what only exists on our side.
if InstallBridge(cf) and win.smf:GetNumMessages() == 0 then
RebuildWindowFromBuffer(cf)
return
end
-- extraLines allowance, same as the bridge tail's check: replayed
-- session-history lines exist only on our side, and the login full
-- passes re-integrate every frame right after the restore -- without
Expand Down