I've been trying to print spell links in channels like guild chat, party chat, whisper, using SendChatMessage, and I can't figure out how to do it. Either I get errors ("SendChatMessage(): Invalid escape code in chat message"), or it shows as plain text rather than a clickable link, or in worst case I get disconnected.
I looked through Chatter's code, and if I remember right Prat does it similarly, it sends a custom "packet" instead of the actual link and assembles in on the receiver side by parsing the hooked AddMessage. However this is something I want to avoid since it needs an addon installed by everybody in the channel I send the link to. I was hoping this is required only for linking by shift-click, but after exhausting all I can think of it seems like it's just not possible to send a link thorugh any means.
So the question I have, is there any way at all to have an addon print a spell link to raid chat, guild chat or a custom channel, without anything being required to display it properly, or it's just impossible to do?
Note that the spell will refuse to link properly (will just be plain text) if the server has not seen the spell before since the last serve restart (works just like itemlinks), and you can get disconnected.
Thank you very much for your replies, I got it working! I was looking at the wrong cause of my problem, and the posts here helped me refine it down to where it belonged.
In the same vein I have troubles with colouring parts of the message in SendChatMessage. Say I want to send a message that has text and spell links, and I want to use different colours for some words in the text. At the moment, if I don't use any colours for the text, the message is printed correctly, both text and links (tested with party channel). However if I use colour codes in the message, I get disconnected. The colour codes are like "|cffff0000<text>|r"
Is this something that can't be done or am I doing it the wrong way?