PDA

View Full Version : How to hide whispers, simple example?


Rokdar
23-02-2007, 09:07 PM
Greetings,

I would like to hide all incoming and outgoing whispers to the mod user when my mod is in a specific state. Are there any simple examples of how to do this?

I know whispercast does this but was hoping to find a more simple example to begin with :grin:

Thanks

Sherkhan
23-02-2007, 10:01 PM
First, overload the ChatFrame_OnEvent handler:
-- Hook into ChatFrame to hide Whisper messages.
old_ChatFrame_OnEvent = ChatFrame_OnEvent;
ChatFrame_OnEvent = New_ChatFrame_OnEvent;

Second, Parse The chat frame Events:

function New_ChatFrame_OnEvent(event)
if( event == "CHAT_MSG_WHISPER" ) then
if (Addon Mode Set) then return; end
end

old_ChatFrame_OnEvent(event);
end

A very simplistic example, but this would hide all incomming or outgoing whispers from the chat frame when a certain addon mode was set. You could in that same block check the message itself (arg1) for a string or a piece of a string to hide it there as well.