Thread Tools Display Modes
01-22-12, 07:10 AM   #1
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,360
Sideeffects from hooking ChatFrame_SendTell()?

As title.

Any of the authors that have more experience with chat code see something wrong with replacing ChatFrame_SendTell()?

Note: I'm specifically talking about replacing, not post-hooking or securehooking.

To give a bit of context in current build 15050 of WoW sending a tell to cross-realm players from realms with a space in the realm name does not work.
(examples: "Bronze Dragonflight", "Aerie Peak", "Area 52", "Twilight's Hammer" and so on and so forth)

The command parser gets confused when it gets to the space and makes the 2nd word part of the message.
So instead of trying to do "Player-Aerie Peak: your message here"
it tries to do "Player-Aerie: Peak your message here" which obviously fails.

This is a bug with the default client not an addon problem although it does affect a bunch of chat addons.

The easiest way I've found to fix it is hook ChatFrame_SendTell(fullname, chatframe) and do a gsub(" ","") on the fullname before calling the original function passing it the same arguments but with name fixed.
"Player-AeriePeak: your message here" works fine.

Anyone can see something inherently wrong with that approach or a better way to solve this?
  Reply With Quote
01-22-12, 08:07 AM   #2
Animor
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Mar 2011
Posts: 136
By replacing, u mean pre-hooking? I don't think it's the same. You describe hooking, but talk about replacing.

I think every addon author should make sure his addon works well with such cross realm whispers, since it can be solved prior to calling this function. Hooking has some impact on performance.
  Reply With Quote
01-22-12, 08:20 AM   #3
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,360
Replacing and pre-hooking are used synonymously and yes that's what I mean.
Replacing a global function so anything calling it is actually calling my function is the definition of (pre)hooking.

Originally Posted by Animor View Post
since it can be solved prior to calling this function.
Considering I specifically asked for better ways to solve this... can you elaborate?

How do you solve it prior to calling this function?
This function is called from the default client any time you right-click a unitframe and pick "whisper" from the dropdown or a player link with no addons installed whatsoever.

I repeat that this is a bug with the default client.
So enlighten me

Last edited by Dridzt : 01-22-12 at 08:25 AM.
  Reply With Quote
01-22-12, 10:30 AM   #4
Animor
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Mar 2011
Posts: 136
Ok, now I understand what you mean. So it has nothing to do with chat addons, it's a blizz bug.

Anyway look at what I've found in http://wowprogramming.com/utils/xmlb.../ChatFrame.lua
Looks like blizzars are familiar with this issue, but decided to wait with the fix:
Code:
function ChatFrame_SendTell(name, chatFrame)
    local editBox = ChatEdit_ChooseBoxForSend(chatFrame);
     
    --DEBUG FIXME - for now, we're not going to remove spaces from names. We need to make sure X-server still works.
    -- Remove spaces from the server name for slash command parsing
    --name = gsub(name, " ", "");
 
    if ( editBox ~= ChatEdit_GetActiveWindow() ) then
        ChatFrame_OpenChat(SLASH_WHISPER1.." "..name.." ", chatFrame);
    else
        editBox:SetText(SLASH_WHISPER1.." "..name.." ");
    end
    ChatEdit_ParseText(editBox, 0);
--[[
    chatFrame.editBox:SetAttribute("chatType", "WHISPER");
    chatFrame.editBox:SetAttribute("tellTarget", name);
    ChatEdit_UpdateHeader(chatFrame.editBox);
    if ( editBox ~= ChatEdit_GetActiveWindow() ) then
        ChatFrame_OpenChat("", chatFrame);
    end
]]
end
  Reply With Quote
01-22-12, 12:27 PM   #5
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,360
That looks more like they removed the gsub "hoping" that x-realm will work without it,
We need to make sure X-server still works.
but I can definitely say that it doesn't (in the case of realms with a space in the name)
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Sideeffects from hooking ChatFrame_SendTell()?


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off