? cvs-release-notes.php
Index: privatemsg.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/privatemsg/privatemsg.install,v
retrieving revision 1.5.2.4.2.11.2.11.2.13
diff -u -p -r1.5.2.4.2.11.2.11.2.13 privatemsg.install
--- privatemsg.install	18 Dec 2010 14:35:48 -0000	1.5.2.4.2.11.2.11.2.13
+++ privatemsg.install	2 Jan 2011 12:02:15 -0000
@@ -128,6 +128,16 @@ function privatemsg_schema() {
 }
 
 /**
+ * Implements hook_install().
+ */
+function privatemsg_install() {
+  // Define default formats for date format types.
+  variable_set("date_format_privatemsg_current_day", 'g:i a');
+  variable_set("date_format_privatemsg_current_year", 'M j');
+  variable_set("date_format_privatemsg_years", 'n/j/Y');
+}
+
+/**
  * Implements hook_uninstall().
  */
 function privatemsg_uninstall() {
@@ -312,4 +322,13 @@ function privatemsg_update_7005() {
   if (!db_index_exists('pm_index', 'PRIMARY')) {
     db_add_primary_key('pm_index', array('mid', 'recipient', 'type'));
   }
+}
+
+/**
+ * Define default formats for date format types.
+ */
+function privatemsg_update_7006() {
+  variable_set("date_format_privatemsg_current_day", 'g:i a');
+  variable_set("date_format_privatemsg_current_year", 'M j');
+  variable_set("date_format_privatemsg_years", 'n/j/Y');
 }
\ No newline at end of file
Index: privatemsg.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/privatemsg/privatemsg.module,v
retrieving revision 1.70.2.30.2.91.2.64.2.97
diff -u -p -r1.70.2.30.2.91.2.64.2.97 privatemsg.module
--- privatemsg.module	23 Dec 2010 12:15:19 -0000	1.70.2.30.2.91.2.64.2.97
+++ privatemsg.module	2 Jan 2011 12:02:16 -0000
@@ -701,10 +701,7 @@ function template_preprocess_privatemsg_
   else {
     $vars['author_name_link'] = privatemsg_recipient_format($message->author);
   }
-  /**
-   * @todo perhaps make this timestamp configurable via admin UI?
-   */
-  $vars['message_timestamp'] = format_date($message->timestamp, 'small');
+  $vars['message_timestamp'] = privatemsg_format_date($message->timestamp);
 
   $message->content = array(
     '#view_mode' => 'message',
@@ -1549,7 +1546,7 @@ function privatemsg_new_thread($recipien
     $message->author = $author;
   }
   if (!isset($message->timestamp)) {
-    $message->timestamp = time();
+    $message->timestamp = REQUEST_TIME;
   }
   if (!isset($message->format)) {
     $message->format = filter_default_format($message->author);
@@ -2980,4 +2977,97 @@ class PrivatemsgMessageController extend
     $query->join('pm_index', 'pmi', "base.mid = pmi.mid");
     return $query;
   }
-}
\ No newline at end of file
+}
+
+/**
+ * Implements hook_date_formats().
+ */
+function privatemsg_date_formats() {
+  $formats = array('g:i a', 'H:i', 'M j', 'j M', 'm/d/y', 'm/d/Y', 'd/m/y', 'd/m/Y', 'j/n/y', 'j/n/Y');
+  $types = array_keys(privatemsg_date_format_types());
+  $date_formats = array();
+  foreach ($types as $type) {
+    foreach ($formats as $format) {
+      $date_formats[] = array(
+        'type' => $type,
+        'format' => $format,
+        'locales' => array(),
+      );
+    }
+  }
+  return $date_formats;
+  return array(
+    array(
+      'type' => 'privatemsg_current_day',
+      'format' => 'g:i a',
+      'locales' => array('en'),
+    ),
+    array(
+      'type' => 'privatemsg_current_day',
+      'format' => 'H:i',
+      'locales' => array(),
+    ),
+    array(
+      'type' => 'privatemsg_current_year',
+      'format' => 'M j',
+      'locales' => array('en'),
+    ),
+    array(
+      'type' => 'privatemsg_current_year',
+      'format' => 'j M',
+      'locales' => array(),
+    ),
+    array(
+      'type' => 'privatemsg_years',
+      'format' => 'm/d/Y',
+      'locales' => array('en'),
+    ),
+    array(
+      'type' => 'privatemsg_years',
+      'format' => 'd/m/Y',
+      'locales' => array(),
+    ),
+  );
+}
+
+/**
+ * Implements hook_date_format_types().
+ */
+function privatemsg_date_format_types() {
+  return array(
+    'privatemsg_current_day' => t('Privatemsg: Current day'),
+    'privatemsg_current_year' => t('Privatemsg: Current year'),
+    'privatemsg_years' => t('Privatemsg: Other years'),
+  );
+}
+
+/**
+ * Formats a timestamp according to the defines rules.
+ *
+ * Examples/Rules:
+ *
+ * Current hour: 25 min ago
+ * Current day (but not within the hour): 10:30 am
+ * Current year (but not on the same day): Nov 25
+ * Prior years (not the current year): 11/25/08
+ *
+ * @param $timestamp
+ *   UNIX Timestamp.
+ *
+ * @return
+ *   The formatted date.
+ */
+function privatemsg_format_date($timestamp) {
+  if ($timestamp > ((int)(REQUEST_TIME / 3600)) * 3600) {
+    return t('@interval ago', array('@interval' => format_interval(abs(REQUEST_TIME - $timestamp), 1)));
+  }
+  if ($timestamp > ((int)(REQUEST_TIME / 86400)) * 86400) {
+    return format_date($timestamp, 'privatemsg_current_day');
+  }
+  if ($timestamp > mktime(0, 0, 0, 0, 0, date('Y'))) {
+    return format_date($timestamp, 'privatemsg_current_year');
+  }
+  return format_date($timestamp, 'privatemsg_years');
+
+}
+
Index: privatemsg.pages.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/privatemsg/privatemsg.pages.inc,v
retrieving revision 1.1.2.37
diff -u -p -r1.1.2.37 privatemsg.pages.inc
--- privatemsg.pages.inc	24 Dec 2010 15:03:25 -0000	1.1.2.37
+++ privatemsg.pages.inc	2 Jan 2011 12:02:16 -0000
@@ -200,7 +200,7 @@ function privatemsg_list($form, &$form_s
   $form['account'] = array('#type' => 'value', '#value' => $account);
 
   // Define checkboxes, pager and theme
-  $form['updated']['pager'] = array('#theme' => 'pager', '#weight' => 20);
+  $form['updated']['pager'] = array('#markup' => theme('pager'), '#weight' => 20);
   return $form;
 }
 
Index: privatemsg.theme.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/privatemsg/privatemsg.theme.inc,v
retrieving revision 1.1.2.7.2.14
diff -u -p -r1.1.2.7.2.14 privatemsg.theme.inc
--- privatemsg.theme.inc	30 Nov 2010 07:45:08 -0000	1.1.2.7.2.14
+++ privatemsg.theme.inc	2 Jan 2011 12:02:16 -0000
@@ -45,7 +45,7 @@
  * $form['#data']['thread_id'] = $data // Raw data of that thread
  * $form['#rows']['thread_id'] = $row // Themed fields of that thread
  * @endcode
- * 
+ *
  * Note that the information in #data can be used to populate #rows, but it will
  * not be used by the default theme function theme_privatemsg_list().
  *
@@ -134,7 +134,7 @@ function theme_privatemsg_list_field__co
  */
 function theme_privatemsg_list_field__last_updated($variables) {
   $thread = $variables['thread'];
-  $field['data'] = format_date($thread['last_updated'], 'small');
+  $field['data'] = privatemsg_format_date($thread['last_updated']);
   $field['class'][] = 'privatemsg-list-date';
   return $field;
 }
@@ -147,7 +147,7 @@ function theme_privatemsg_list_field__la
 function theme_privatemsg_list_field__thread_started($variables) {
   $thread = $variables['thread'];
   $field = array();
-  $field['data'] = format_date($thread['thread_started'], 'small');
+  $field['data'] = privatemsg_format_date($thread['thread_started']);
   $field['class'][] = 'privatemsg-list-date-started';
   return $field;
 }
