|
|
@ -1833,7 +1833,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
var peerID = pendingData[0], |
|
|
|
var peerID = pendingData[0], |
|
|
|
tempID = pendingData[1], |
|
|
|
tempID = pendingData[1], |
|
|
|
historyStorage = historiesStorage[peerID], |
|
|
|
historyStorage = historiesStorage[peerID], |
|
|
|
i; |
|
|
|
pos = historyStorage.pending.indexOf(tempID); |
|
|
|
|
|
|
|
|
|
|
|
ApiUpdatesManager.processUpdateMessage({ |
|
|
|
ApiUpdatesManager.processUpdateMessage({ |
|
|
|
_: 'updateShort', |
|
|
|
_: 'updateShort', |
|
|
@ -1843,17 +1843,13 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < historyStorage.pending.length; i++) { |
|
|
|
if (pos != -1) { |
|
|
|
if (historyStorage.pending[i] == tempID) { |
|
|
|
historyStorage.pending.splice(pos, 1); |
|
|
|
historyStorage.pending.splice(i, 1); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
delete messagesForHistory[tempID]; |
|
|
|
delete messagesForHistory[tempID]; |
|
|
|
delete messagesStorage[tempID]; |
|
|
|
delete messagesStorage[tempID]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1868,17 +1864,13 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
var peerID = pendingData[0], |
|
|
|
var peerID = pendingData[0], |
|
|
|
tempID = pendingData[1], |
|
|
|
tempID = pendingData[1], |
|
|
|
historyStorage = historiesStorage[peerID], |
|
|
|
historyStorage = historiesStorage[peerID], |
|
|
|
index = false, |
|
|
|
message, |
|
|
|
message = false, |
|
|
|
historyMessage; |
|
|
|
historyMessage = false, |
|
|
|
|
|
|
|
i; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// console.log('pending', randomID, historyStorage.pending);
|
|
|
|
// console.log('pending', randomID, historyStorage.pending);
|
|
|
|
for (i = 0; i < historyStorage.pending.length; i++) { |
|
|
|
var pos = historyStorage.pending.indexOf(tempID); |
|
|
|
if (historyStorage.pending[i] == tempID) { |
|
|
|
if (pos != -1) { |
|
|
|
historyStorage.pending.splice(i, 1); |
|
|
|
historyStorage.pending.splice(pos, 1); |
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (message = messagesStorage[tempID]) { |
|
|
|
if (message = messagesStorage[tempID]) { |
|
|
@ -2315,18 +2307,16 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
historyStorage = historiesStorage[peerID]; |
|
|
|
historyStorage = historiesStorage[peerID]; |
|
|
|
|
|
|
|
|
|
|
|
if (historyStorage !== undefined) { |
|
|
|
if (historyStorage !== undefined) { |
|
|
|
var topMsgID = historiesStorage[peerID].history[0]; |
|
|
|
|
|
|
|
if (historiesStorage[peerID].history.indexOf(message.id) != -1) { |
|
|
|
if (historiesStorage[peerID].history.indexOf(message.id) != -1) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
var topMsgID = historiesStorage[peerID].history[0]; |
|
|
|
historyStorage.history.unshift(message.id); |
|
|
|
historyStorage.history.unshift(message.id); |
|
|
|
if (message.id > 0 && message.id < topMsgID || true) { |
|
|
|
if (message.id > 0 && message.id < topMsgID) { |
|
|
|
historyStorage.history.sort(function (a, b) { |
|
|
|
historyStorage.history.sort(function (a, b) { |
|
|
|
return b - a; |
|
|
|
return b - a; |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
historyStorage = historiesStorage[peerID] = {count: null, history: [message.id], pending: []}; |
|
|
|
historyStorage = historiesStorage[peerID] = {count: null, history: [message.id], pending: []}; |
|
|
|
} |
|
|
|
} |
|
|
|