? .cvsignore
? privatemsg_mollom.patch
? privatemsg_mollom2.patch
Index: privatemsg.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/privatemsg/privatemsg.module,v
retrieving revision 1.126
diff -u -p -r1.126 privatemsg.module
--- privatemsg.module	12 Apr 2010 13:11:57 -0000	1.126
+++ privatemsg.module	14 Apr 2010 21:03:50 -0000
@@ -30,6 +30,7 @@ function privatemsg_perm() {
     'administer privatemsg settings',
     'write privatemsg',
     'delete privatemsg',
+    'report private messages as spam',
   );
 }
 
@@ -564,13 +565,27 @@ function privatemsg_preprocess_privatems
   if (isset($vars['mid']) && isset($vars['thread_id']) && privatemsg_user_access('delete privatemsg')) {
     $vars['message_actions'][] = array('title' => t('Delete message'), 'href' => 'messages/delete/' . $vars['thread_id'] . '/' . $vars['mid']);
   }
+  // Only show the links if the module is configured.
+  if (function_exists('_mollom_status') /*&& _mollom_status() === TRUE*/) {
+    if (privatemsg_user_access('report private messages as spam') && mollom_get_mode('privatemsg_new')) {
+      $thread = privatemsg_thread_load($vars['thread_id']);
+      $vars['message_actions']['mollom'] = array(
+        'title' => t('report to Mollom'),
+        'href' => 'mollom/report/privatemsg_message/' . $vars['mid'],
+        'query' => array(
+          'delete_destination' => count($thread['messages']) > 1 ? 'messages/view/' . $vars['thread_id'] : 'messages',
+          'destination' => 'messages/view/' . $vars['thread_id'],
+        ),
+      );
+    }
+  }
   $vars['message_anchors'][] = 'privatemsg-mid-' . $vars['mid'];
   if (!empty($message['is_new'])) {
     $vars['message_anchors'][] = 'new';
     $vars['new'] = drupal_ucfirst(t('new'));
   }
 
-  // call hook_privatemsg_message_view_alter
+  // Invoke hook_privatemsg_message_view_alter.
   drupal_alter('privatemsg_message_view', $vars);
 
   $vars['message_actions'] = !empty($vars['message_actions']) ? theme('links', $vars['message_actions'], array('class' => 'privatemsg-message-actions')) : '';
@@ -1923,4 +1938,48 @@ function privatemsg_views_api() {
     'api' => 2,
     'path' => drupal_get_path('module', 'privatemsg') . '/views',
   );
-}
\ No newline at end of file
+}
+
+/**
+ * Implements hook_mollom_form_info().
+ */
+function privatemsg_mollom_form_info() {
+  $form_info = array(
+    'title' => t('Send new message form'),
+    'mode' => MOLLOM_MODE_ANALYSIS,
+    'bypass access' => array('administer privatemsg'),
+    'entity' => 'privatemsg_message',
+    'elements' => array(
+      'subject' => t('Subject'),
+      'body' => t('Body'),
+    ),
+    'mapping' => array(
+      'post_id' => 'mid',
+      'post_title' => 'subject',
+    ),
+  );
+
+  return $form_info;
+}
+
+/**
+ * Implements hook_mollom_form_list().
+ */
+function privatemsg_mollom_form_list() {
+  $forms['privatemsg_new'] = array(
+    'title' => t('Send new message form'),
+    'entity' => 'privatemsg_message',
+    'report access' => array('report private messages as spam'),
+    'report delete callback' => 'privatemsg_mollom_delete_message',
+  );
+  return $forms;
+}
+
+/**
+ * Callback for delete a message reported with mollom
+ */
+function privatemsg_mollom_delete_message($entity, $id) {
+  if ($entity == 'privatemsg_message') {
+    privatemsg_message_change_delete($id, TRUE);
+  }
+}
Index: privatemsg.pages.inc
===================================================================
RCS file: /cvs/drupal/contributions/modules/privatemsg/privatemsg.pages.inc,v
retrieving revision 1.2
diff -u -p -r1.2 privatemsg.pages.inc
--- privatemsg.pages.inc	17 Mar 2010 10:09:46 -0000	1.2
+++ privatemsg.pages.inc	14 Apr 2010 21:03:52 -0000
@@ -251,16 +251,16 @@ function privatemsg_new(&$form_state, $r
       '#value'  => $form_state['privatemsg_preview'],
     );
   }
-  $form['privatemsg'] = array(
+  $form = array(
     '#type'               => 'fieldset',
     '#access'             => privatemsg_user_access('write privatemsg'),
   );
-  $form['privatemsg']['author'] = array(
+  $form['author'] = array(
     '#type' => 'value',
     '#value' => $user,
   );
   if (is_null($thread_id)) {
-    $form['privatemsg']['recipient'] = array(
+    $form['recipient'] = array(
       '#type'               => 'textfield',
       '#title'              => t('To'),
       '#description'        => t('Separate multiple names with commas.'),
@@ -272,7 +272,7 @@ function privatemsg_new(&$form_state, $r
       // Do not hardcode #maxlength, make it configurable by number of recipients, not their name length.
     );
   }
-  $form['privatemsg']['subject'] = array(
+  $form['subject'] = array(
     '#type'               => 'textfield',
     '#title'              => t('Subject'),
     '#size'               => 50,
@@ -280,7 +280,7 @@ function privatemsg_new(&$form_state, $r
     '#default_value'      => $subject,
     '#weight'             => -5,
   );
-  $form['privatemsg']['body'] = array(
+  $form['body'] = array(
     '#type'               => 'textarea',
     '#title'              => t('Message'),
     '#rows'               => 6,
@@ -294,14 +294,14 @@ function privatemsg_new(&$form_state, $r
   if (isset($form_state['values']) && array_key_exists('format', $form_state['values'])) {
     $format = $form_state['values']['format'];
   }
-  $form['privatemsg']['format'] = filter_form($format);
-  $form['privatemsg']['preview'] = array(
+  $form['format'] = filter_form($format);
+  $form['preview'] = array(
     '#type'               => 'submit',
     '#value'              => t('Preview message'),
     '#submit'             => array('privatemsg_new_preview'),
     '#weight'             => 10,
   );
-  $form['privatemsg']['submit'] = array(
+  $form['submit'] = array(
     '#type'               => 'submit',
     '#value'              => t('Send message'),
     '#weight'             => 15,
@@ -316,31 +316,31 @@ function privatemsg_new(&$form_state, $r
     $title = t('Clear');
   }
 
-  $form['privatemsg']['cancel'] = array(
+  $form['cancel'] = array(
     '#value'              => l($title, $url, array('attributes' => array('id' => 'edit-cancel'))),
     '#weight'             => 20,
   );
 
   if (!is_null($thread_id)) {
-    $form['privatemsg']['thread_id'] = array(
+    $form['thread_id'] = array(
       '#type' => 'value',
       '#value' => $thread_id,
     );
-    $form['privatemsg']['subject'] = array(
+    $form['subject'] = array(
       '#type' => 'value',
       '#default_value' => $subject,
     );
     $recipients_string_themed = implode(', ', $to_themed);
-    $form['privatemsg']['recipient_display'] = array(
+    $form['recipient_display'] = array(
       '#value' =>  '<p>'. t('<strong>Reply to thread</strong>:<br /> Recipients: !to', array('!to' => $recipients_string_themed)) .'</p>',
       '#weight' => -10,
     );
     if (empty($recipients_string)) {
       // If there are no valid recipients, unset the message reply form.
-      $form['privatemsg']['#access'] = FALSE;
+      $form['#access'] = FALSE;
     }
   }
-  $form['privatemsg']['read_all'] = array(
+  $form['read_all'] = array(
     '#type'  => 'value',
     '#value' => $read_all,
   );
Index: privatemsg_attachments/privatemsg_attachments.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/privatemsg/privatemsg_attachments/privatemsg_attachments.module,v
retrieving revision 1.3
diff -u -p -r1.3 privatemsg_attachments.module
--- privatemsg_attachments/privatemsg_attachments.module	9 Apr 2010 15:48:40 -0000	1.3
+++ privatemsg_attachments/privatemsg_attachments.module	14 Apr 2010 21:03:53 -0000
@@ -18,7 +18,7 @@ function privatemsg_attachments_perm() {
  */
 function privatemsg_attachments_form_privatemsg_new_alter(&$form, &$form_state) {
   if (user_access('upload private message attachments')) {
-    $form['privatemsg']['attachments'] = array(
+    $form['attachments'] = array(
         '#type' => 'fieldset',
         '#access' => user_access('upload private message attachments'),
         '#title' => t('File attachments'),
@@ -31,7 +31,7 @@ function privatemsg_attachments_form_pri
     );
 
     // Wrapper for fieldset contents (used by ahah.js).
-    $form['privatemsg']['attachments']['wrapper'] = array(
+    $form['attachments']['wrapper'] = array(
         '#prefix' => '<div id="attach-wrapper">',
         '#suffix' => '</div>',
     );
@@ -48,22 +48,22 @@ function privatemsg_attachments_form_pri
 
     // Note: pass by reference
     if (!file_check_directory($path, FILE_CREATE_DIRECTORY) || !file_check_directory($temp, FILE_CREATE_DIRECTORY)) {
-      $form['privatemsg']['attachments']['#description'] =  t('File attachments are disabled. The file directories have not been properly configured.');
+      $form['attachments']['#description'] =  t('File attachments are disabled. The file directories have not been properly configured.');
       if (user_access('administer site configuration')) {
-        $form['privatemsg']['attachments']['#description'] .= ' '. t('Please visit the <a href="@admin-file-system">file system configuration page</a>.', array('@admin-file-system' => url('admin/settings/file-system')));
+        $form['attachments']['#description'] .= ' '. t('Please visit the <a href="@admin-file-system">file system configuration page</a>.', array('@admin-file-system' => url('admin/settings/file-system')));
       }
       else {
-        $form['privatemsg']['attachments']['#description'] .= ' '. t('Please contact the site administrator.');
+        $form['attachments']['#description'] .= ' '. t('Please contact the site administrator.');
       }
     }
     else {
       $files = array();
       if (!empty($form_state['values']['files'])) {
         $files = $form_state['values']['files'];
-        $form['privatemsg']['attachments']['#collapsed'] = FALSE;
+        $form['attachments']['#collapsed'] = FALSE;
       }
 
-      $form['privatemsg']['attachments']['wrapper'] += _privatemsg_attachments_form($files);
+      $form['attachments']['wrapper'] += _privatemsg_attachments_form($files);
       // Execute submit function as validate, to have it executed before
       // $form_state['validate_built_message'] is created.
       array_unshift($form['#validate'], '_privatemsg_attachments_upload_submit');
