? .cvsignore
? privatemsg_menu_0.patch
? privatemsg_menu_1.patch
? translations
Index: privatemsg.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/privatemsg/privatemsg.module,v
retrieving revision 1.70.2.30.2.91.2.4
diff -u -p -r1.70.2.30.2.91.2.4 privatemsg.module
--- privatemsg.module	20 Dec 2008 19:48:47 -0000	1.70.2.30.2.91.2.4
+++ privatemsg.module	13 Jan 2009 12:37:48 -0000
@@ -59,12 +59,12 @@ function privatemsg_menu() {
     'type'             => MENU_LOCAL_TASK,
     'weight'           => -5,
   );
-  $items['messages/view/%'] = array(
-    'title'            => 'Read private message',
+  $items['messages/view/%privatemsg_thread'] = array(
+    'title'            => 'Read message',
     'page callback'    => 'privatemsg_view',
     'page arguments'   => array(2),
     'access arguments' => array('read privatemsg'),
-    'type'             => MENU_CALLBACK,
+    'type'             => MENU_LOCAL_TASK,
     'weight'           => -10,
   );
   $items['messages/delete/%'] = array(
@@ -78,18 +78,11 @@ function privatemsg_menu() {
   $items['messages/new'] = array(
     'title'            => 'Write new message',
     'page callback'    => 'drupal_get_form',
-    'page arguments'   => array('privatemsg_new'),
+    'page arguments'   => array('privatemsg_new', 2),
     'access arguments' => array('write privatemsg'),
     'type'             => MENU_LOCAL_TASK,
     'weight'           => -7,
   );
-  $items['messages/new/%user'] = array(
-    'page callback'    => 'drupal_get_form',
-    'page arguments'   => array('privatemsg_new', 2),
-    'access arguments' => array('write privatemsg'),
-    'type'             => MENU_CALLBACK,
-    'weight'           => -10,
-  );
   // Auto-completes available user names & removes duplicates.
   $items['messages/user-name-autocomplete'] = array(
     'page callback'    => 'privatemsg_user_name_autocomplete',
@@ -107,6 +100,17 @@ function privatemsg_menu() {
   );
   return $items;
 }
+/**
+ * This function is called by the menu system through the %privatemsg_thread wildcard
+ *
+ * TODO: Really load the full thread in here
+ */
+function privatemsg_thread_load($thread_id) {
+  if ((int)$thread_id > 0) {
+    return $thread_id;
+  }
+  return FALSE;
+}
 
 
 function private_message_view_options() {
@@ -462,7 +466,7 @@ function privatemsg_new(&$form_state, $a
   $subject   = '';
   $body      = '';
 
-  if (isset($account)) {
+  if ((int)$account > 0 && $account = user_load($account)) {
     $recipient  = $account->name .', ';
   }
   if (isset($form_state['values'])) {
