mirror of https://github.com/procxx/kepka.git
fixed bad resizing calls, 0.9.6 stable version
This commit is contained in:
parent
4857135e42
commit
1c28d59ed2
|
@ -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;
|
||||
|
|
|
@ -105,7 +105,7 @@ namespace App {
|
|||
void feedParticipants(const MTPChatParticipants &p, bool requestBotInfos, bool emitPeerUpdated = true);
|
||||
void feedParticipantAdd(const MTPDupdateChatParticipantAdd &d, bool emitPeerUpdated = true);
|
||||
void feedParticipantDelete(const MTPDupdateChatParticipantDelete &d, bool emitPeerUpdated = true);
|
||||
void checkEntitiesAndViewsUpdate(const MTPDmessage &m);
|
||||
bool checkEntitiesAndViewsUpdate(const MTPDmessage &m); // returns true if item found and it is not detached
|
||||
void feedMsgs(const MTPVector<MTPMessage> &msgs, NewMessageType type);
|
||||
void feedInboxRead(const PeerId &peer, MsgId upTo);
|
||||
void feedOutboxRead(const PeerId &peer, MsgId upTo);
|
||||
|
|
|
@ -3091,8 +3091,11 @@ void MainWidget::gotChannelDifference(ChannelData *channel, const MTPupdates_Cha
|
|||
switch (msg.type()) {
|
||||
case mtpc_message: {
|
||||
const MTPDmessage &d(msg.c_message());
|
||||
msgsIds.insert((uint64(uint32(d.vid.v)) << 32) | uint64(i), i + 1);
|
||||
App::checkEntitiesAndViewsUpdate(d); // new message, index my forwarded messages to links overview
|
||||
if (App::checkEntitiesAndViewsUpdate(d)) { // new message, index my forwarded messages to links overview, already in blocks
|
||||
LOG(("Skipping message, because it is already in blocks!"));
|
||||
} else {
|
||||
msgsIds.insert((uint64(uint32(d.vid.v)) << 32) | uint64(i), i + 1);
|
||||
}
|
||||
} break;
|
||||
case mtpc_messageEmpty: msgsIds.insert((uint64(uint32(msg.c_messageEmpty().vid.v)) << 32) | uint64(i), i + 1); break;
|
||||
case mtpc_messageService: msgsIds.insert((uint64(uint32(msg.c_messageService().vid.v)) << 32) | uint64(i), i + 1); break;
|
||||
|
@ -4202,14 +4205,19 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
|
|||
}
|
||||
|
||||
// update before applying skipped
|
||||
bool needToAdd = true;
|
||||
if (d.vmessage.type() == mtpc_message) { // index forwarded messages to links overview
|
||||
App::checkEntitiesAndViewsUpdate(d.vmessage.c_message());
|
||||
if (App::checkEntitiesAndViewsUpdate(d.vmessage.c_message())) { // already in blocks
|
||||
LOG(("Skipping message, because it is already in blocks!"));
|
||||
needToAdd = false;
|
||||
}
|
||||
}
|
||||
HistoryItem *item = App::histories().addNewMessage(d.vmessage, NewMessageUnread);
|
||||
if (item) {
|
||||
history.peerMessagesUpdated(item->history()->peer->id);
|
||||
if (needToAdd) {
|
||||
HistoryItem *item = App::histories().addNewMessage(d.vmessage, NewMessageUnread);
|
||||
if (item) {
|
||||
history.peerMessagesUpdated(item->history()->peer->id);
|
||||
}
|
||||
}
|
||||
|
||||
ptsApplySkippedUpdates();
|
||||
} break;
|
||||
|
||||
|
@ -4562,14 +4570,19 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
|
|||
}
|
||||
|
||||
// update before applying skipped
|
||||
bool needToAdd = true;
|
||||
if (d.vmessage.type() == mtpc_message) { // index forwarded messages to links overview
|
||||
App::checkEntitiesAndViewsUpdate(d.vmessage.c_message());
|
||||
if (App::checkEntitiesAndViewsUpdate(d.vmessage.c_message())) { // already in blocks
|
||||
LOG(("Skipping message, because it is already in blocks!"));
|
||||
needToAdd = false;
|
||||
}
|
||||
}
|
||||
HistoryItem *item = App::histories().addNewMessage(d.vmessage, NewMessageUnread);
|
||||
if (item) {
|
||||
history.peerMessagesUpdated(item->history()->peer->id);
|
||||
if (needToAdd) {
|
||||
HistoryItem *item = App::histories().addNewMessage(d.vmessage, NewMessageUnread);
|
||||
if (item) {
|
||||
history.peerMessagesUpdated(item->history()->peer->id);
|
||||
}
|
||||
}
|
||||
|
||||
if (channel && !_handlingChannelDifference) {
|
||||
channel->ptsApplySkippedUpdates();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue