Index: mollom.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mollom/mollom.admin.inc,v
retrieving revision 1.16
diff -u -p -r1.16 mollom.admin.inc
--- mollom.admin.inc	17 Feb 2010 16:01:01 -0000	1.16
+++ mollom.admin.inc	6 Mar 2010 22:32:21 -0000
@@ -52,16 +52,16 @@ function mollom_admin_form_list() {
  */
 function mollom_admin_form_options() {
   // Retrieve all registered forms.
-  $form_info = mollom_get_form_info();
+  $form_list = mollom_form_list();
 
   // Remove already configured form ids.
   $result = db_query('SELECT form_id FROM {mollom_form}')->fetchCol();
   foreach ($result as $form_id) {
-    unset($form_info[$form_id]);
+    unset($form_list[$form_id]);
   }
   // If all registered forms are configured already, output a message, and
   // redirect the user back to overview.
-  if (empty($form_info)) {
+  if (empty($form_list)) {
     drupal_set_message(t('All available forms are protected already.'));
     drupal_goto('admin/config/content/mollom');
   }
@@ -75,13 +75,13 @@ function mollom_admin_form_options() {
   }
 
   // Transform form information into an associative array suitable for #options.
-  foreach ($form_info as $form_id => $info) {
-    $form_info[$form_id] = $modules[$info['module']] . ': ' . $info['title'];
+  foreach ($form_list as $form_id => $info) {
+    $form_list[$form_id] = $modules[$info['module']] . ': ' . $info['title'];
   }
   // Sort form options by title.
-  asort($form_info);
+  asort($form_list);
 
-  return $form_info;
+  return $form_list;
 }
 
 /**
@@ -190,7 +190,9 @@ function mollom_admin_configure_form_nex
   $form_id = $form_state['values']['mollom']['form_id'];
 
   // Load form information into $form_state for configuration.
-  $mollom_form = mollom_get_form_info($form_id);
+  $form_list = mollom_form_list();
+  $mollom_form = mollom_form_info($form_id, $form_list[$form_id]['module']);
+
   // Enable all fields for textual analysis by default.
   if (!empty($mollom_form['mode']) && !empty($mollom_form['elements'])) {
     $mollom_form['enabled_fields'] = array_keys($mollom_form['elements']);
@@ -664,7 +666,7 @@ function mollom_reports_page($form, &$fo
     '#title' => t('Statistics'),
     '#markup' => '<embed' . drupal_attributes($embed_attributes) . '></embed>',
   );
-  
+
   return $form;
 }
 
Index: mollom.api.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mollom/mollom.api.php,v
retrieving revision 1.2
diff -u -p -r1.2 mollom.api.php
--- mollom.api.php	21 Dec 2009 07:51:32 -0000	1.2
+++ mollom.api.php	6 Mar 2010 22:33:32 -0000
@@ -14,17 +14,55 @@
  * configurable in Mollom's administration interface.
  *
  * @return
- *   An associative array containing information about forms that can be
- *   protected. Each key is a $form_id whose value is an associative array:
+ *   An associative array containing information about the forms that can be
+ *   protected, keyed by $form_id:
+ *   - title: The human-readable name of the form.
+ *   - entity: (optional) The internal name of the entity type the form is for,
+ *     e.g. 'node' or 'comment'. See hook_mollom_form_info() for details.
+ *   - report access callback: (optional) A function name to invoke to check
+ *     access to Mollom's dedicated "report to Mollom" form, which should return
+ *     either TRUE or FALSE (like any other menu "access callback").
+ *   - report access: (optional) A list containing user permission strings, from
+ *     which the current user needs to have at least one. Should only be used if
+ *     no "report access callback" was defined.
+ *   - report delete callback: (optional) A function name to invoke to delete an
+ *     entity after reporting it to Mollom.
+ *
+ * @see See hook_mollom_form_info()
+ */
+function hook_mollom_form_list() {
+  // Mymodule's comment form.
+  $forms['mymodule_comment_form'] = array(
+    'title' => t('Comment form'),
+    'entity' => 'mymodule_comment',
+    'report access callback' => 'mymodule_comment_report_access',
+    'report delete callback' => 'mymodule_comment_report_delete',
+  );
+  // Mymodule's user registration form.
+  $forms['mymodule_user_register'] = array(
+    'title' => t('User registration form'),
+    'entity' => 'user',
+    'report access' => array('administer comments', 'bypass node access'),
+    // Make it private, so it's not a hook_user_delete() implementation.
+    'report delete callback' => '_mymodule_user_delete',
+  );
+  return $forms;
+}
+
+/**
+ * Return information about a form that can be protected by Mollom.
+ *
+ * @param $form_id
+ *   The form id to return information for.
+ *
+ * @return
+ *   An associative array describing the form identified by $form_id:
  *   - title: The human-readable name of the form.
  *   - mode: (optional) The default protection mode for the form, which can be
  *     one of:
- *     - MOLLOM_MODE_DISABLED: No protection.
- *     - MOLLOM_MODE_CAPTCHA: CAPTCHA-only protection.
  *     - MOLLOM_MODE_ANALYSIS: Text analysis of submitted form values with
  *       fallback to CAPTCHA.
- *     If omitted, the form will not be configured upon installation of Mollom
- *     module.
+ *     - MOLLOM_MODE_CAPTCHA: CAPTCHA-only protection.
  *   - bypass access: (optional) A list of user permissions to check for the
  *     current user to determine whether to protect the form with Mollom or do
  *     not validate submitted form values. If the current user has at least one
@@ -72,50 +110,59 @@
  *     - author_ip: Mollom automatically assigns the user's IP address if no
  *       explicit form element value mapping was specified.
  */
-function hook_mollom_form_info() {
-  // Mymodule's comment form.
-  $forms['mymodule_comment_form'] = array(
-    'title' => t('Comment form'),
-    'mode' => MOLLOM_MODE_ANALYSIS,
-    'bypass access' => array('administer comments'),
-    'entity' => 'comment',
-    'elements' => array(
-      'subject' => t('Subject'),
-      'body' => t('Body'),
-    ),
-    'mapping' => array(
-      'post_id' => 'cid',
-      'post_title' => 'subject',
-      'author_name' => 'name',
-      'author_mail' => 'mail',
-      'author_url' => 'homepage',
-    ),
-  );
-  // Mymodule's user registration form.
-  $forms['mymodule_user_register'] = array(
-    'title' => t('User registration form'),
-    'mode' => MOLLOM_MODE_CAPTCHA,
-    'entity' => 'user',
-    'mapping' => array(
-      'post_id' => 'uid',
-      'author_name' => 'name',
-      'author_mail' => 'mail',
-    ),
-  );
+function hook_mollom_form_info($form_id) {
+  switch ($form_id) {
+    // Mymodule's comment form.
+    case 'mymodule_comment_form':
+      $form_info = array(
+        'title' => t('Comment form'),
+        'mode' => MOLLOM_MODE_ANALYSIS,
+        'bypass access' => array('administer comments'),
+        'entity' => 'comment',
+        'elements' => array(
+          'subject' => t('Subject'),
+          'body' => t('Body'),
+        ),
+        'mapping' => array(
+          'post_id' => 'cid',
+          'post_title' => 'subject',
+          'author_name' => 'name',
+          'author_mail' => 'mail',
+          'author_url' => 'homepage',
+        ),
+      );
+      return $form_info;
+
+    // Mymodule's user registration form.
+    case 'mymodule_user_register':
+      $form_info = array(
+        'title' => t('User registration form'),
+        'mode' => MOLLOM_MODE_CAPTCHA,
+        'entity' => 'user',
+        'mapping' => array(
+          'post_id' => 'uid',
+          'author_name' => 'name',
+          'author_mail' => 'mail',
+        ),
+      );
+      return $form_info;
+  }
 
   return $forms;
 }
 
 /**
- * Alter registered information about forms that can be protected by Mollom.
+ * Alter registered information about a form that can be protected by Mollom.
  *
  * @param &$form_info
- *   An associative array containing protectable forms. See
+ *   An associative array describing the protectable form. See
  *   hook_mollom_form_info() for details.
+ * @param $form_id
+ *   The $form_id of the form.
  */
-function hook_mollom_form_info_alter(&$form_info) {
-  if (isset($form_info['comment_form'])) {
-    $form_info['comment_form']['elements']['mymodule_field'] = t('My additional field');
+function hook_mollom_form_info_alter(&$form_info, $form_id) {
+  if ($form_id == 'comment_form') {
+    $form_info['elements']['mymodule_field'] = t('My additional field');
   }
 }
 
Index: mollom.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mollom/mollom.install,v
retrieving revision 1.13
diff -u -p -r1.13 mollom.install
--- mollom.install	22 Feb 2010 14:01:48 -0000	1.13
+++ mollom.install	6 Mar 2010 22:37:38 -0000
@@ -133,35 +133,6 @@ function mollom_schema() {
 }
 
 /**
- * Implements hook_install().
- */
-function mollom_install() {
-  // Install default form configuration for enabled, supported modules.
-  foreach (module_list(FALSE, FALSE) as $module) {
-    drupal_load('module', $module);
-  }
-  drupal_load('module', 'mollom');
-
-  $form_info = mollom_get_form_info();
-  $query = db_insert('mollom_form')
-    ->fields(array('form_id', 'mode', 'enabled_fields', 'module'));
-  foreach ($form_info as $form_id => $info) {
-    if (!empty($info['mode'])) {
-      $info['enabled_fields'] = array_keys($info['elements']);
-      // Upon installation, our own schema is not available yet, so we cannot
-      // use mollom_form_save(), resp. drupal_write_record().
-      $query->values(array(
-        $info['form_id'],
-        $info['mode'],
-        serialize($info['enabled_fields']),
-        $info['module'],
-      ));
-    }
-  }
-  $query->execute();
-}
-
-/**
  * Implements hook_uninstall().
  */
 function mollom_uninstall() {
@@ -187,18 +158,17 @@ function mollom_update_2() {
  * Upgrade form protection storage.
  */
 function mollom_update_3() {
-  // Load mollom_get_form_info() and hook_mollom_form_info() implementations.
+  // Load hook_mollom_form_info() implementations for mollom_form_list().
   foreach (module_list(FALSE, FALSE) as $module) {
     drupal_load('module', $module);
   }
   drupal_load('module', 'mollom');
 
-  foreach (mollom_get_form_info() as $form_id => $info) {
+  foreach (mollom_form_list() as $form_id => $info) {
     $name = 'mollom_' . $form_id;
     $mode = variable_get($name, NULL);
-    // $mode was stored as 1; default to MOLLOM_MODE_ANALYSIS if the form
-    // supports it.
-    if (isset($mode) && $info['mode'] == MOLLOM_MODE_ANALYSIS) {
+    // $mode was stored as 1; convert to MOLLOM_MODE_ANALYSIS.
+    if (isset($mode)) {
       variable_set($name, MOLLOM_MODE_ANALYSIS);
     }
   }
@@ -255,20 +225,24 @@ function mollom_update_6105() {
   }
   drupal_load('module', 'mollom');
 
-  // Ensure that we don't get stale form or schema information.
-  drupal_static_reset('mollom_get_form_info');
-  drupal_get_schema('mollom_form', TRUE);
 
-  $form_info = mollom_get_form_info();
+  $form_list = mollom_form_list();
   $result = db_query("SELECT name, value FROM {variable} WHERE name LIKE 'mollom_%%' AND name NOT IN ('mollom_servers', 'mollom_fallback', 'mollom_public_key', 'mollom_private_key')");
   foreach ($result as $row) {
     $form_id = substr($row->name, 7);
     $mode = unserialize($row->value);
-    if (!empty($mode) && isset($form_info[$form_id])) {
-      $info = $form_info[$form_id];
-      $info['mode'] = $mode;
-      $info['enabled_fields'] = array_keys($info['elements']);
-      mollom_form_save($info);
+    if (!empty($mode) && isset($form_list[$form_id])) {
+      $info = $form_list[$form_id];
+      $info += module_form_info($form_id, $info['module']);
+      $info['enabled_fields'] = ($mode == MOLLOM_MODE_ANALYSIS ? array_keys($info['elements']) : array());
+      db_insert('mollom_form')
+        ->fields(array(
+          'form_id' => $form_id,
+          'mode' => $mode,
+          'enabled_fields' => serialize($info['enabled_fields']),
+          'module' => $info['module'],
+        ))
+        ->execute();
     }
     variable_del($row->name);
   }
Index: mollom.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mollom/mollom.module,v
retrieving revision 1.30
diff -u -p -r1.30 mollom.module
--- mollom.module	3 Mar 2010 19:16:35 -0000	1.30
+++ mollom.module	6 Mar 2010 23:44:12 -0000
@@ -253,7 +253,7 @@ function mollom_report_access($entity, $
   // Retrieve information about all protectable forms. We use the first valid
   // definition, because we assume that multiple form definitions just denote
   // variations of the same entity (e.g. node content types).
-  foreach (mollom_get_form_info() as $form_id => $info) {
+  foreach (mollom_form_list() as $form_id => $info) {
     if (!isset($info['entity']) || $info['entity'] != $entity) {
       continue;
     }
@@ -383,10 +383,16 @@ function mollom_data_delete($entity, $id
  * necessary.
  */
 function mollom_form_alter(&$form, &$form_state, $form_id) {
+  static $protected_forms;
+
   // Site administrators don't have their content checked with Mollom.
   if (!user_access('bypass mollom protection') && _mollom_status() === TRUE) {
+    // Retrieve a list of all protected forms once.
+    if (!isset($protected_forms)) {
+      $protected_forms = db_query("SELECT form_id, module FROM {mollom_form}")->fetchAllKeyed();
+    }
     // Retrieve configuration for this form.
-    if ($mollom_form = mollom_form_load($form_id)) {
+    if (isset($protected_forms[$form_id]) && $mollom_form = mollom_form_load($form_id)) {
       // Determine whether to bypass validation for the current user.
       foreach ($mollom_form['bypass access'] as $permission) {
         if (user_access($permission)) {
@@ -453,45 +459,53 @@ function mollom_get_mode($form_id) {
 }
 
 /**
- * Returns information about protectable forms registered via hook_mollom_form_info().
- *
- * @param $form_id
- *   (optional) The form id to return information for. If omitted, information
- *   for all registered forms is returned.
+ * Returns a list of protectable forms registered via hook_mollom_form_info().
  */
-function mollom_get_form_info($form_id = NULL) {
-  $form_info = &drupal_static(__FUNCTION__);
-
-  if (!isset($form_info)) {
-    $form_info = array();
-    foreach (module_implements('mollom_form_info') as $module) {
-      $function = $module . '_mollom_form_info';
-      $module_forms = $function();
-      if (isset($module_forms) && is_array($module_forms)) {
-        foreach ($module_forms as $id => $info) {
-          // Ensure basic properties for all forms.
-          $module_forms[$id] += array(
-            'form_id' => $id,
-            'module' => $module,
-            'entity' => NULL,
-            'title' => $id,
-            'mode' => NULL,
-            'bypass access' => array(),
-            'elements' => array(),
-            'mapping' => array(),
-          );
-        }
-        $form_info = array_merge_recursive($form_info, $module_forms);
-      }
+function mollom_form_list() {
+  $form_list = array();
+  foreach (module_implements('mollom_form_list') as $module) {
+    $function = $module . '_mollom_form_list';
+    $module_forms = $function();
+    foreach ($module_forms as $form_id => $info) {
+      $form_list[$form_id] = $info;
+      $form_list[$form_id] += array(
+        'form_id' => $form_id,
+        'module' => $module,
+      );
     }
-
-    // Allow modules to alter the default form information.
-    drupal_alter('mollom_form_info', $form_info);
   }
+  return $form_list;
+}
 
-  if (isset($form_id)) {
-    return isset($form_info[$form_id]) ? $form_info[$form_id] : array();
+/**
+ * Returns information about a form registered via hook_mollom_form_info().
+ *
+ * @param $form_id
+ *   The form id to return information for.
+ * @param $module
+ *   The module name $form_id belongs to.
+ */
+function mollom_form_info($form_id, $module) {
+  $form_info = module_invoke($module, 'mollom_form_info', $form_id);
+  if (empty($form_info)) {
+    $form_info = array();
   }
+
+  // Ensure basic properties for all forms.
+  $form_info += array(
+    'form_id' => $form_id,
+    'module' => $module,
+    'entity' => NULL,
+    'title' => $form_id,
+    'mode' => NULL,
+    'bypass access' => array(),
+    'elements' => array(),
+    'mapping' => array(),
+  );
+
+  // Allow modules to alter the default form information.
+  drupal_alter('mollom_form_info', $form_info, $form_id);
+
   return $form_info;
 }
 
@@ -504,7 +518,7 @@ function mollom_form_load($form_id) {
     $mollom_form['enabled_fields'] = unserialize($mollom_form['enabled_fields']);
 
     // Attach form registry information.
-    $mollom_form += mollom_get_form_info($form_id);
+    $mollom_form += mollom_form_info($form_id, $mollom_form['module']);
 
     // Ensure default values (partially for administrative configuration).
     $mollom_form += array(
@@ -1383,47 +1397,62 @@ function mollom_field_extra_fields() {
  */
 
 /**
- * Implements hook_mollom_form_info().
+ * Implements hook_mollom_form_list().
  */
-function node_mollom_form_info() {
-  $types = node_type_get_types('types');
+function node_mollom_form_list() {
   $forms = array();
-  foreach ($types as $type) {
+  foreach (node_type_get_types() as $type) {
     $form_id = $type->type . '_node_form';
     $forms[$form_id] = array(
       'title' => t('@name form', array('@name' => $type->name)),
-      // @todo This is incompatible with node access.
-      'bypass access' => array('bypass node access', 'edit any ' . $type->type . ' content'),
+      'entity' => 'node',
       'report access callback' => 'node_mollom_report_access',
       'report delete callback' => 'node_mollom_report_delete',
-      'entity' => 'node',
-      'elements' => array(),
-      'mapping' => array(
-        'post_id' => 'nid',
-        'author_name' => 'name',
-      ),
     );
-    // @see node_content_form()
-    if ($type->has_title) {
-      $forms[$form_id]['elements']['title'] = check_plain($type->title_label);
-      $forms[$form_id]['mapping']['post_title'] = 'title';
-    }
-    if ($type->has_body) {
-      $forms[$form_id]['elements']['body'] = check_plain($type->body_label);
-    }
-    // Add CCK fields by default.
-    if (module_exists('content')) {
-      $content_info = content_types($type->type);
-      foreach ($content_info['fields'] as $field_name => $field) {
-        // We only consider text fields for text analysis.
-        if ($field['type'] == 'text') {
-          $forms[$form_id]['elements'][$field_name] = check_plain(t($field['widget']['label']));
-        }
+  }
+  return $forms;
+}
+
+/**
+ * Implements hook_mollom_form_info().
+ */
+function node_mollom_form_info($form_id) {
+  // Retrieve internal type from $form_id.
+  $nodetype = drupal_substr($form_id, 0, -10);
+
+  $type = node_type_get_type($nodetype);
+  $form_info = array(
+    'title' => t('@name form', array('@name' => $type->name)),
+    // @todo This is incompatible with node access.
+    'bypass access' => array('bypass node access', 'edit any ' . $type->type . ' content'),
+    'entity' => 'node',
+    'elements' => array(),
+    'mapping' => array(
+      'post_id' => 'nid',
+      'author_name' => 'name',
+    ),
+  );
+  // @see node_content_form()
+  if ($type->has_title) {
+    $form_info['elements']['title'] = check_plain($type->title_label);
+    $form_info['mapping']['post_title'] = 'title';
+  }
+  if ($type->has_body) {
+    $form_info['elements']['body'] = check_plain($type->body_label);
+  }
+
+  // Add CCK fields by default.
+  if (module_exists('content')) {
+    $content_info = content_types($type->type);
+    foreach ($content_info['fields'] as $field_name => $field) {
+      // We only consider text fields for text analysis.
+      if ($field['type'] == 'text') {
+        $form_info['elements'][$field_name] = check_plain(t($field['widget']['label']));
       }
     }
   }
 
-  return $forms;
+  return $form_info;
 }
 
 /**
@@ -1493,15 +1522,26 @@ function node_mollom_report_delete($enti
  */
 
 /**
- * Implements hook_mollom_form_info().
+ * Implements hook_mollom_form_list().
  */
-function comment_mollom_form_info() {
+function comment_mollom_form_list() {
   $forms['comment_form'] = array(
     'title' => t('Comment form'),
-    'mode' => MOLLOM_MODE_ANALYSIS,
-    'bypass access' => array('administer comments'),
+    'entity' => 'comment',
     'report access' => array('administer comments'),
     'report delete callback' => 'comment_mollom_report_delete',
+  );
+  return $forms;
+}
+
+/**
+ * Implements hook_mollom_form_info().
+ */
+function comment_mollom_form_info($form_id) {
+  $form_info = array(
+    'title' => t('Comment form'),
+    'mode' => MOLLOM_MODE_ANALYSIS,
+    'bypass access' => array('administer comments'),
     'entity' => 'comment',
     'elements' => array(
       'subject' => t('Subject'),
@@ -1517,7 +1557,7 @@ function comment_mollom_form_info() {
     ),
   );
 
-  return $forms;
+  return $form_info;
 }
 
 /**
@@ -1587,36 +1627,57 @@ function comment_mollom_report_delete($e
  */
 
 /**
- * Implements hook_mollom_form_info().
+ * Implements hook_mollom_form_list().
  */
-function user_mollom_form_info() {
+function user_mollom_form_list() {
   $forms['user_register_form'] = array(
     'title' => t('User registration form'),
-    'mode' => MOLLOM_MODE_CAPTCHA,
-    'bypass access' => array('administer users'),
     'entity' => 'user',
-    'mapping' => array(
-      'post_id' => 'uid',
-      'author_name' => 'name',
-      'author_mail' => 'mail',
-    ),
   );
   $forms['user_pass'] = array(
     'title' => t('User password request form'),
-    'mode' => MOLLOM_MODE_CAPTCHA,
-    'bypass access' => array('administer users'),
     'entity' => 'user',
-    'mapping' => array(
-      'post_id' => 'uid',
-      'author_name' => 'name',
-      'author_mail' => 'name',
-    ),
   );
-
   return $forms;
 }
 
 /**
+ * Implements hook_mollom_form_info().
+ */
+function user_mollom_form_info($form_id) {
+  switch ($form_id) {
+    case 'user_register_form':
+      $form_info = array(
+        'title' => t('User registration form'),
+        'mode' => MOLLOM_MODE_CAPTCHA,
+        'bypass access' => array('administer users'),
+        'entity' => 'user',
+        'mapping' => array(
+          'post_id' => 'uid',
+          'author_name' => 'name',
+          'author_mail' => 'mail',
+        ),
+      );
+      return $form_info;
+
+    case 'user_pass':
+      $form_info = array(
+        'title' => t('User password request form'),
+        'mode' => MOLLOM_MODE_CAPTCHA,
+        'bypass access' => array('administer users'),
+        'entity' => 'user',
+        'mapping' => array(
+          'post_id' => 'uid',
+          'author_name' => 'name',
+          // The 'name' form element accepts either a username or mail address.
+          'author_mail' => 'name',
+        ),
+      );
+      return $form_info;
+  }
+}
+
+/**
  * @} End of "name mollom_user".
  */
 
@@ -1626,42 +1687,60 @@ function user_mollom_form_info() {
  */
 
 /**
- * Implements hook_mollom_form_info().
+ * Implements hook_mollom_form_list().
  */
-function contact_mollom_form_info() {
+function contact_mollom_form_list() {
   $forms['contact_site_form'] = array(
     'title' => t('Site-wide contact form'),
-    'mode' => MOLLOM_MODE_ANALYSIS,
-    'bypass access' => array('administer site-wide contact form'),
-    'elements' => array(
-      'subject' => t('Subject'),
-      'message' => t('Message'),
-    ),
-    'mapping' => array(
-      'post_title' => 'subject',
-      'author_name' => 'name',
-      'author_mail' => 'mail',
-    ),
   );
   $forms['contact_personal_form'] = array(
     'title' => t('User contact form'),
-    'mode' => MOLLOM_MODE_ANALYSIS,
-    'bypass access' => array('administer users'),
-    'elements' => array(
-      'subject' => t('Subject'),
-      'message' => t('Message'),
-    ),
-    'mapping' => array(
-      'post_title' => 'subject',
-      'author_name' => 'name',
-      'author_mail' => 'mail',
-    ),
   );
-
   return $forms;
 }
 
 /**
+ * Implements hook_mollom_form_info().
+ */
+function contact_mollom_form_info($form_id) {
+  switch ($form_id) {
+    case 'contact_site_form':
+      $form_info = array(
+        'title' => t('Site-wide contact form'),
+        'mode' => MOLLOM_MODE_ANALYSIS,
+        'bypass access' => array('administer site-wide contact form'),
+        'elements' => array(
+          'subject' => t('Subject'),
+          'message' => t('Message'),
+        ),
+        'mapping' => array(
+          'post_title' => 'subject',
+          'author_name' => 'name',
+          'author_mail' => 'mail',
+        ),
+      );
+      return $form_info;
+
+    case 'contact_personal_form':
+      $form_info = array(
+        'title' => t('User contact form'),
+        'mode' => MOLLOM_MODE_ANALYSIS,
+        'bypass access' => array('administer users'),
+        'elements' => array(
+          'subject' => t('Subject'),
+          'message' => t('Message'),
+        ),
+        'mapping' => array(
+          'post_title' => 'subject',
+          'author_name' => 'name',
+          'author_mail' => 'mail',
+        ),
+      );
+      return $form_info;
+  }
+}
+
+/**
  * Implements hook_mail_alter().
  *
  * Adds a "report as inappropriate" link to e-mails sent by Contact module.
Index: mollom.pages.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mollom/mollom.pages.inc,v
retrieving revision 1.7
diff -u -p -r1.7 mollom.pages.inc
--- mollom.pages.inc	5 Feb 2010 22:36:46 -0000	1.7
+++ mollom.pages.inc	6 Mar 2010 22:53:45 -0000
@@ -125,7 +125,7 @@ function mollom_report_form_submit($form
 
     // Delete the content. The callback should take care of proper deletion and
     // cache clearing on its own.
-    foreach (mollom_get_form_info() as $form_id => $info) {
+    foreach (mollom_form_list() as $form_id => $info) {
       if (!isset($info['entity']) || $info['entity'] != $entity) {
         continue;
       }
Index: tests/mollom.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mollom/tests/mollom.test,v
retrieving revision 1.24
diff -u -p -r1.24 mollom.test
--- tests/mollom.test	3 Mar 2010 08:49:36 -0000	1.24
+++ tests/mollom.test	6 Mar 2010 23:30:24 -0000
@@ -285,7 +285,8 @@ class MollomWebTestCase extends DrupalWe
         $edit['mollom[enabled_fields][' . rawurlencode($field) . ']'] = TRUE;
       }
     }
-    $form_info = mollom_get_form_info($form_id);
+    $form_list = mollom_form_list();
+    $form_info = mollom_form_info($form_id, $form_list[$form_id]['module']);
     foreach (array_keys($form_info['elements']) as $field) {
       // Due to SimpleTest's form handling of checkboxes, we need to disable all
       // remaining checkboxes manually.
@@ -843,6 +844,10 @@ class MollomAccessTestCase extends Mollo
    * Tests 'bypass access' property of registered forms.
    */
   function testBypassAccess() {
+    $this->drupalLogin($this->admin_user);
+    $this->setProtection('comment_form');
+    $this->drupalLogout();
+
     $node = $this->drupalCreateNode(array('body' => array(LANGUAGE_NONE => array(array('value' => 'node body'))), 'type' => 'article'));
 
     // Create a regular user and post a comment.
@@ -952,6 +957,10 @@ class MollomFallbackTestCase extends Mol
    * @todo Test mail sending with assertMail() now that it is available.
    */
   function testFailoverMechanism() {
+    $this->drupalLogin($this->admin_user);
+    $this->setProtection('user_pass');
+    $this->drupalLogout();
+
     // Set the fallback strategy to 'blocking mode', so that if the failover
     // mechanism does not work, we would expect to get a warning.
     variable_set('mollom_fallback', MOLLOM_FALLBACK_BLOCK);
@@ -1299,7 +1308,7 @@ class MollomFormConfigurationTestCase ex
 
     // Verify that field configuration contains only available elements.
     $this->drupalGet('admin/config/content/mollom/manage/mollom_test_form');
-    $form_info = mollom_get_form_info('mollom_test_form');
+    $form_info = mollom_form_info('mollom_test_form', 'mollom_test');
     $fields = $this->xpath('//input[starts-with(@name, "mollom[enabled_fields]")]');
     $elements = array();
     foreach ($fields as $field) {
@@ -1382,21 +1391,15 @@ class MollomFormConfigurationTestCase ex
    * Tests default configuration, protecting, and unprotecting forms.
    */
   function testFormAdministration() {
-    $form_info = mollom_get_form_info();
-
-    // Verify that all registered forms specifying a default mode are
-    // auto-protected after installation.
-    $this->drupalGet('admin/config/content/mollom');
+    $form_info = mollom_form_list();
     foreach ($form_info as $form_id => $info) {
-      if (!empty($info['mode'])) {
-        $this->assertText($info['title']);
-      }
+      $form_info[$form_id] += mollom_form_info($form_id, $info['module']);
     }
 
-    // Unprotect user_register_form form.
-    $this->drupalPost('admin/config/content/mollom/unprotect/user_register_form', array(), t('Confirm'));
+    // Verify that user_register_form is not protected.
+    $this->drupalGet('admin/config/content/mollom');
     $this->assertNoText($form_info['user_register_form']['title']);
-    $this->assertFalse(mollom_form_load('user_register_form'), t('Form configuration no longer exists.'));
+    $this->assertFalse(mollom_form_load('user_register_form'), t('Form configuration does not exist.'));
 
     // Re-protect user_register_form form.
     $this->drupalGet('admin/config/content/mollom/add');
@@ -1431,6 +1434,7 @@ class MollomFormConfigurationTestCase ex
           // all possible elements preselected.
           elseif ($info['mode'] == MOLLOM_MODE_ANALYSIS && !empty($info['elements'])) {
             foreach ($info['elements'] as $field => $label) {
+              $field = rawurlencode($field);
               $this->assertFieldByName("mollom[enabled_fields][$field]", TRUE);
             }
           }
@@ -1536,11 +1540,6 @@ class MollomCommentFormTestCase extends 
    * Make sure that the comment submission form can be unprotected.
    */
   function testUnprotectedCommentForm() {
-    // Disable Mollom for comments.
-    $this->drupalLogin($this->admin_user);
-    $this->delProtection('comment_form');
-    $this->drupalLogout();
-
     // Request the comment reply form. There should be no CAPTCHA.
     $this->drupalLogin($this->web_user);
     $this->drupalGet('comment/reply/'. $this->node->nid);
@@ -1923,11 +1922,8 @@ class MollomDataTestCase extends MollomW
    * Test submitted post and author information for textual analysis.
    */
   function testAnalysis() {
-    // Verify that comment form is protected.
     $this->drupalLogin($this->admin_user);
-    $this->drupalGet('admin/config/content/mollom');
-    $this->assertText(t('Comment form'));
-    $this->drupalGet('admin/config/content/mollom/manage/comment_form');
+    $this->setProtection('comment_form');
 
     // Make comment preview optional.
     $edit = array(
@@ -2085,6 +2081,10 @@ class MollomReportTestCase extends Mollo
    * Tests reporting comments.
    */
   function testReportComment() {
+    $this->drupalLogin($this->admin_user);
+    $this->setProtection('comment_form');
+    $this->drupalLogout();
+
     $this->node = $this->drupalCreateNode(array('type' => 'article'));
     variable_set('comment_preview_article', DRUPAL_OPTIONAL);
 
@@ -2119,6 +2119,10 @@ class MollomReportTestCase extends Mollo
    * Tests mass-reporting comments.
    */
   function testMassReportComments() {
+    $this->drupalLogin($this->admin_user);
+    $this->setProtection('comment_form');
+    $this->drupalLogout();
+
     $this->node = $this->drupalCreateNode(array('type' => 'article'));
     variable_set('comment_preview_article', DRUPAL_OPTIONAL);
 
Index: tests/mollom_test.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mollom/tests/mollom_test.module,v
retrieving revision 1.6
diff -u -p -r1.6 mollom_test.module
--- tests/mollom_test.module	17 Feb 2010 12:42:51 -0000	1.6
+++ tests/mollom_test.module	6 Mar 2010 23:00:42 -0000
@@ -143,11 +143,21 @@ function mollom_test_menu() {
 }
 
 /**
- * Implements hook_mollom_form_info().
+ * Implements hook_mollom_form_list().
  */
-function mollom_test_mollom_form_info() {
+function mollom_test_mollom_form_list() {
   $forms['mollom_test_form'] = array(
     'title' => 'Mollom test form',
+  );
+  return $forms;
+}
+
+/**
+ * Implements hook_mollom_form_info().
+ */
+function mollom_test_mollom_form_info($form_id) {
+  $form_info = array(
+    'title' => 'Mollom test form',
     'bypass access' => array('administer mollom'),
     'entity' => 'mollom_test',
     'elements' => array(
@@ -163,7 +173,7 @@ function mollom_test_mollom_form_info() 
       'author_name' => 'name',
     ),
   );
-  return $forms;
+  return $form_info;
 }
 
 /**
