2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-30 22:16:14 +00:00

fixed bad resizing calls, 0.9.6 stable version

This commit is contained in:
John Preston
2015-10-15 02:15:28 +02:00
parent 4857135e42
commit 1c28d59ed2
3 changed files with 38 additions and 16 deletions

View File

@@ -747,7 +747,7 @@ namespace App {
}
}
void checkEntitiesAndViewsUpdate(const MTPDmessage &m) {
bool checkEntitiesAndViewsUpdate(const MTPDmessage &m) {
PeerId peerId = peerFromMTP(m.vto_id);
if (m.has_from_id() && peerToUser(peerId) == MTP::authedId()) {
peerId = peerFromUser(m.vfrom_id);
@@ -766,7 +766,10 @@ namespace App {
existing->updateMedia(m.has_media() ? (&m.vmedia) : 0, true);
existing->setViewsCount(m.has_views() ? m.vviews.v : -1);
return !existing->detached();
}
return false;
}
void feedMsgs(const MTPVector<MTPMessage> &msgs, NewMessageType type) {
@@ -777,9 +780,15 @@ namespace App {
switch (msg.type()) {
case mtpc_message: {
const MTPDmessage &d(msg.c_message());
msgsIds.insert((uint64(uint32(d.vid.v)) << 32) | uint64(i), i);
bool needToAdd = true;
if (type == NewMessageUnread) { // new message, index my forwarded messages to links overview
checkEntitiesAndViewsUpdate(d);
if (checkEntitiesAndViewsUpdate(d)) { // already in blocks
LOG(("Skipping message, because it is already in blocks!"));
needToAdd = false;
}
}
if (needToAdd) {
msgsIds.insert((uint64(uint32(d.vid.v)) << 32) | uint64(i), i);
}
} break;
case mtpc_messageEmpty: msgsIds.insert((uint64(uint32(msg.c_messageEmpty().vid.v)) << 32) | uint64(i), i); break;