2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Remove read() constructors from MTP types.

This will allow us to handle errors in parsing not by exceptions.
This commit is contained in:
John Preston
2017-03-09 22:15:31 +03:00
parent 3b373e236e
commit 02da80439b
8 changed files with 1209 additions and 3612 deletions

View File

@@ -4467,13 +4467,18 @@ void MainWidget::updateReceived(const mtpPrime *from, const mtpPrime *end) {
App::wnd()->checkAutoLock();
if (mtpTypeId(*from) == mtpc_new_session_created) {
MTPNewSession newSession(from, end);
try {
MTPNewSession newSession;
newSession.read(from, end);
} catch (mtpErrorUnexpected &) {
}
updSeq = 0;
MTP_LOG(0, ("getDifference { after new_session_created }%1").arg(cTestMode() ? " TESTMODE" : ""));
return getDifference();
} else {
try {
MTPUpdates updates(from, end);
MTPUpdates updates;
updates.read(from, end);
_lastUpdateTime = getms(true);
noUpdatesTimer.start(NoUpdatesTimeout);