? .cvsignore
? privatemsg_mollom.patch
? privatemsg_mollom2.patch
? privatemsg_mollom3.patch
? privatemsg_mollom4.patch
? privatemsg_mollom5.patch
? privatemsg_mollom6.patch
Index: privatemsg.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/privatemsg/privatemsg.module,v
retrieving revision 1.138
diff -u -p -r1.138 privatemsg.module
--- privatemsg.module	12 Jul 2010 09:14:26 -0000	1.138
+++ privatemsg.module	12 Jul 2010 09:37:57 -0000
@@ -30,6 +30,7 @@ function privatemsg_perm() {
     'administer privatemsg settings',
     'write privatemsg',
     'delete privatemsg',
+    'report private messages to mollom',
   );
 }
 
@@ -2095,6 +2096,41 @@ function privatemsg_views_api() {
 }
 
 /**
+ * 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'),
+    'report access' => 'report private messages to mollom',
+    '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',
+    'delete form' => 'privatemsg_delete',
+  );
+  return $forms;
+}
+
+/**
  * Privatemsg wrapper function for user_load() with a static cache.
  *
  * The function additionaly also adds the privatemsg specific recipient id (uid)
Index: privatemsg.pages.inc
===================================================================
RCS file: /cvs/drupal/contributions/modules/privatemsg/privatemsg.pages.inc,v
retrieving revision 1.6
diff -u -p -r1.6 privatemsg.pages.inc
--- privatemsg.pages.inc	6 Jul 2010 18:03:07 -0000	1.6
+++ privatemsg.pages.inc	12 Jul 2010 09:37:57 -0000
@@ -249,21 +249,21 @@ function privatemsg_new(&$form_state, $r
     drupal_set_title(t('Write new message'));
   }
 
-  $form = array();
+  $form = array(
+    '#type'               => 'fieldset',
+    '#access'             => privatemsg_user_access('write privatemsg'),
+  );
   if (isset($form_state['privatemsg_preview'])) {
     $form['message_header'] = array(
       '#type' => 'fieldset',
       '#attributes' => array('class' => 'preview'),
+      '#weight' => -10,
     );
     $form['message_header']['message_preview'] = array(
       '#value'  => $form_state['privatemsg_preview'],
     );
   }
-  $form['privatemsg'] = array(
-    '#type'               => 'fieldset',
-    '#access'             => privatemsg_user_access('write privatemsg'),
-  );
-  $form['privatemsg']['author'] = array(
+  $form['author'] = array(
     '#type' => 'value',
     '#value' => $user,
   );
@@ -277,7 +277,7 @@ function privatemsg_new(&$form_state, $r
     $description = t('Enter the recipient, separate recipients with commas.');
     $description .= theme('item_list', $description_array);
 
-    $form['privatemsg']['recipient'] = array(
+    $form['recipient'] = array(
       '#type'               => 'textfield',
       '#title'              => t('To'),
       '#description'        => $description,
@@ -289,7 +289,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,
@@ -297,7 +297,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,
@@ -311,14 +311,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,
@@ -333,31 +333,30 @@ 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);
-    $form['privatemsg']['recipient_display'] = array(
-      '#value' =>  '<p>'. t('<strong>Reply to thread</strong>:<br /> Recipients: !to', array('!to' => $recipients_string_themed)) .'</p>',
+    $form['recipient_display'] = array(
+      '#value' =>  '<p>'. t('<strong>Reply to thread</strong>:<br /> Recipients: !to', array('!to' => $recipients_string)) .'</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,
   );
@@ -424,7 +423,7 @@ function privatemsg_new_preview($form, &
 
 
 function privatemsg_delete($form_state, $thread, $message) {
-  $form['pmid'] = array(
+  $form['mid'] = array(
     '#type' => 'value',
     '#value' => $message['mid'],
   );
@@ -456,11 +455,11 @@ function privatemsg_delete_submit($form,
 
   if ($form_state['values']['confirm']) {
     if (isset($form_state['values']['delete_options']) && $form_state['values']['delete_options']) {
-      privatemsg_message_change_delete($form_state['values']['pmid'], 1);
+      privatemsg_message_change_delete($form_state['values']['mid'], 1);
       drupal_set_message(t('Message has been deleted for all users.'));
     }
     else {
-      privatemsg_message_change_delete($form_state['values']['pmid'], 1, $account);
+      privatemsg_message_change_delete($form_state['values']['mid'], 1, $account);
       drupal_set_message(t('Message has been deleted.'));
     }
   }
Index: privatemsg_attachments/privatemsg_attachments.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/privatemsg/privatemsg_attachments/privatemsg_attachments.module,v
retrieving revision 1.6
diff -u -p -r1.6 privatemsg_attachments.module
--- privatemsg_attachments/privatemsg_attachments.module	19 Jun 2010 11:33:55 -0000	1.6
+++ privatemsg_attachments/privatemsg_attachments.module	12 Jul 2010 09:37:57 -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 attachment fieldset in the module\'s administration settings may not have been properly configured.');
+      $form['attachments']['#description'] =  t('File attachments are disabled. The file attachment fieldset in the module\'s administration settings may not have been properly configured.');
       if (user_access('administer privatemsg settings')) {
-        $form['privatemsg']['attachments']['#description'] .= ' '. t('Please visit the <a href="@admin-file-system">Private Messages module configuration page</a>.', array('@admin-file-system' => url('admin/settings/messages')));
+        $form['attachments']['#description'] .= ' '. t('Please visit the <a href="@admin-file-system">Private Messages module configuration page</a>.', array('@admin-file-system' => url('admin/settings/messages')));
       }
       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['storage']['files'])) {
         $files = $form_state['storage']['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');
@@ -161,7 +161,7 @@ function privatemsg_attachments_menu() {
 function privatemsg_attachments_upload_js() {
   $form_state = array('values' => $_POST, 'storage' => NULL, 'submitted' => FALSE);
   // Load the form from the Form API cache.
-  if (!($cached_form = form_get_cache($_POST['form_build_id'], $form_state)) || !isset($cached_form['privatemsg']['attachments'])) {
+  if (!($cached_form = form_get_cache($_POST['form_build_id'], $form_state)) || !isset($cached_form['attachments'])) {
     form_set_error('form_token', t('Validation error, please try again. If this error persists, please contact the site administrator.'));
     $output = theme('status_messages');
 
@@ -182,10 +182,10 @@ function privatemsg_attachments_upload_j
   $form_state['storage']['files'] = $form_state['values']['files'];
   $form = _privatemsg_attachments_form($form_state['values']['files']);
 
-  unset($cached_form['privatemsg']['attachments']['wrapper']['new']);
-  $cached_form['privatemsg']['attachments']['wrapper'] = array_merge($cached_form['privatemsg']['attachments']['wrapper'], $form);
+  unset($cached_form['attachments']['wrapper']['new']);
+  $cached_form['attachments']['wrapper'] = array_merge($cached_form['attachments']['wrapper'], $form);
 
-  $cached_form['privatemsg']['attachments']['#collapsed'] = FALSE;
+  $cached_form['attachments']['#collapsed'] = FALSE;
 
   form_set_cache($_POST['form_build_id'], $cached_form, $form_state);
 
@@ -206,7 +206,9 @@ function privatemsg_attachments_upload_j
     '#parents' => array(),
     '#id' => '_privatemsg_upload_form',
   );
-  drupal_alter('form', $form, array(), '_privatemsg_upload_form');
+
+  $form['__drupal_alter_by_ref'] = array(&$form_state);
+  drupal_alter('form', $form, '_privatemsg_upload_form');
   $form_state = array('submitted' => FALSE);
   $form = form_builder('_privatemsg_upload_form', $form, $form_state);
 
