Index: mollom.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mollom/mollom.module,v
retrieving revision 1.68
diff -u -p -r1.68 mollom.module
--- mollom.module	26 Aug 2010 21:37:58 -0000	1.68
+++ mollom.module	3 Sep 2010 00:22:02 -0000
@@ -1429,6 +1429,12 @@ function mollom($method, $data = array()
     $data['testing'] = TRUE;
   }
 
+  // Add statistical data for mollom.verifyKey, which is normally invoked on
+  // Mollom's administration pages only.
+  if ($method == 'mollom.verifyKey') {
+    $data += _mollom_get_version();
+  }
+
   // Retrieve the list of Mollom servers from the database.
   $servers = variable_get('mollom_servers', array());
 
@@ -1565,6 +1571,59 @@ function _mollom_watchdog($messages, $se
 }
 
 /**
+ * Returns version information to send with mollom.verifyKey.
+ *
+ * This information is solely used to speed up support requests and technical
+ * inquiries. The data may also be aggregated to help the Mollom staff to make
+ * decisions on new features or the necessity of back-porting improved
+ * functionality to older versions.
+ *
+ * @return
+ *   An array containing:
+ *   - platform_name: The name of the Drupal distribution; i.e., "Drupal".
+ *   - platform_version: The version of Drupal; e.g., "7.0".
+ *   - client_name: The module name; i.e., "Mollom".
+ *   - client_version: The version of the module; e.g., "7.x-1.0".
+ */
+function _mollom_get_version() {
+  $data = &drupal_static('mollom_version');
+
+  if (isset($data)) {
+    return $data;
+  }
+  if ($cache = cache_get('mollom_version')) {
+    $data = $cache->data;
+    return $data;
+  }
+
+  // Fetch Drupal distribution/installation profile information.
+  include_once DRUPAL_ROOT . '/includes/install.inc';
+  $profile = drupal_get_profile();
+  $profile_info = install_profile_info($profile);
+  if (empty($profile_info['version'])) {
+    $profile_info['version'] = VERSION;
+  }
+
+  // Fetch Mollom module information.
+  $mollom_info = db_query("SELECT info FROM {system} WHERE type = 'module' AND name = 'mollom'")->fetchField();
+  $mollom_info = unserialize($mollom_info);
+  if (empty($mollom_info['version'])) {
+    // Manually build a module version string for repository checkouts.
+    $mollom_info['version'] = DRUPAL_CORE_COMPATIBILITY . '-1.x-dev';
+  }
+
+  $data = array(
+    'platform_name' => $profile_info['distribution_name'],
+    'platform_version' => $profile_info['version'],
+    'client_name' => $mollom_info['name'],
+    'client_version' => !empty($mollom_info['version']) ? $mollom_info['version'] : VERSION . '',
+  );
+  cache_set('mollom_version', $data);
+
+  return $data;
+}
+
+/**
  * Send feedback to Mollom.
  */
 function _mollom_send_feedback($session_id, $feedback = 'spam') {
Index: tests/mollom.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mollom/tests/mollom.test,v
retrieving revision 1.53
diff -u -p -r1.53 mollom.test
--- tests/mollom.test	1 Sep 2010 10:45:55 -0000	1.53
+++ tests/mollom.test	3 Sep 2010 00:37:41 -0000
@@ -98,14 +98,17 @@ class MollomWebTestCase extends DrupalWe
       $modules[] = 'dblog';
       parent::setUp($modules);
 
-      $this->admin_user = $this->drupalCreateUser(array(
+      $permissions = array(
         'administer mollom',
         'access administration pages',
         'administer content types',
-        'administer comments',
         'administer permissions',
         'administer users',
-      ));
+      );
+      if ($this->profile == 'standard' || in_array('comment', $modules)) {
+        $permissions[] = 'administer comments';
+      }
+      $this->admin_user = $this->drupalCreateUser($permissions);
     }
     else {
       $modules = func_get_args();
@@ -2118,6 +2121,8 @@ class MollomResellerTestCase extends Mol
  * Tests form value processing.
  */
 class MollomDataTestCase extends MollomWebTestCase {
+  // protected $profile = 'testing';
+
   public static function getInfo() {
     return array(
       'name' => 'Data processing',
@@ -2349,6 +2354,22 @@ class MollomDataTestCase extends MollomW
     $count = db_query("SELECT COUNT(1) FROM {mollom}")->fetchField();
     $this->assertEqual($count, 1, t('Stored data in {mollom} was updated.'));
   }
+
+  /**
+   * Tests data sent for mollom.verifyKey.
+   */
+  function testVerifyKey() {
+    $this->drupalLogin($this->admin_user);
+    $this->drupalGet('admin/config/content/mollom/settings');
+
+    // Verify that we additionally sent version data.
+    $data = $this->getServerRecord('mollom.verifyKey');
+    $info = _mollom_get_version();
+    $this->assertSame('platform_name', $data['platform_name'], $info['platform_name']);
+    $this->assertSame('platform_version', $data['platform_version'], $info['platform_version']);
+    $this->assertSame('client_name', $data['client_name'], $info['client_name']);
+    $this->assertSame('client_version', $data['client_version'], $info['client_version']);
+  }
 }
 
 /**
