I do something similar in my personal addon where I hide and redirect LocalDefense spam to print() so that it doesn't trigger the channel sound I have set in Prat. With some minor tweaks, this should work for your usage.
What I have:
lua Code:
local frame=CreateFrame('frame')
function frame:PLAYER_LOGIN()
ChatFrame_AddMessageEventFilter('CHAT_MSG_CHANNEL',function(_,_,_,sender,_,chan,_,_,_,_,_,_,_,guid)
if strmatch(chan,'LocalDefense') and sender=='' and not guid then return true end
end) -- hides local defense system spam
end
function frame:CHAT_MSG_CHANNEL(msg,sender,_,chan,_,_,_,_,_,_,_,guid)
if strmatch(chan,'LocalDefense') and sender=='' and not guid then print(msg) end
end -- prints local defense system spam to ChatFrame1
frame:RegisterEvent('PLAYER_LOGIN')
frame:RegisterEvent('CHAT_MSG_CHANNEL')
frame:SetScript('OnEvent',function(self,event,...)self[event](self,...)end)
What should work for you:
lua Code:
local frame=CreateFrame("frame")
function frame:PLAYER_LOGIN()
ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM",function(_,_,msg)
if strmatch(msg,FRIENDS_LIST_ONLINE)
or strmatch(msg,FRIENDS_LIST_OFFLINE)
-- or strmatch(msg,VARIABLE_CONTAINING_STRING)
-- or strmatch(msg,"manually entered string")
then return true end
end)
end
function frame:CHAT_MSG_SYSTEM(msg)
if strmatch(msg,FRIENDS_LIST_ONLINE)
or strmatch(msg,FRIENDS_LIST_OFFLINE)
-- or strmatch(msg,VARIABLE_CONTAINING_STRING)
-- or strmatch(msg,"manually entered string")
then print(msg) end
end
frame:RegisterEvent("PLAYER_LOGIN")
frame:RegisterEvent("CHAT_MSG_SYSTEM")
frame:SetScript("OnEvent",function(self,event,...)self[event](self,...)end)
To reroute more system messages, just add another strmatch line to both blocks as shown above. Make sure to remove the -- at the beginning of the line for things you add. If you are not familiar with making an addon, paste the above into
http://addon.bool.no and it'll give you a zip file you can install like any other addon.