? .cvsignore
? privatemsg.empty_subject.patch
? translations
Index: privatemsg.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/privatemsg/privatemsg.module,v
retrieving revision 1.70.2.30.2.91.2.16
diff -u -p -r1.70.2.30.2.91.2.16 privatemsg.module
--- privatemsg.module	18 Feb 2009 01:36:46 -0000	1.70.2.30.2.91.2.16
+++ privatemsg.module	18 Feb 2009 11:21:22 -0000
@@ -214,6 +214,13 @@ function private_message_settings() {
     '#default_value' => variable_get('privatemsg_display_loginmessage', TRUE),
     '#description' => t('This option can safely be disabled if the "New message indication" block is used instead.'),
   );
+  $form['privatemsg_empty_subject'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Allow empty subjects'),
+    '#default_value' => variable_get('privatemsg_empty_subject', FALSE),
+    '#description' => t('If this option is enabled, users are allowed to send messages with an empty
+                         subject. The subject will automatically be filled with the start of the body'),
+  );
   $form['#submit'][] = 'private_message_settings_submit';
   return system_settings_form($form);
 }
@@ -569,7 +576,7 @@ function privatemsg_new(&$form_state, $a
     '#maxlength'          => 255,
     '#default_value'      => $subject,
     '#weight'             => -5,
-    '#required'           => TRUE,
+    '#required'           => !variable_get('privatemsg_empty_subject', FALSE),
   );
   $form['privatemsg']['body']       = array(
     '#type'               => 'textarea',
@@ -578,6 +585,7 @@ function privatemsg_new(&$form_state, $a
     '#rows'               => 6,
     '#weight'             => 0,
     '#default_value'      => $body,
+    '#required'           => TRUE,
   );
   $form['privatemsg']['preview'] = array(
     '#type'               => 'submit',
@@ -625,7 +633,13 @@ function pm_send_validate($form, &$form_
     $message['thread_id'] = $form_state['values']['thread_id'];
   }
 
-
+  if (empty($message['subject']) && variable_get('privatemsg_empty_subject', FALSE)) {
+    if (strlen($message['body']) > 20) {
+      $message['subject'] = substr($message['body'], 0, 20) .'...';
+    } else {
+      $message['subject'] = $message['body'];
+    }
+  }
 
   // Verify that recipient's name syntax is correct.
   $fragments = explode(',', $form_state['values']['recipient']);
