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
This commit is contained in:
Jasper St. Pierre 2011-08-23 13:38:51 -04:00
parent b7fd78b254
commit 712ea9b9b6

View File

@ -44,11 +44,16 @@ let contactFeatures = [Tp.ContactFeature.ALIAS,
function makeMessageFromTpMessage(tpMessage, direction) { function makeMessageFromTpMessage(tpMessage, direction) {
let [text, flags] = tpMessage.to_text(); let [text, flags] = tpMessage.to_text();
let timestamp = tpMessage.get_sent_timestamp();
if (timestamp == 0)
timestamp = tpMessage.get_received_timestamp();
return { return {
messageType: tpMessage.get_message_type(), messageType: tpMessage.get_message_type(),
text: text, text: text,
sender: tpMessage.sender.alias, sender: tpMessage.sender.alias,
timestamp: tpMessage.get_received_timestamp(), timestamp: timestamp,
direction: direction direction: direction
}; };
} }