]> git.scottworley.com Git - reliable-chat/blobdiff - webclient/rc.html
Keep server timestamps for all copies
[reliable-chat] / webclient / rc.html
index 8094f41669c8e1402c79fcd4aa21356d01ab7461..7517d14d38cfac45e2f5e4b7f66177d5dc8c20e8 100644 (file)
@@ -86,6 +86,7 @@
        //   Time: The server timestamp of the first copy to arrive 
        //   ID: Some unique string for deduping
        //   Text: The text of the message
+       //   ServerTimes: server -> timestamp
        //   UI: The DOM node for this message in the UI
 
        function rcnick() {
                        var m = messages[i];
                        m.Time = new Date(m.Time);
                        var seen_key = make_seen_key(m.ID, m.Text);
-                       if (!(seen_key in seen)) {
+                       if (seen_key in seen) {
+                               seen[seen_key].ServerTimes[server] = m.Time;
+                       } else {
+                               m.ServerTimes = {server: m.Time};
                                seen[seen_key] = m;
                                rcaddmessagetohistory(m);
                                for (var i in servers) {