# File lib/network/protocol/colorfilter.rb, line 28
  def filter_out(str)
    return "" if str.nil? || str.empty?
    if @pstack.color_on
      str.gsub!(/\[COLOR\s+(\w+)\s+ON\s+(\w+)\]/mi) do |m|
        if ColorTable[$1] && ColorTable[$2]
          ColorTable[$1][2]+ColorTable[$2][3]
        else
          ''
        end
      end
      str.gsub!(/\[COLOR\s+(\w+)\]/mi) do |m|
        if ColorTable[$1]
          ColorTable[$1][2]
        else
          ''
        end
      end
      str.gsub!(/\[\/COLOR\]/mi) do |m|
        ANSICODE['reset']
      end
      str.gsub!(/\[[BI]\]/mi) do |m|
        ANSICODE['bold']
      end
      str.gsub!(/\[U\]/mi) do |m|
        ANSICODE['underline']
      end
      str.gsub!(/\[\/[BUI]\]/mi) do |m|
        ANSICODE['reset']
      end
    else
      str.gsub!(/\[COLOR\s+(\w+)\s+ON\s+(\w+)\]/mi,'')
      str.gsub!(/\[COLOR\s+(\w+)\]|\[\/COLOR\]/mi, '')
      str.gsub!(/\[SIZE .*?\]|\[\/SIZE\]/mi, '')
      str.gsub!(/\[FONT .*?\]|\[\/FONT\]/mi, '')
      str.gsub!(/\[[BUI]\]|\[\/[BUI]\]/mi, '')
    end
    str
  end