<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/defensio.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -29,13 +29,17 @@ class Comments &lt; Dynasnip
     snip_name = app.request.params[:snip]
     existing_comments = Soup.sieve(:commenting_on =&gt; snip_name)
     comment = app.request.params.reject { |k,v| ![:author, :email, :website, :content].include?(k) }
+    
     return &quot;You need to add some details!&quot; if comment.empty?
-    Soup &lt;&lt; comment.merge({
-     :name =&gt; &quot;#{snip_name}-comment-#{existing_comments.length + 1}&quot;, 
-     :commenting_on =&gt; snip_name,
-     :created_at =&gt; Time.now
-    })
-    &quot;Thanks for your comment! Back to {link_to #{snip_name}}&quot;
+
+    unless comment_is_spam?(comment)
+      Soup &lt;&lt; comment.merge({
+       :name =&gt; &quot;#{snip_name}-comment-#{existing_comments.length + 1}&quot;, 
+       :commenting_on =&gt; snip_name,
+       :created_at =&gt; Time.now
+      })
+      &quot;Thanks for your comment! Back to {link_to #{snip_name}}&quot;
+    end
   end
   
   def render_comments(comments)
@@ -53,6 +57,20 @@ class Comments &lt; Dynasnip
     end.join + &quot;&lt;/ol&gt;&quot;    
   end
   
+  def comment_is_spam?(comment)
+    Defensio.configure(YAML.load(File.read('defensio.yml')))
+    defensio_params = {
+      :comment_author_email =&gt; comment[:email], 
+      :comment_author =&gt; comment[:author], 
+      :comment_author_url =&gt; comment[:website],
+      :comment_content =&gt; comment[:content],
+      :comment_type =&gt; &quot;comment&quot;, 
+      :user_ip =&gt; app.request.ip, 
+      :article_date =&gt; Soup[app.request.params[:snip]].updated_at
+    }
+    Defensio.audit_comment(defensio_params)[&quot;defensio_result&quot;][&quot;spam&quot;]
+  end
+  
   attribute :comment_template, %{
     &lt;li&gt;
       &lt;p&gt;COMMENT_AUTHOR (COMMENT_DATE)&lt;/p&gt;</diff>
      <filename>lib/vanilla/dynasnips/comments.rb</filename>
    </modified>
    <modified>
      <diff>@@ -27,6 +27,10 @@ module Vanilla
       @rack_request.cookies
     end
     
+    def ip
+      @rack_request.ip
+    end
+    
     private
     
     def determine_request_uri_parts</diff>
      <filename>lib/vanilla/request.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>94da3d6a49212ce6b58d8343b8986dd87f93101a</id>
    </parent>
  </parents>
  <author>
    <name>James Adam</name>
    <email>james@lazyatom.com</email>
  </author>
  <url>http://github.com/lazyatom/vanilla-rb/commit/0e3d61fb9a6f74ca039ff5ed40fca1a5edb6b6d2</url>
  <id>0e3d61fb9a6f74ca039ff5ed40fca1a5edb6b6d2</id>
  <committed-date>2008-08-14T09:32:59-07:00</committed-date>
  <authored-date>2008-08-14T09:32:59-07:00</authored-date>
  <message>Lets check with defensio to see if a comment is spam.</message>
  <tree>fabc778e9684d7f8d1c29ddec3f4310bfe83cbb8</tree>
  <committer>
    <name>James Adam</name>
    <email>james@lazyatom.com</email>
  </committer>
</commit>
