diff -urp privatemsg/privatemsg.module privatemsg_new/privatemsg.module
--- privatemsg/privatemsg.module	2008-07-27 04:02:13.000000000 +0100
+++ privatemsg_new/privatemsg.module	2008-08-05 01:10:30.748700000 +0100
@@ -26,7 +26,7 @@ function privatemsg_menu() {
   //later should be a user admin screen for his private messages
   $items['messages'] = array(
     'title' => t('Private messages'),
-    'page callback' => 'privatemsg_hello',
+    'page callback' => 'privatemsg_list',
     'access arguments' => array('read privatemsg'),
     'type' => MENU_NORMAL_ITEM,
   );
@@ -35,7 +35,7 @@ function privatemsg_menu() {
     'title' => t('Inbox'),
     'page callback' => 'privatemsg_list',
     'access arguments' => array('read privatemsg'),
-    'type' => MENU_NORMAL_ITEM,
+    'type' => MENU_DEFAULT_LOCAL_TASK,
     'weight'  => -10,
   );
   $items['messages/mark-read'] = array(
@@ -43,15 +43,15 @@ function privatemsg_menu() {
     'page callback' => 'privatemsg_set_new_status',
     'page arguments' => array(null, null, 0, true),
     'access callback' => 'privatemsg_unread_count',
-    'type' => MENU_NORMAL_ITEM,
+    'type' => MENU_CALLBACK,
     'weight' => -9,
   );
   //list messages that this user is an author of
   $items['messages/sent'] = array(
-    'title' => t('Sent'),
+    'title' => t('Sent Messages'),
     'page callback' => 'privatemsg_list',
     'access arguments' => array('read privatemsg'),
-    'type' => MENU_NORMAL_ITEM,
+    'type' => MENU_LOCAL_TASK,
     'weight'  => -5,
   );
   //view a single message
@@ -69,7 +69,7 @@ function privatemsg_menu() {
     'page callback' => 'drupal_get_form',
     'page arguments' => array('privatemsg_new'),
     'access arguments' => array('write privatemsg'),
-    'type' => MENU_NORMAL_ITEM,
+    'type' => MENU_LOCAL_TASK,
     'weight' => -7,
   );
   $items['messages/new/%message_recipient'] = array(
@@ -122,7 +122,7 @@ function private_message_view_options() 
  */
 function privatemsg_privatemsg_view_template() {
   return array(
-    'privatemsg-view' => 'Default view (Facebook style)',
+    'privatemsg-view' => 'Default view',
   );
 }
 function private_message_settings() {
@@ -235,12 +235,15 @@ function privatemsg_list($uid = NULL) {
    */
   
 //  drupal_set_message('<pre>'. print_r($uid, 1) .'</pre>');
-  if ( arg(1) == 'inbox') {
-    $query = _privatemsg_assemble_query('privatemsg_list', $account);
-  }
-  else if( arg(1) == 'sent') {
-    $query = _privatemsg_assemble_query('privatemsg_list_sent', $account);
-  }
+  switch (arg(1)) {
+   case 'sent':
+     $query = _privatemsg_assemble_query('privatemsg_list_sent', $account);
+     break;
+   case 'inbox':
+     $query = _privatemsg_assemble_query('privatemsg_list', $account);
+   default:
+     $query = _privatemsg_assemble_query('privatemsg_list', $account);
+ }
   $result = db_query($query);
   
   //debugging info
@@ -275,6 +278,12 @@ function privatemsg_list($uid = NULL) {
     while($row = db_fetch_array($result)) {
       $row['subject'] = l($row['subject'], 'messages/view/'. $row['id']);
       $row['author'] = theme('username', user_load($row['author']));
+      if ($row['recipient']) {
+        $row['recipient'] = theme('username', user_load($row['recipient']));
+      }
+      if ($row['timestamp']) {
+        $row['timestamp'] = date('jS F - g:ia', $row['timestamp']);
+      }
       $messages[] = $row;
     }
 
@@ -355,20 +364,30 @@ function privatemsg_set_new_status($acco
 function privatemsg_view($pmid) {
   global $user;
   //loads the message object
-  $message = _privatemsg_load($pmid, $user->uid);
-  privatemsg_set_new_status($user, $pmid);
-  //loads the list of recipients
-  $query = _privatemsg_assemble_query('privatemsg_recipients', $message['thread_id']);
-  $result = db_query($query);
-  while ($row = db_fetch_object($result)) {
-    $message['recipients'][] = user_load($row->uid);
+  $thread = db_result(db_query('SELECT thread_id FROM {pm_index} WHERE mid = %d', $pmid));
+  $conversation = db_query('SELECT mid FROM {pm_index} WHERE thread_id = %d ORDER BY mid ASC', $thread);
+  $message_count = 0;
+  while ($result = db_fetch_array($conversation)) {
+    $pmid = $result['mid'];
+    $message = _privatemsg_load($pmid, $user->uid);
+    privatemsg_set_new_status($user, $pmid);
+    //loads the list of recipients
+    $query = _privatemsg_assemble_query('privatemsg_recipients', $message['thread_id']);
+    $result = db_query($query);
+    //while ($row = db_fetch_object($result)) {
+    //  $message['recipients'][] = user_load($row->uid); 
+    //}
+    if ($message_count == 0) {
+    drupal_set_title($message['subject']);
+    }
+    
+    $message['author'] = user_load($message['author']);
+    //$output .= theme('privatemsg_to', $message);
+    $output .= theme('privatemsg_view', $message);
+    $message_count++;
   }
-  
-  $message['author'] = user_load($message['author']);
-//  $message['recipient'] = user_load($message['recipient']);
-//  $output =  '<pre>'. print_r($message, 1) .'</pre>';
-  $output = theme('privatemsg_to', $message);
-  return $output . theme('privatemsg_view', $message);
+  $output .= drupal_get_form(privatemsg_new);
+  return $output;
 }
 
 function privatemsg_new(&$form_state, $user = null) {
@@ -408,13 +427,21 @@ function privatemsg_new(&$form_state, $u
     '#autocomplete_path'  => 'messages/user-name-autocomplete',
     //do not hardcode #maxlength, make it configurable by number of recipients, not their name length
   );
+if ($subject){
+  $type = 'hidden';
+}
+else {
+  $type = 'textfield';
+}
+
   $form['header']['subject']    = array(
-    '#type'               => 'textfield',
+    '#type'               => $type,
     '#title'              => t('Subject'),
     '#size'               => 50,
     '#maxlength'          => 255,
     '#default_value'      => $subject,
   );
+
   $form['content'] = array(
     '#type'               => 'fieldset',
   );
@@ -576,7 +603,7 @@ function pm_send($form, &$form_state) {
   }
   
   drupal_set_message('Private message has been sent to '. $form_state['values']['recipient']);
-  $form_state['rebuild'] = true;      //rebuild this message for ease of use
+  //$form_state['rebuild'] = true;      //rebuild this message for ease of use
 }
 
 function privatemsg_render_preview($message) {
@@ -622,6 +649,8 @@ function privatemsg_privatemsg_list_sent
   $fragments['select'][] = 'pm.mid as id';
   $fragments['select'][] = 'pm.subject';
   $fragments['select'][] = 'pmi.author';
+  $fragments['select'][] = 'pmi.recipient';
+  $fragments['select'][] = 'pmi.timestamp';
   
   $fragments['inner_join'][] = 'INNER JOIN {pm_index} pmi ON pm.mid = pmi.mid';
   $fragments['where'][] = 'pmi.author = %d';
@@ -637,7 +666,9 @@ function privatemsg_privatemsg_list_alte
   $fragments['select'][] = 'pmi.mid as id';
   $fragments['select'][] = 'pm.subject';
   $fragments['select'][] = 'pmi.author';
-  $fragments['select'][] = 'pmi.*';
+  $fragments['select'][] = 'pmi.recipient';
+  $fragments['select'][] = 'pmi.timestamp';
+//  $fragments['select'][] = 'pmi.*';
   $fragments['inner_join'][] = 'INNER JOIN {pm_index} pmi ON pm.mid = pmi.mid';
   $fragments['where'][]  = 'pmi.recipient = %d';
   $fragments['query_args'][] = $account->uid;
@@ -768,6 +799,10 @@ function disallow_anon_access() {
   }
 }
 function privatemsg_user($op, &$edit, &$account, $category = NULL) {
+  global $user;
+  if ($user->uid == $account->uid || !(user_access('write privatemsg'))) {
+   return;
+  }
   switch ($op) {
     case 'view':
       $account->content['privatemsg_send_new_message'] = array(
