View Single Post
09-11-16, 01:22 AM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
This should work:

Code:
local DESTINATION = UIErrorsFrame

local ONLINE = ERR_FRIEND_ONLINE_SS:gsub("%%s", "(.+)"):gsub("[%[%]]", "%%%1")
local OFFLINE = ERR_FRIEND_OFFLINE_S:gsub("%%s", "(.+)")

local f = CreateFrame("Frame")
f:RegisterEvent("CHAT_MSG_SYSTEM")
f:SetScript("OnEvent", function(self, event, text)
	if text:match(ONLINE) then
		DESTINATION:AddMessage(text:gsub("%[(.-)%]", "%1"), 0.3, 1, 0.3)
	elseif text:match(OFFLINE) then
		DESTINATION:AddMessage(text, .6, .6, .6)
	end
end)
Change the first line if you want to send the messages to some other chat frame, eg. ChatFrame3

Use Vlad's addon creator tool to turn the code into an addon.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote