|
|
|
@ -3095,6 +3095,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
@@ -3095,6 +3095,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
|
|
|
|
curState.pendingPtsUpdates.sort(function (a, b) { |
|
|
|
|
return a.pts - b.pts |
|
|
|
|
}) |
|
|
|
|
// console.log(dT(), 'pop update', channelID, curState.pendingPtsUpdates)
|
|
|
|
|
|
|
|
|
|
var curPts = curState.pts |
|
|
|
|
var goodPts = false |
|
|
|
@ -3387,7 +3388,11 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
@@ -3387,7 +3388,11 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (update._ == 'updateChannelTooLong') { |
|
|
|
|
if (!curState.lastPtsUpdateTime || |
|
|
|
|
curState.lastPtsUpdateTime < tsNow() - 10000) { |
|
|
|
|
// console.trace(dT(), 'channel too long, get diff', channelID, update)
|
|
|
|
|
getChannelDifference(channelID) |
|
|
|
|
} |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -3398,12 +3403,13 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
@@ -3398,12 +3403,13 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
|
|
|
|
var message = update.message |
|
|
|
|
var toPeerID = AppPeersManager.getPeerID(message.to_id) |
|
|
|
|
var fwdHeader = message.fwd_from || {} |
|
|
|
|
if (message.from_id && !AppUsersManager.hasUser(message.from_id, message.pFlags.post) || |
|
|
|
|
fwdHeader.from_id && !AppUsersManager.hasUser(fwdHeader.from_id, !!fwdHeader.channel_id) || |
|
|
|
|
fwdHeader.channel_id && !AppChatsManager.hasChat(fwdHeader.channel_id, true) || |
|
|
|
|
toPeerID > 0 && !AppUsersManager.hasUser(toPeerID) || |
|
|
|
|
toPeerID < 0 && !AppChatsManager.hasChat(-toPeerID)) { |
|
|
|
|
console.warn(dT(), 'Not enough data for message update', message) |
|
|
|
|
var reason = false |
|
|
|
|
if (message.from_id && !AppUsersManager.hasUser(message.from_id, message.pFlags.post/* || channelID*/) && (reason = 'author') || |
|
|
|
|
fwdHeader.from_id && !AppUsersManager.hasUser(fwdHeader.from_id, !!fwdHeader.channel_id) && (reason = 'fwdAuthor') || |
|
|
|
|
fwdHeader.channel_id && !AppChatsManager.hasChat(fwdHeader.channel_id, true) && (reason = 'fwdChannel') || |
|
|
|
|
toPeerID > 0 && !AppUsersManager.hasUser(toPeerID) && (reason = 'toPeer User') || |
|
|
|
|
toPeerID < 0 && !AppChatsManager.hasChat(-toPeerID) && (reason = 'toPeer Chat')) { |
|
|
|
|
console.warn(dT(), 'Not enough data for message update', toPeerID, reason, message) |
|
|
|
|
if (channelID && AppChatsManager.hasChat(channelID)) { |
|
|
|
|
getChannelDifference(channelID) |
|
|
|
|
} else { |
|
|
|
@ -3442,6 +3448,8 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
@@ -3442,6 +3448,8 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
|
|
|
|
if (update.pts > curState.pts) { |
|
|
|
|
curState.pts = update.pts |
|
|
|
|
popPts = true |
|
|
|
|
|
|
|
|
|
curState.lastPtsUpdateTime = tsNow() |
|
|
|
|
} |
|
|
|
|
else if (update.pts_count) { |
|
|
|
|
// console.warn(dT(), 'Duplicate update', update)
|
|
|
|
|