Class: Splam::Rules::Bbcode

Inherits:
Splam::Rule show all
Defined in:
lib/splam/rules/bbcode.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
# File 'lib/splam/rules/bbcode.rb', line 3

def run
  add_score 10 * @body.scan("showpost.php?p=").size, "Linking to a shitty forum"
  # add_score 10 * @body.scan("\r\n").size, "Poorly formed POST (\\r\\n)"
  add_score 80 * @body.scan(/\n\[url.*?\]\n/).size, "Shitty bbcode url covers entire line"
  add_score 40 * @body.scan("[url=").size, "URL" # no URLS for you!!
  add_score 40 * @body.scan("[URL=").size, "URL" # no URLS for you!!
  add_score 45 * @body.scan("[url=http").size, "Shitty URL/html" # another 10 points for shitty bbcode html
  add_score 45 * @body.scan("[URL=http").size, "Shitty URL/html" # another 10 points for shitty bbcode html
  add_score 30 * @body.scan("[/CODE").size, "Forum codes?"
  add_score 10 * @body.scan(/\[[bai]/).size, "b/a/i tag"
end