? .DS_Store
? .buildpath
? .bzr
? .git
? .project
? .settings
? tmp.patch
? image_captcha/.DS_Store
? image_captcha/fonts/.DS_Store
? image_captcha/fonts/.gitignore
? image_captcha/fonts/1456Gutenberg.TTF
? image_captcha/fonts/Army.ttf
? image_captcha/fonts/BABYK___.TTF
? image_captcha/fonts/LiberationFonts
? image_captcha/fonts/actionj.ttf
? image_captcha/fonts/skinck.ttf
? image_captcha/fonts/subeve.ttf
? image_captcha/fonts/tiza.ttf
Index: captcha.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/captcha/captcha.module,v
retrieving revision 1.90
diff -u -r1.90 captcha.module
--- captcha.module	21 May 2009 11:46:34 -0000	1.90
+++ captcha.module	21 May 2009 16:44:14 -0000
@@ -10,8 +10,6 @@
  *
  */
 
-// TODO: drop preprocess stuff op of hook_captcha, there are better ways to implement this
-
 
 define('CAPTCHA_PERSISTENCE_SHOW_ALWAYS', 1);
 define('CAPTCHA_PERSISTENCE_SKIP_ONCE_SUCCESSFUL_PER_FORM', 2);
@@ -243,7 +241,6 @@
     'type' => $captcha_type_challenge,
     'captcha_sid' => $captcha_sid,
     'solution' => $captcha['solution'],
-    'preprocess' => isset($captcha['preprocess'])? $captcha['preprocess'] : FALSE,
   );
 
   return $element;
@@ -363,14 +360,11 @@
  */
 
 function captcha_validate($element, &$form_state) {
-  // Get answer and preprocess if needed
   $captcha_info = $element['#captcha_info'];
   $form_id = $captcha_info['form_id'];
 
+  // Get CAPTCHA response.
   $captcha_response = $form_state['values']['captcha_response'];
-  if ($captcha_info['preprocess']) {
-    $captcha_response = module_invoke($captcha_info['module'], 'captcha', 'preprocess', $captcha_info['type'], $captcha_response);
-  }
 
   // We use $form_state['clicked_button']['#post']['captcha_sid']
   // instead of $form_state['values']['captcha_sid'] because the latter
Index: captcha_api.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/captcha/captcha_api.txt,v
retrieving revision 1.5
diff -u -r1.5 captcha_api.txt
--- captcha_api.txt	17 Feb 2008 12:49:24 -0000	1.5
+++ captcha_api.txt	21 May 2009 16:44:14 -0000
@@ -38,6 +38,7 @@
         $captcha['form']['captcha_response'] = array(
           '#type' => 'textfield',
           '#title' => t('Enter "foo"'),
+          '#required' => TRUE,
         );
         return $captcha;
       }
@@ -122,38 +123,43 @@
 """
 
 
-=== Optional: preprocess the response ===
+=== Optional: (pre)process the response ===
 In some situations it could be necessary to preprocess the response before
-letting the CAPTCHA module validate it. For example: if you want the validation
-to be case insensitive, you could convert the reponse to lower case.
-To enable response preprocessing:
+letting the CAPTCHA module validate it. For example: remove spaces from the
+response or merge the value of different widgets into one widget value.
+The previous version of the CAPTCHA API (5.x-3.x and 6.x-1.x) contained some
+custom tricks to make this possible, but since version 6.x-2.x it is recommended
+to use the standard Drupal Form API functionality, like the '#process' property.
 
-* Add a non zero 'preprocess' entry to $captcha in the 'generate' part of
-  hook_captcha(). E.g.:
+
+The following example shows how to add a '#process' callback to the captcha_response
+form element, and how that callback can process the response with a fictional
+remove_spaces() function.
 
 """
+/**
+ * Implementation of hook_captcha().
+ */
 function foo_captcha_captcha($op, $captcha_type='') {
-  switch($op) {
-    ...
+  switch ($op) {
+...
     case 'generate':
       if ($captcha_type == 'Foo CAPTCHA') {
-        ...
-        $captcha['preprocess'] = TRUE,
-        ...
-"""
-
-* Add a 'preprocess' operation to hook_captcha() and add a $response argument
-  to the function signature. E.g.:
+...
+        $captcha['form']['captcha_response'] = array(
+          '#type' => 'textfield',
+          '#title' => t('Enter "foo"'),
+          '#required' => TRUE,
+          '#process' => array('foo_captcha_process'),
+        );
+...
+}
 
+/**
+ * Process the response to the foo CAPTCHA before validation.
+ */
+function foo_captcha_process($element, $edit, &$form_state, $complete_form) {
+  $element['#value'] = remove_spaces($element['#value']);
+  return $element;
+}
 """
-function foo_captcha_captcha($op, $captcha_type='', $response='') {
-  switch($op) {
-    ...
-    case 'preprocess':
-      if ($captcha_type == 'Foo CAPTCHA') {
-        return strtolower($response);
-      }
-      break;
-    ...
-"""
-
