[BUG] Emote Splitter Not Working Because of SendMessage Change.
cquill1 opened this issue ยท 3 comments
This is a pretty rough and dirty fix for the current bug going on right now, take it as you will. This is tested and works in game as long as you change and alter the OnLogin code to the beneath for the core Gopher file. Otherwise, this is broken with 11.2's newest patch. Don't know how scalable this is since it's not my code, but hey, it actually works
function Me.OnLogin()
-- Delay this a little so we give time for their own OnLogin to trigger.
C_Timer.After( 0.01, Me.AddCompatibilityLayers )
Me.PLAYER_GUID = UnitGUID("player")
Me.SetupContinueFrame()
-- Message hooking. These first ones are the public message types that we
-- want to hook for confirmation. They're the ones that can error out if
-- they're hit randomly by the server throttle.
Me.frame:RegisterEvent( "CHAT_MSG_SAY" )
Me.frame:RegisterEvent( "CHAT_MSG_EMOTE" )
Me.frame:RegisterEvent( "CHAT_MSG_YELL" )
if C_Club then -- 7.x compat
-- In 8.0, GUILD and OFFICER chat are no longer normie communication
-- channels. They're just routed into the community API internally.
-- Sometimes the game uses the old guild channels though, as the
-- Battle.net platform can go down sometimes, and it falls back to
-- the game's channels.
Me.frame:RegisterEvent( "CLUB_MESSAGE_ADDED" )
Me.frame:RegisterEvent( "CHAT_MSG_COMMUNITIES_CHANNEL" )
Me.frame:RegisterEvent( "CHAT_MSG_GUILD" )
Me.frame:RegisterEvent( "CHAT_MSG_OFFICER" )
Me.frame:RegisterEvent( "CLUB_ERROR" )
Me.frame:RegisterEvent( "CLUB_MESSAGE_UPDATED" )
end
-- Battle.net whispers do have a throttle if you send too many, and they're
-- also affected by the very stupid Battle.net misordering quirk. Send one
-- at a time to be safe.
Me.frame:RegisterEvent( "CHAT_MSG_BN_WHISPER_INFORM" )
-- I didn't even know they had a dedicated event for this.
Me.frame:RegisterEvent( "CHAT_MSG_BN_WHISPER_PLAYER_OFFLINE" )
-- And finally we hook the system chat events, so we can catch when the
-- system tells us that a message failed to send.
Me.frame:RegisterEvent( "CHAT_MSG_SYSTEM" )
-- v12: Catch addon blocked event; this may happen unexpectedly when some
-- addon is trying to send chat. That means we need to break out of the
-- throttler loop and way for a hardware event trigger to resume.
Me.frame:RegisterEvent( "ADDON_ACTION_BLOCKED" )
-- Here's where we add the feature to hide the failure messages in the
-- chat frames, the failure messages that the system sends when your
ChatFrame_AddMessageEventFilter( "CHAT_MSG_SYSTEM", -- chat gets
function( _, _, msg, sender ) -- throttled.
-- `ERR_CHAT_THROTTLED` is the localized string.
if Me.hide_failure_messages and msg == ERR_CHAT_THROTTLED then
-- Returning true from these callbacks block the message
return true -- from showing up.
end
end)
if not Me.hooks.ChatEdit_SendText then
Me.hooks.ChatEdit_SendText = ChatEdit_SendText
function ChatEdit_SendText(editBox, send, ...)
if editBox and editBox:GetText() then
local msg = editBox:GetText()
local chatType = editBox:GetAttribute("chatType")
if (chatType == "EMOTE" or chatType == "SAY" or chatType == "YELL")
and msg:len() > 255 then
editBox:SetText("")
Me.SendChatMessageHook(msg, chatType)
return
end
end
return Me.hooks.ChatEdit_SendText(editBox, send, ...)
end
end
Me.DebugLog("Initialized.")
endThis has to get expanded on for other types of chat, since it won't let you do it for things like raid chat, whoops
Hi, thank you for your service. Hooking the chatbox UI can be dangerous because it can add taint to chat commands, especially ones that interact with combat such as /cast. It looks like the issue is that the SendChatMessage global has been deprecated and we should be hooking C_ChatInfo.SendChatMessage now.