Skip to content

Instantly share code, notes, and snippets.

@nagachika
Created September 16, 2010 11:29
Show Gist options
  • Save nagachika/582289 to your computer and use it in GitHub Desktop.
Save nagachika/582289 to your computer and use it in GitHub Desktop.
termtter plugin ignore_extend
# -*- coding: utf-8 -*-
config.filters.ignore_extend.set_default(:conditions, [])
module Termtter::Client
register_hook(
:name => :ignore,
:point => :filter_for_output,
:exec => lambda { |statuses, event|
ignore_conditions = config.filters.ignore_extend.conditions
statuses.delete_if do |s|
ignore_conditions.any? do |cond|
user = cond[:user]
word = cond[:word]
if word.kind_of?(String)
word = /#{Regexp.quote(word)}/
end
((user.nil? or user === s.user.screen_name) and
(word.nil? or word =~ s.text))
end
end
}
)
end
# filter/ignore_extend.rb
# ignore words and user
# setting
# config.filters.ignore_extend.conditions = [ { :user => /name/, :word => /words/ } ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment