From cc9ae13297fa26c2d7c9d541bad86c5debf41c1e Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 13 Apr 2015 10:58:30 +0100 Subject: [PATCH 1/5] fixed vimeo links preview --- Telegram/SourceFiles/history.cpp | 14 ++++++++------ Telegram/SourceFiles/history.h | 8 ++++++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Telegram/SourceFiles/history.cpp b/Telegram/SourceFiles/history.cpp index 0f24e7460..073a8a2de 100644 --- a/Telegram/SourceFiles/history.cpp +++ b/Telegram/SourceFiles/history.cpp @@ -3257,17 +3257,19 @@ void HistoryWebPage::initDimensions(const HistoryItem *parent) { } } if (!data->description.isEmpty()) { + QString text = textClean(data->description); + if (!_asArticle) text += textcmdSkipBlock(parent->timeWidth(), st::msgDateFont->height - st::msgDateDelta.y()); + const TextParseOptions *opts = &_webpageDescriptionOptions; if (data->siteName == QLatin1String("Twitter")) { - _description.setText(st::webPageDescriptionFont, textClean(data->description), _twitterDescriptionOptions); + opts = &_twitterDescriptionOptions; } else if (data->siteName == QLatin1String("Instagram")) { - _description.setText(st::webPageDescriptionFont, textClean(data->description), _instagramDescriptionOptions); - } else { - _description.setText(st::webPageDescriptionFont, textClean(data->description), _webpageDescriptionOptions); + opts = &_instagramDescriptionOptions; } + _description.setText(st::webPageDescriptionFont, text, *opts); if (_asArticle) { _maxw = qMax(_maxw, int32(st::webPageLeft + _description.maxWidth() + st::webPagePhotoDelta + st::webPagePhotoSize)); } else { - _maxw = qMax(_maxw, int32(st::webPageLeft + _description.maxWidth() + parent->timeWidth())); + _maxw = qMax(_maxw, int32(st::webPageLeft + _description.maxWidth())); _minh += qMin(_description.minHeight(), 3 * st::webPageTitleFont->height); } } @@ -4443,7 +4445,7 @@ HistoryMedia *HistoryMessage::getMedia(bool inOverview) const { } void HistoryMessage::setMedia(const MTPmessageMedia &media) { - if (!_media && media.type() == mtpc_messageMediaEmpty) return; + if ((!_media || _media->isImageLink()) && media.type() == mtpc_messageMediaEmpty) return; if (_media) { delete _media; _media = 0; diff --git a/Telegram/SourceFiles/history.h b/Telegram/SourceFiles/history.h index 642a53c4b..7d9384fa5 100644 --- a/Telegram/SourceFiles/history.h +++ b/Telegram/SourceFiles/history.h @@ -802,6 +802,10 @@ public: virtual void updateFrom(const MTPMessageMedia &media) { } + virtual bool isImageLink() const { + return false; + } + virtual bool updateStickerEmoji() { return false; } @@ -1167,6 +1171,10 @@ public: void getState(TextLinkPtr &lnk, bool &inText, int32 x, int32 y, const HistoryItem *parent, int32 width = -1) const; HistoryMedia *clone() const; + bool isImageLink() const { + return true; + } + private: ImageLinkData *data; TextLinkPtr link; From 18103aae7584473d776b71dfe8e7ed8f4385ba78 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 13 Apr 2015 10:59:28 +0100 Subject: [PATCH 2/5] xcode project updated --- Telegram/Telegram.xcodeproj/project.pbxproj | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Telegram/Telegram.xcodeproj/project.pbxproj b/Telegram/Telegram.xcodeproj/project.pbxproj index 5ab3a140f..b0c6a659b 100644 --- a/Telegram/Telegram.xcodeproj/project.pbxproj +++ b/Telegram/Telegram.xcodeproj/project.pbxproj @@ -1335,7 +1335,7 @@ 6DB9C3763D02B1415CD9D565 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0610; + LastUpgradeCheck = 0630; TargetAttributes = { 7CCA95B9FCAD34D929431AD6 = { DevelopmentTeam = 63FLR8MQA9; @@ -1735,6 +1735,7 @@ FRAMEWORK_SEARCH_PATHS = ""; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; GCC_LINK_WITH_DYNAMIC_LIBRARIES = NO; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = fast; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = SourceFiles/stdafx.h; @@ -1876,6 +1877,7 @@ FRAMEWORK_SEARCH_PATHS = ""; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; GCC_LINK_WITH_DYNAMIC_LIBRARIES = NO; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = SourceFiles/stdafx.h; From ac74a08d53cafc7193d68fa673b0eb8112ea63a7 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 15 Apr 2015 09:23:39 +0200 Subject: [PATCH 3/5] fixed crash in photo update from --- Telegram/SourceFiles/history.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/history.cpp b/Telegram/SourceFiles/history.cpp index 073a8a2de..afe478b37 100644 --- a/Telegram/SourceFiles/history.cpp +++ b/Telegram/SourceFiles/history.cpp @@ -1783,7 +1783,7 @@ void HistoryPhoto::updateFrom(const MTPMessageMedia &media) { case mtpc_photoCachedSize: { const string &s(i->c_photoCachedSize().vtype.c_string().v); - loc = &i->c_photoSize().vlocation; + loc = &i->c_photoCachedSize().vlocation; if (s.size()) size = s[0]; } break; } From a356a4dc06b4cf412605524c70ff5162caed8b31 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 16 Apr 2015 14:14:25 +0300 Subject: [PATCH 4/5] dont cache default background image, cmd+m minimizes window in os x --- Telegram/SourceFiles/app.cpp | 8 +++++++- Telegram/SourceFiles/application.cpp | 3 +++ Telegram/SourceFiles/boxes/backgroundbox.cpp | 2 +- Telegram/SourceFiles/localstorage.cpp | 9 +++++++++ Telegram/SourceFiles/mainwidget.cpp | 2 +- 5 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/app.cpp b/Telegram/SourceFiles/app.cpp index 5641b061d..90b91f516 100644 --- a/Telegram/SourceFiles/app.cpp +++ b/Telegram/SourceFiles/app.cpp @@ -1808,16 +1808,22 @@ namespace App { if (Local::readBackground()) return; QImage img(p); + bool remove = false; if (p.isNull()) { img.load(st::msgBG); id = 0; + remove = true; } if (img.format() != QImage::Format_ARGB32 && img.format() != QImage::Format_ARGB32_Premultiplied && img.format() != QImage::Format_RGB32) { img = img.convertToFormat(QImage::Format_RGB32); } img.setDevicePixelRatio(cRetinaFactor()); - if (!nowrite) Local::writeBackground(id, img); + if (remove) { + Local::writeBackground(0, QImage()); + } else if (!nowrite) { + Local::writeBackground(id, img); + } delete cChatBackground(); cSetChatBackground(new QPixmap(QPixmap::fromImage(img, Qt::ColorOnly))); diff --git a/Telegram/SourceFiles/application.cpp b/Telegram/SourceFiles/application.cpp index 4fde54dfe..c7719bd45 100644 --- a/Telegram/SourceFiles/application.cpp +++ b/Telegram/SourceFiles/application.cpp @@ -60,6 +60,9 @@ namespace { App::wnd()->minimizeToTray(); return true; } + } else if (ev->key() == Qt::Key_M && (ev->modifiers() & (Qt::MetaModifier | Qt::ControlModifier))) { + App::wnd()->setWindowState(Qt::WindowMinimized); + return true; } } return QObject::eventFilter(o, e); diff --git a/Telegram/SourceFiles/boxes/backgroundbox.cpp b/Telegram/SourceFiles/boxes/backgroundbox.cpp index 368210f86..27700560b 100644 --- a/Telegram/SourceFiles/boxes/backgroundbox.cpp +++ b/Telegram/SourceFiles/boxes/backgroundbox.cpp @@ -78,7 +78,7 @@ void BackgroundInner::gotWallpapers(const MTPVector &result) { } } if (thumb && full && full->type() != mtpc_photoSizeEmpty) { - wallpapers.push_back(App::WallPaper(d.vid.v, App::image(*thumb), App::image(*full))); + wallpapers.push_back(App::WallPaper(d.vid.v ? d.vid.v : INT_MAX, App::image(*thumb), App::image(*full))); } } break; diff --git a/Telegram/SourceFiles/localstorage.cpp b/Telegram/SourceFiles/localstorage.cpp index 0c8744b26..43c7f6178 100644 --- a/Telegram/SourceFiles/localstorage.cpp +++ b/Telegram/SourceFiles/localstorage.cpp @@ -2178,6 +2178,15 @@ namespace Local { void writeBackground(int32 id, const QImage &img) { if (!_working()) return; + if (img.isNull()) { + if (_backgroundKey) { + clearKey(_backgroundKey); + _backgroundKey = 0; + _mapChanged = true; + } + _writeMap(); + return; + } QByteArray png; { QBuffer buf(&png); diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 8fefcad99..d7469b104 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -1591,7 +1591,7 @@ void MainWidget::checkChatBackground() { if (_background->full->isNull()) { App::initBackground(); } else { - App::initBackground(_background->id, _background->full->pix().toImage()); + App::initBackground(_background->id, _background->id ? _background->full->pix().toImage() : QImage()); } delete _background; _background = 0; From c9626c140c7ddbf5e7c8789e66cced02bffb11d3 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 16 Apr 2015 17:59:42 +0300 Subject: [PATCH 5/5] sending ping_delay_disconnect instead of getDifference by no-updates timeouts --- Telegram/SourceFiles/config.h | 4 ++-- Telegram/SourceFiles/mainwidget.cpp | 11 ++++++++-- Telegram/SourceFiles/mainwidget.h | 1 + Telegram/SourceFiles/mtproto/mtp.cpp | 7 ++++++ Telegram/SourceFiles/mtproto/mtp.h | 1 + .../SourceFiles/mtproto/mtpConnection.cpp | 22 ++++++++++++++----- Telegram/SourceFiles/mtproto/mtpConnection.h | 3 ++- Telegram/SourceFiles/mtproto/mtpSession.cpp | 14 ++++++++++-- Telegram/SourceFiles/mtproto/mtpSession.h | 4 ++++ 9 files changed, 54 insertions(+), 13 deletions(-) diff --git a/Telegram/SourceFiles/config.h b/Telegram/SourceFiles/config.h index 6e26233ea..94c06777f 100644 --- a/Telegram/SourceFiles/config.h +++ b/Telegram/SourceFiles/config.h @@ -279,8 +279,8 @@ enum { UploadRequestInterval = 500, // one part each half second, if not uploaded faster MaxPhotosInMemory = 50, // try to clear some memory after 50 photos are created - NoUpdatesTimeout = 180 * 1000, // if nothing is received in 3 min we getDifference - NoUpdatesAfterSleepTimeout = 60 * 1000, // if nothing is received in 1 min when was a sleepmode we getDifference + NoUpdatesTimeout = 60 * 1000, // if nothing is received in 1 min we ping + NoUpdatesAfterSleepTimeout = 60 * 1000, // if nothing is received in 1 min when was a sleepmode we ping WaitForSkippedTimeout = 1000, // 1s wait for skipped seq or pts in updates MemoryForImageCache = 64 * 1024 * 1024, // after 64mb of unpacked images we try to clear some memory diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index d7469b104..0f53a50fe 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -360,7 +360,7 @@ _failDifferenceTimeout(1), _lastUpdateTime(0), _cachedX(0), _cachedY(0), _backgr connect(&dialogs, SIGNAL(cancelled()), this, SLOT(dialogsCancelled())); connect(&history, SIGNAL(cancelled()), &dialogs, SLOT(activate())); connect(this, SIGNAL(peerPhotoChanged(PeerData*)), this, SIGNAL(dialogsUpdated())); - connect(&noUpdatesTimer, SIGNAL(timeout()), this, SLOT(getDifference())); + connect(&noUpdatesTimer, SIGNAL(timeout()), this, SLOT(mtpPing())); connect(&_onlineTimer, SIGNAL(timeout()), this, SLOT(updateOnline())); connect(&_onlineUpdater, SIGNAL(timeout()), this, SLOT(updateOnlineDisplay())); connect(&_idleFinishTimer, SIGNAL(timeout()), this, SLOT(checkIdleFinish())); @@ -1195,7 +1195,8 @@ void MainWidget::peerUsernameChanged(PeerData *peer) { void MainWidget::checkLastUpdate(bool afterSleep) { uint64 n = getms(true); if (_lastUpdateTime && n > _lastUpdateTime + (afterSleep ? NoUpdatesAfterSleepTimeout : NoUpdatesTimeout)) { - getDifference(); + _lastUpdateTime = n; + MTP::ping(); } } @@ -2398,6 +2399,10 @@ void MainWidget::getDifference() { MTP::send(MTPupdates_GetDifference(MTP_int(updGoodPts), MTP_int(updDate), MTP_int(updQts)), rpcDone(&MainWidget::gotDifference), rpcFail(&MainWidget::failDifference)); } +void MainWidget::mtpPing() { + MTP::ping(); +} + void MainWidget::start(const MTPUser &user) { int32 uid = user.c_userSelf().vid.v; if (MTP::authedId() != uid) { @@ -2805,6 +2810,7 @@ void MainWidget::handleUpdates(const MTPUpdates &updates) { case mtpc_updateShortMessage: { const MTPDupdateShortMessage &d(updates.c_updateShortMessage()); if (!App::userLoaded(d.vuser_id.v) || (d.has_fwd_from_id() && !App::userLoaded(d.vfwd_from_id.v))) { + DEBUG_LOG(("Not loaded for updateShortMessage, good getDifference!")); return getDifference(); } if (!updPtsUpdated(d.vpts.v, d.vpts_count.v)) { @@ -2823,6 +2829,7 @@ void MainWidget::handleUpdates(const MTPUpdates &updates) { case mtpc_updateShortChatMessage: { const MTPDupdateShortChatMessage &d(updates.c_updateShortChatMessage()); if (!App::chatLoaded(d.vchat_id.v) || !App::userLoaded(d.vfrom_id.v) || (d.has_fwd_from_id() && !App::userLoaded(d.vfwd_from_id.v))) { + DEBUG_LOG(("Not loaded for updateShortMessage, good getDifference!")); return getDifference(); } if (!updPtsUpdated(d.vpts.v, d.vpts_count.v)) { diff --git a/Telegram/SourceFiles/mainwidget.h b/Telegram/SourceFiles/mainwidget.h index 7a675848d..f3d8e888b 100644 --- a/Telegram/SourceFiles/mainwidget.h +++ b/Telegram/SourceFiles/mainwidget.h @@ -367,6 +367,7 @@ public slots: void onParentResize(const QSize &newSize); void getDifference(); + void mtpPing(); void getDifferenceForce(); void updateOnline(bool gotOtherOffline = false); diff --git a/Telegram/SourceFiles/mtproto/mtp.cpp b/Telegram/SourceFiles/mtproto/mtp.cpp index ce7867553..d2553c4f9 100644 --- a/Telegram/SourceFiles/mtproto/mtp.cpp +++ b/Telegram/SourceFiles/mtproto/mtp.cpp @@ -684,6 +684,13 @@ namespace MTP { _mtp_internal::getSession(dc); } + void ping() { + MTProtoSessionPtr session = _mtp_internal::getSession(0); + if (!session) return; + + return session->ping(); + } + void cancel(mtpRequestId requestId) { mtpMsgId msgId = 0; requestsDelays.remove(requestId); diff --git a/Telegram/SourceFiles/mtproto/mtp.h b/Telegram/SourceFiles/mtproto/mtp.h index 5e4bc6cf7..1224b7ea9 100644 --- a/Telegram/SourceFiles/mtproto/mtp.h +++ b/Telegram/SourceFiles/mtproto/mtp.h @@ -101,6 +101,7 @@ namespace MTP { inline mtpRequestId send(const TRequest &request, RPCDoneHandlerPtr onDone, RPCFailHandlerPtr onFail = RPCFailHandlerPtr(), int32 dc = 0, uint64 msCanWait = 0, mtpRequestId after = 0) { return send(request, RPCResponseHandler(onDone, onFail), dc, msCanWait, after); } + void ping(); void cancel(mtpRequestId req); void killSession(int32 dc); void stopSession(int32 dc); diff --git a/Telegram/SourceFiles/mtproto/mtpConnection.cpp b/Telegram/SourceFiles/mtproto/mtpConnection.cpp index b615890e2..c4622735a 100644 --- a/Telegram/SourceFiles/mtproto/mtpConnection.cpp +++ b/Telegram/SourceFiles/mtproto/mtpConnection.cpp @@ -1096,7 +1096,7 @@ MTProtoConnectionPrivate::MTProtoConnectionPrivate(QThread *thread, MTProtoConne , firstSentAt(-1) , _pingId(0) , _pingIdToSend(0) - , _pingSent(0) + , _pingSendAt(0) , _pingMsgId(0) , restarted(false) , keyId(0) @@ -1137,6 +1137,7 @@ MTProtoConnectionPrivate::MTProtoConnectionPrivate(QThread *thread, MTProtoConne connect(this, SIGNAL(needToReceive()), sessionData->owner(), SLOT(tryToReceive()), Qt::QueuedConnection); connect(this, SIGNAL(stateChanged(qint32)), sessionData->owner(), SLOT(onConnectionStateChange(qint32)), Qt::QueuedConnection); connect(sessionData->owner(), SIGNAL(needToSend()), this, SLOT(tryToSend()), Qt::QueuedConnection); + connect(sessionData->owner(), SIGNAL(needToPing()), this, SLOT(onPingSendForce()), Qt::QueuedConnection); connect(this, SIGNAL(sessionResetDone()), sessionData->owner(), SLOT(onResetDone()), Qt::QueuedConnection); static bool _registered = false; @@ -1425,7 +1426,7 @@ void MTProtoConnectionPrivate::tryToSend() { bool prependOnly = (state != MTProtoConnection::Connected); mtpRequest pingRequest; if (dc < _mtp_internal::dcShift) { // main session - if (!prependOnly && !_pingIdToSend && !_pingId && _pingSent + (MTPPingSendAfterAuto * 1000ULL) <= getms(true)) { + if (!prependOnly && !_pingIdToSend && !_pingId && _pingSendAt <= getms(true)) { _pingIdToSend = MTP::nonce(); } } @@ -1444,7 +1445,8 @@ void MTProtoConnectionPrivate::tryToSend() { DEBUG_LOG(("MTP Info: sending ping_delay_disconnect, ping_id: %1").arg(_pingIdToSend)); } - _pingSent = pingRequest->msDate = getms(true); // > 0 - can send without container + pingRequest->msDate = getms(true); // > 0 - can send without container + _pingSendAt = pingRequest->msDate + (MTPPingSendAfterAuto * 1000ULL); pingRequest->requestId = 0; // dont add to haveSent / wereAcked maps if (dc < _mtp_internal::dcShift && !prependOnly) { // main session @@ -1733,7 +1735,7 @@ void MTProtoConnectionPrivate::socketStart(bool afterConfig) { return; } setState(MTProtoConnection::Connecting); - _pingId = _pingMsgId = _pingIdToSend = _pingSent = 0; + _pingId = _pingMsgId = _pingIdToSend = _pingSendAt = 0; _pingSender.stop(); const mtpDcOption *dcOption = 0; @@ -1840,17 +1842,25 @@ void MTProtoConnectionPrivate::onOldConnection() { void MTProtoConnectionPrivate::onPingSender() { if (_pingId) { - if (_pingSent + (MTPPingSendAfter - 1) * 1000 < getms(true)) { + if (_pingSendAt + (MTPPingSendAfter - MTPPingSendAfterAuto - 1) * 1000ULL < getms(true)) { LOG(("Could not send ping for MTPPingSendAfter seconds, restarting..")); return restart(); } else { - _pingSender.start(_pingSent + (MTPPingSendAfter * 1000) - getms(true)); + _pingSender.start(_pingSendAt + (MTPPingSendAfter - MTPPingSendAfterAuto) * 1000ULL - getms(true)); } } else { emit needToSendAsync(); } } +void MTProtoConnectionPrivate::onPingSendForce() { + if (!_pingId) { + _pingSendAt = 0; + DEBUG_LOG(("Will send ping!")); + tryToSend(); + } +} + void MTProtoConnectionPrivate::onBadConnection() { if (cConnectionType() != dbictAuto && cConnectionType() != dbictTcpProxy) { return; diff --git a/Telegram/SourceFiles/mtproto/mtpConnection.h b/Telegram/SourceFiles/mtproto/mtpConnection.h index 9f0b63341..ba97afea5 100644 --- a/Telegram/SourceFiles/mtproto/mtpConnection.h +++ b/Telegram/SourceFiles/mtproto/mtpConnection.h @@ -341,6 +341,7 @@ public slots: void restart(bool maybeBadKey = false); void onPingSender(); + void onPingSendForce(); void onBadConnection(); void onOldConnection(); void onSentSome(uint64 size); @@ -416,7 +417,7 @@ private: void requestsAcked(const QVector &ids, bool byResponse = false); mtpPingId _pingId, _pingIdToSend; - uint64 _pingSent; + uint64 _pingSendAt; mtpMsgId _pingMsgId; SingleTimer _pingSender; diff --git a/Telegram/SourceFiles/mtproto/mtpSession.cpp b/Telegram/SourceFiles/mtproto/mtpSession.cpp index 4d599c913..d0654dff4 100644 --- a/Telegram/SourceFiles/mtproto/mtpSession.cpp +++ b/Telegram/SourceFiles/mtproto/mtpSession.cpp @@ -63,7 +63,7 @@ void MTPSessionData::clear() { } -MTProtoSession::MTProtoSession() : data(this), dcId(0), dc(0), msSendCall(0), msWait(0) { +MTProtoSession::MTProtoSession() : data(this), dcId(0), dc(0), msSendCall(0), msWait(0), _ping(false) { } void MTProtoSession::start(int32 dcenter) { @@ -171,7 +171,12 @@ void MTProtoSession::needToResumeAndSend() { } } } - emit needToSend(); + if (_ping) { + _ping = false; + emit needToPing(); + } else { + emit needToSend(); + } } void MTProtoSession::sendPong(quint64 msgId, quint64 pingId) { @@ -272,6 +277,11 @@ void MTProtoSession::cancel(mtpRequestId requestId, mtpMsgId msgId) { } } +void MTProtoSession::ping() { + _ping = true; + sendAnything(0); +} + int32 MTProtoSession::requestState(mtpRequestId requestId) const { MTProtoConnections::const_iterator j = connections.cbegin(), e = connections.cend(); int32 result = MTP::RequestSent; diff --git a/Telegram/SourceFiles/mtproto/mtpSession.h b/Telegram/SourceFiles/mtproto/mtpSession.h index e1b98a3ab..7e0145d71 100644 --- a/Telegram/SourceFiles/mtproto/mtpSession.h +++ b/Telegram/SourceFiles/mtproto/mtpSession.h @@ -236,6 +236,7 @@ public: template mtpRequestId send(const TRequest &request, RPCResponseHandler callbacks = RPCResponseHandler(), uint64 msCanWait = 0, bool needsLayer = false, bool toMainDC = false, mtpRequestId after = 0); // send mtp request + void ping(); void cancel(mtpRequestId requestId, mtpMsgId msgId); int32 requestState(mtpRequestId requestId) const; int32 getState() const; @@ -247,6 +248,7 @@ signals: void authKeyCreated(); void needToSend(); + void needToPing(); void needToRestart(); public slots: @@ -281,6 +283,8 @@ private: uint64 msSendCall, msWait; + bool _ping; + QTimer timeouter; SingleTimer sender;