From 712ea9b9b6876f74fec19b47551f674ac0f0f28a Mon Sep 17 00:00:00 2001
From: "Jasper St. Pierre" <jstpierre@mecheye.net>
Date: Tue, 23 Aug 2011 13:38:51 -0400
Subject: [PATCH] telepathyClient: Use sent timestamp instead of received
 timestamp

It's generally more useful to see when a person sent a message instead of when
we received it. Also, a recent change in Telepathy made the received timestamp
be 0 for messages we send.

https://bugzilla.gnome.org/show_bug.cgi?id=640271
---
 js/ui/telepathyClient.js | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/js/ui/telepathyClient.js b/js/ui/telepathyClient.js
index de88c3331..7650d24ee 100644
--- a/js/ui/telepathyClient.js
+++ b/js/ui/telepathyClient.js
@@ -44,11 +44,16 @@ let contactFeatures = [Tp.ContactFeature.ALIAS,
 
 function makeMessageFromTpMessage(tpMessage, direction) {
     let [text, flags] = tpMessage.to_text();
+
+    let timestamp = tpMessage.get_sent_timestamp();
+    if (timestamp == 0)
+        timestamp = tpMessage.get_received_timestamp();
+
     return {
         messageType: tpMessage.get_message_type(),
         text: text,
         sender: tpMessage.sender.alias,
-        timestamp: tpMessage.get_received_timestamp(),
+        timestamp: timestamp,
         direction: direction
     };
 }