View Single Post
10-02-13, 07:40 AM   #6
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
Join Date: May 2006
Posts: 281
So it should look like this but somehow, the role thingy isn't filtered

Code:
local patternize = function(text)
	text = gsub(text, "%%%d?$?c", ".+")
	text = gsub(text, "%%%d?$?s", ".+")
	text = gsub(text, "%%%d?$?d", "%%d+")
	text = gsub(text, "([%(%)])", "%%%1")

	return text
end

local patterns = {
	patternize(CLEARED_AFK),
	patternize(MARKED_AFK),
	patternize(CLEARED_DND),
	patternize(MARKED_DND),

	patternize(NEW_TITLE_EARNED),
	patternize(ERR_FRIEND_ONLINE_SS),
	patternize(BN_INLINE_TOAST_FRIEND_ONLINE),
	patternize(ERR_FRIEND_OFFLINE_S),
	patternize(BN_INLINE_TOAST_FRIEND_OFFLINE),
	patternize(ERR_LEARN_SPELL_S),
	patternize(ERR_LEARN_ABILITY_S),
	patternize(ERR_LEARN_PASSIVE_S),
	patternize(ERR_SPELL_UNLEARNED_S),
	patternize(ERR_PET_SPELL_UNLEARNED_S),
	patternize(ERR_GUILD_INTERNAL),
	patternize(ROLE_CHANGED_INFORM_WITH_SOURCE),
	patternize(ERR_INSTANCE_GROUP_ADDED_S),
	patternize(ERR_INSTANCE_GROUP_REMOVED_S)
}

ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", function(frame, event, message, ...)
   for i = 1, #patterns do
      if strfind(message, patterns[i]) then
         return true
      end
   end
end)
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }
  Reply With Quote