Class: Splam::Rules::User

Inherits:
Splam::Rule show all
Defined in:
lib/splam/rules/user.rb

Instance Attribute Summary

Attributes inherited from Splam::Rule

#body, #reasons, #score, #suite, #weight

Instance Method Summary collapse

Methods inherited from Splam::Rule

#add_score, inherited, #initialize, #line_safe?, #name, run

Constructor Details

This class inherits a constructor from Splam::Rule

Instance Method Details

#runObject



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/splam/rules/user.rb', line 3

def run
  bad_words = ["qq.com", "yahoo.cn", "126.com"]
  bad_words |= %w( mortgage )

  bad_words.each do |word|
    add_score 50, "User's email address has suspicious parts: #{word}" if @user.email.include?(word)
  end
  
  add_score "20", "User has lots and lots of dots" if @user.email.split("@")[0].scan(/\./).size > 5
  
  add_score 5, "User is untrusted" if !@user.trusted?
end