Thread Tools Display Modes
07-13-06, 09:04 AM   #1
Sungam
A Defias Bandit
Join Date: Aug 2005
Posts: 3
Catching chat messages and replacing text... a problem.

Hey there.

So, long story short, a project I'm working on catches links created by some addons, converts those links into ChatLink format, and passes them along.

I do this by hooking the ChatFrame_OnEvent function, checking if any links are present - and if they are, replace them - and finally call the original ChatFrame_OnEvent function, with my modified message as the second argument (first being "event").

The function catches the messages just fine (and only the ones it's supposed to), and does the replacement perfectly. I can see this by printing directly to the message log.
However, when I try to call the original ChatFrame_OnEvent function, it doesn't seem to care at all that I modified the message. It just passes the original, unmodified message along, as if nothing ever happened. How it even has this data, I've no idea.

Is this some sort of security measurement in the original function, or am I doing something terribly stupid? Is there a known way to circumvent this behaviour?

Thanks in advance.
  Reply With Quote
07-13-06, 01:46 PM   #2
Esamynn
Featured Artist
Premium Member
Featured
Join Date: Jan 2005
Posts: 395
The default ChatFrame_OnEvent function only takes 1 argument, the event. In order to modify the message it prints to the chat window you need to modify the contents of the global arg1 variable.
  Reply With Quote
07-14-06, 07:46 AM   #3
Sungam
A Defias Bandit
Join Date: Aug 2005
Posts: 3
D'oh. I had copied over the function from another addon, which used arg1 through arg9 as parameters.
Removing all but 'event' did the trick. Thanks a ton
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Catching chat messages and replacing text... a problem.


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