Index: mollom.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mollom/mollom.module,v
retrieving revision 1.89
diff -u -p -r1.89 mollom.module
--- mollom.module	9 Oct 2010 23:13:01 -0000	1.89
+++ mollom.module	12 Oct 2010 14:21:34 -0000
@@ -1062,6 +1062,13 @@ function mollom_form_get_values($form_va
   // User IP.
   $data['author_ip'] = ip_address();
 
+  // Spambot trap.
+  // Send capture and send the actually submitted value, so Mollom can evaluate
+  // it (usually a URL).
+  if (isset($form_values['mollom']['homepage']) && $form_values['mollom']['homepage'] !== '') {
+    $data['post_honeypot'] = $form_values['mollom']['homepage'];
+  }
+
   return $data;
 }
 
@@ -1320,6 +1327,18 @@ function mollom_process_mollom($element,
     $element['captcha']['#access'] = FALSE;
   }
 
+  // Add a spambot trap. Purposively use 'homepage' as field name.
+  $element['homepage'] = array(
+    '#type' => 'textfield',
+    // @todo Ping accessibility team to confirm that this is correct.
+    '#title' => t('Leave this field blank'),
+    // @todo #title_display 'attribute' does not work for #type textfield... grumble.
+    '#title_display' => 'attribute',
+    // @todo .element-invisible class is only applied on the INPUT, but we need
+    //   it on the wrapping DIV.form-item container to not hi-jack themes.
+    #'#attributes' => array('class' => array('element-invisible')),
+  );
+
   // Make Mollom form and session information available to entirely different
   // functions.
   $GLOBALS['mollom'] = &$form_state['mollom'];
@@ -1495,8 +1514,13 @@ function mollom_validate_captcha(&$form,
     'session_id' => $form_state['mollom']['response']['session_id'],
     'captcha_result' => $form_state['values']['mollom']['captcha'],
     'author_ip' => $all_data['author_ip'],
-    'author_id' => isset($all_data['author_id']) ? $all_data['author_id'] : NULL,
   );
+  if (isset($all_data['author_id'])) {
+    $data['author_id'] = $all_data['author_id'];
+  }
+  if (isset($all_data['post_honeypot'])) {
+    $data['post_honeypot'] = $all_data['post_honeypot'];
+  }
   $result = mollom('mollom.checkCaptcha', $data);
   // Use all available data properties for log messages below.
   $data += $all_data;
