Sha256: 92871cad191f9b72b3b798366241f8e8a77ca81399da0520e16acab319dbfb80
Contents?: true
Size: 755 Bytes
Versions: 52
Compression:
Stored size: 755 Bytes
Contents
# # spamlookup.rb: included TDiary::Filter::SpamlookupFilter class # require 'resolv' require 'uri' module TDiary module Filter class SpamlookupFilter < Filter def black_domain?( domain ) begin Resolv.getaddress( "#{domain}.rbl.bulkfeeds.jp" ) return true rescue end false end def black_url?( body ) URI.extract( body, %w[http] ) do |url| domain = URI.parse( url ).host.sub( /\.$/, '' ) return true if black_domain?( domain ) end false end def comment_filter( diary, comment ) !black_url?( comment.body ) end def referer_filter( referer ) !black_url?( referer ) end end end end
Version data entries
52 entries across 46 versions & 2 rubygems