<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,4 +1,6 @@
 require 'vanilla/dynasnip'
+require 'defensio'
+require 'date'
 
 class Comments &lt; Dynasnip
   usage %|
@@ -32,7 +34,9 @@ class Comments &lt; Dynasnip
     
     return &quot;You need to add some details!&quot; if comment.empty?
 
-    unless comment_is_spam?(comment)
+    if comment_is_spam?(comment)
+      &quot;Sorry - your comment looks like spam, according to Defensio :(&quot;
+    else
       Soup &lt;&lt; comment.merge({
        :name =&gt; &quot;#{snip_name}-comment-#{existing_comments.length + 1}&quot;, 
        :commenting_on =&gt; snip_name,
@@ -58,6 +62,7 @@ class Comments &lt; Dynasnip
   end
   
   def comment_is_spam?(comment)
+    snip_date = Date.parse(Soup[app.request.params[:snip]].updated_at)
     Defensio.configure(YAML.load(File.read('defensio.yml')))
     defensio_params = {
       :comment_author_email =&gt; comment[:email], 
@@ -66,9 +71,10 @@ class Comments &lt; Dynasnip
       :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
+      :article_date =&gt; snip_date.strftime(&quot;%Y/%m/%d&quot;)
     }
-    Defensio.audit_comment(defensio_params)[&quot;defensio_result&quot;][&quot;spam&quot;]
+    audit = Defensio.audit_comment(defensio_params)
+    audit[&quot;defensio_result&quot;][&quot;spam&quot;]
   end
   
   attribute :comment_template, %{</diff>
      <filename>lib/vanilla/dynasnips/comments.rb</filename>
    </modified>
    <modified>
      <diff>@@ -28,7 +28,7 @@ module Vanilla
     end
     
     def ip
-      @rack_request.ip
+      @rack_request.env[&quot;REMOTE_ADDR&quot;]
     end
     
     private</diff>
      <filename>lib/vanilla/request.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>0e3d61fb9a6f74ca039ff5ed40fca1a5edb6b6d2</id>
    </parent>
  </parents>
  <author>
    <name>James Adam</name>
    <email>james@lazyatom.com</email>
  </author>
  <url>http://github.com/lazyatom/vanilla-rb/commit/601e2fe80bb15a7720d76da6cc15066e14bbfc13</url>
  <id>601e2fe80bb15a7720d76da6cc15066e14bbfc13</id>
  <committed-date>2008-08-14T14:23:48-07:00</committed-date>
  <authored-date>2008-08-14T14:23:48-07:00</authored-date>
  <message>We need to send the date to Defensio in the right format, and provide the IP.</message>
  <tree>cbb862e5f9a15cdc280e6aff44f6f6c385e2f1d2</tree>
  <committer>
    <name>James Adam</name>
    <email>james@lazyatom.com</email>
  </committer>
</commit>
