1
0
mirror of https://github.com/moparisthebest/kaiwa synced 2024-11-05 17:15:04 -05:00

Fix: Display messages with server time instead of client time

This commit is contained in:
Sebastien Hut 2015-02-09 15:28:16 +01:00
parent abb123e6b8
commit 4af8998da9
2 changed files with 17 additions and 1 deletions

View File

@ -47,6 +47,7 @@ module.exports = {
app.storage = new Storage();
app.storage.open(cb);
app.composing = {};
app.timeInterval = 0;
app.mucInfos = [];
},
function (cb) {
@ -84,6 +85,21 @@ module.exports = {
app.soundManager.loadFile('/sounds/threetone-alert.wav', 'threetone-alert');
cb();
},
function (cb) {
app.whenConnected(function () {
function getInterval() {
if (client.sessionStarted) {
client.getTime(self.id, function (err, res) {
if (err) return;
self.timeInterval = res.time.utc - Date.now();
});
setTimeout(getInterval, 600000);
}
}
getInterval();
});
cb();
},
function (cb) {
function start() {
// start our router and show the appropriate page

View File

@ -11,7 +11,7 @@ var ID_CACHE = {};
var Message = module.exports = HumanModel.define({
initialize: function (attrs) {
this._created = new Date(Date.now());
this._created = new Date(Date.now() + app.timeInterval);
},
type: 'message',
props: {