MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / applyUpdates

Method applyUpdates

Telegram/SourceFiles/api/api_updates.cpp:1465–1590  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1463}
1464
1465void Updates::applyUpdates(
1466 const MTPUpdates &updates,
1467 uint64 sentMessageRandomId) {
1468 const auto randomId = sentMessageRandomId;
1469
1470 switch (updates.type()) {
1471 case mtpc_updates: {
1472 auto &d = updates.c_updates();
1473 if (d.vseq().v) {
1474 if (d.vseq().v <= _updatesSeq) {
1475 return;
1476 }
1477 if (d.vseq().v > _updatesSeq + 1) {
1478 _bySeqUpdates.emplace(d.vseq().v, updates);
1479 _bySeqTimer.callOnce(PtsWaiter::kWaitForSkippedTimeout);
1480 return;
1481 }
1482 }
1483
1484 session().data().processUsers(d.vusers());
1485 session().data().processChats(d.vchats());
1486 feedUpdateVector(d.vupdates());
1487
1488 setState(0, d.vdate().v, _updatesQts, d.vseq().v);
1489 } break;
1490
1491 case mtpc_updatesCombined: {
1492 auto &d = updates.c_updatesCombined();
1493 if (d.vseq_start().v) {
1494 if (d.vseq_start().v <= _updatesSeq) {
1495 return;
1496 }
1497 if (d.vseq_start().v > _updatesSeq + 1) {
1498 _bySeqUpdates.emplace(d.vseq_start().v, updates);
1499 _bySeqTimer.callOnce(PtsWaiter::kWaitForSkippedTimeout);
1500 return;
1501 }
1502 }
1503
1504 session().data().processUsers(d.vusers());
1505 session().data().processChats(d.vchats());
1506 feedUpdateVector(d.vupdates());
1507
1508 setState(0, d.vdate().v, _updatesQts, d.vseq().v);
1509 } break;
1510
1511 case mtpc_updateShort: {
1512 auto &d = updates.c_updateShort();
1513 feedUpdate(d.vupdate());
1514
1515 setState(0, d.vdate().v, _updatesQts, _updatesSeq);
1516 } break;
1517
1518 case mtpc_updateShortMessage: {
1519 auto &d = updates.c_updateShortMessage();
1520 if (!DataIsLoaded(&_session->data(), d)) {
1521 MTP_LOG(0, ("getDifference "
1522 "{ good - after not all data loaded in updateShortMessage }%1"

Callers 15

botSendDataMethod · 0.45
botAllowWriteAccessMethod · 0.45
botRequestChatMethod · 0.45
TogglePinnedThreadFunction · 0.45
addToggleNoForwardsMethod · 0.45
PeerMenuDeleteContactFunction · 0.45
PeerMenuBlockUserBoxFunction · 0.45
ShowSendNowMessagesBoxFunction · 0.45
ToggleMessagePinnedFunction · 0.45
setExistingForPeerMethod · 0.45
SendCreditsBoxFunction · 0.45
SendStarsFormFunction · 0.45

Calls 15

DataIsLoadedFunction · 0.85
IsServerMsgIdFunction · 0.85
MTP_longFunction · 0.85
emplaceMethod · 0.80
processUsersMethod · 0.80
processChatsMethod · 0.80
fillMessagePeersMethod · 0.80
messageSentDataMethod · 0.80
messageIdByRandomIdMethod · 0.80
isScheduledMethod · 0.80
sendNowSimpleMessageMethod · 0.80
applySentMessageMethod · 0.80

Tested by

no test coverage detected