telepathyClient: insert a timestamp between log messages and pending messages

This will give a visual break, giving a bit of clarity when a message
is received from a new contact.

https://bugzilla.gnome.org/show_bug.cgi?id=645609
This commit is contained in:
Jasper St. Pierre 2011-03-24 07:09:04 -04:00 committed by Owen W. Taylor
parent 659130856c
commit b2a2a00cd8

View File

@ -249,6 +249,8 @@ Source.prototype = {
let pendingTpMessages = this._channel.get_pending_messages(); let pendingTpMessages = this._channel.get_pending_messages();
let pendingMessages = pendingTpMessages.map(function (tpMessage) { return makeMessageFromTpMessage(tpMessage, NotificationDirection.RECEIVED); }); let pendingMessages = pendingTpMessages.map(function (tpMessage) { return makeMessageFromTpMessage(tpMessage, NotificationDirection.RECEIVED); });
let showTimestamp = false;
for (let i = 0; i < logMessages.length; i++) { for (let i = 0; i < logMessages.length; i++) {
let logMessage = logMessages[i]; let logMessage = logMessages[i];
let isPending = false; let isPending = false;
@ -262,17 +264,18 @@ Source.prototype = {
} }
} }
if (!isPending) if (!isPending) {
showTimestamp = true;
this._notification.appendMessage(logMessage, true); this._notification.appendMessage(logMessage, true);
}
} }
if (showTimestamp)
this._notification.appendTimestamp();
for (let i = 0; i < pendingMessages.length; i++) for (let i = 0; i < pendingMessages.length; i++)
this._notification.appendMessage(pendingMessages[i], true); this._notification.appendMessage(pendingMessages[i], true);
// Only show the timestamp if we have at least one message.
if (pendingMessages.length > 0 || logMessages.length > 0)
this._notification.appendTimestamp();
if (pendingMessages.length > 0) if (pendingMessages.length > 0)
this.notify(); this.notify();
}, },