View Single Post
Old 01-22-13, 04:52 PM   #22
SDPhantom
A Molten Giant
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 941
I guess I got a little confused on what the OP wanted to do. I thought we were still talking about links.
My explanation on channel links are to allow the user of the addon to click the link and open chat to that channel (relative to the user of course).

I'm going to try to condense this entire conversation into an easy explanation. To start with, we'll examine what happens when you send a message into chat. It all starts with a call to SendChatMessage(), which in turn, sends the message out to the chat servers. This is all it does, this function alone has nothing to do with displaying anything to the user. In addition to forwarding the message out to the intended people, the chat server responds with an echo, the message you sent as normal chat event. This is picked up by the OnEvent handler of any frame that has the respective event registered. The OnEvent handler set on the ChatFrames process this echo that looks exactly like any other chat message, formats it, and calls ChatFrame:AddMessage() to display it. This should explain what the difference is between these two functions.

On to UI Escape Sequences. These generally can be used on any widget that displays text, like FontStrings. Though, ChatFrames are the only widget that allows you to click links. This is the only part of the WoW API where these are of any significance. Everywhere else, they're nothing more than just contents of a string. When it comes to sending a message though SendChatMessage(), with few exceptions, UI Escape Sequences are forbidden. These exceptions being full links (links including the appropriate color codes generated with them). Note that not all links are supported by SendChatMessage(). Additional restrictions do apply.

For more information, see the following links:
SendChatMessage()
ChatFrame:AddMessage()
UI Escape Sequences
__________________
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 01-22-13 at 04:59 PM.
SDPhantom is offline   Reply With Quote