From c8c13219edb70894cbfd23618d6e618a6750f78e Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 4 Dec 2015 17:29:57 +0300 Subject: [PATCH] testing beta update to 9014002, frequent beta update check, no creating .desktop file for beta --- Telegram/SourceFiles/_other/packer.cpp | 2 +- Telegram/SourceFiles/application.cpp | 9 +++++---- Telegram/SourceFiles/config.h | 2 +- Telegram/SourceFiles/pspecific_linux.cpp | 2 +- Telegram/Version | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Telegram/SourceFiles/_other/packer.cpp b/Telegram/SourceFiles/_other/packer.cpp index 34e877d16..7cf2da955 100644 --- a/Telegram/SourceFiles/_other/packer.cpp +++ b/Telegram/SourceFiles/_other/packer.cpp @@ -174,7 +174,7 @@ int main(int argc, char *argv[]) } else if (string("-dev") == argv[i]) { DevChannel = true; } else if (string("-beta") == argv[i] && i + 1 < argc) { - BetaVersion = QString(argv[i + 1]).toLongLong(); + BetaVersion = QString(argv[i + 1]).toULongLong(); if (BetaVersion > version * 1000ULL && BetaVersion < (version + 1) * 1000ULL) { DevChannel = false; BetaSignature = countBetaVersionSignature(BetaVersion); diff --git a/Telegram/SourceFiles/application.cpp b/Telegram/SourceFiles/application.cpp index 94d0dc67a..d9df42f09 100644 --- a/Telegram/SourceFiles/application.cpp +++ b/Telegram/SourceFiles/application.cpp @@ -210,14 +210,14 @@ void Application::updateGotCurrent() { cSetLastUpdateCheck(unixtime()); QRegularExpressionMatch m = QRegularExpression(qsl("^\\s*(\\d+)\\s*:\\s*([\\x21-\\x7f]+)\\s*$")).match(QString::fromUtf8(updateReply->readAll())); if (m.hasMatch()) { - int32 currentVersion = m.captured(1).toInt(); + uint64 currentVersion = m.captured(1).toULongLong(); QString url = m.captured(2); bool betaVersion = false; if (url.startsWith(qstr("beta_"))) { betaVersion = true; url = url.mid(5) + '_' + countBetaVersionSignature(currentVersion); } - if ((!betaVersion || cBetaVersion()) && currentVersion > (betaVersion ? cBetaVersion() : AppVersion)) { + if ((!betaVersion || cBetaVersion()) && currentVersion > (betaVersion ? cBetaVersion() : uint64(AppVersion))) { updateThread = new QThread(); connect(updateThread, SIGNAL(finished()), updateThread, SLOT(deleteLater())); updateDownloader = new UpdateDownloader(updateThread, url); @@ -549,8 +549,9 @@ void Application::startUpdateCheck(bool forceWait) { updateCheckTimer.stop(); if (updateRequestId || updateThread || updateReply || !cAutoUpdate()) return; - int32 updateInSecs = cLastUpdateCheck() + UpdateDelayConstPart + (rand() % UpdateDelayRandPart) - unixtime(); - bool sendRequest = (updateInSecs <= 0 || updateInSecs > (UpdateDelayConstPart + UpdateDelayRandPart)); + int32 constDelay = cBetaVersion() ? 600 : UpdateDelayConstPart, randDelay = cBetaVersion() ? 300 : UpdateDelayRandPart; + int32 updateInSecs = cLastUpdateCheck() + constDelay + (rand() % randDelay) - unixtime(); + bool sendRequest = (updateInSecs <= 0 || updateInSecs > (constDelay + randDelay)); if (!sendRequest && !forceWait) { QDir updates(cWorkingDir() + "tupdates"); if (updates.exists()) { diff --git a/Telegram/SourceFiles/config.h b/Telegram/SourceFiles/config.h index 52f7b0581..386376329 100644 --- a/Telegram/SourceFiles/config.h +++ b/Telegram/SourceFiles/config.h @@ -23,7 +23,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org static const int32 AppVersion = 9014; static const wchar_t *AppVersionStr = L"0.9.14"; static const bool DevVersion = true; -#define BETA_VERSION (9014001ULL) // just comment this line to build public version +#define BETA_VERSION (9014002ULL) // just comment this line to build public version static const wchar_t *AppNameOld = L"Telegram Win (Unofficial)"; static const wchar_t *AppName = L"Telegram Desktop"; diff --git a/Telegram/SourceFiles/pspecific_linux.cpp b/Telegram/SourceFiles/pspecific_linux.cpp index ac52c0084..67137e977 100644 --- a/Telegram/SourceFiles/pspecific_linux.cpp +++ b/Telegram/SourceFiles/pspecific_linux.cpp @@ -1167,7 +1167,7 @@ namespace { void psRegisterCustomScheme() { #ifndef TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME QString home(_psHomeDir()); - if (home.isEmpty()) return; + if (home.isEmpty() || cBetaVersion()) return; // don't update desktop file for beta version DEBUG_LOG(("App Info: placing .desktop file")); if (QDir(home + qsl(".local/")).exists()) { diff --git a/Telegram/Version b/Telegram/Version index df787d6d3..38617321a 100644 --- a/Telegram/Version +++ b/Telegram/Version @@ -3,4 +3,4 @@ AppVersionStrMajor 0.9 AppVersionStrSmall 0.9.14 AppVersionStr 0.9.14 DevChannel 1 -BetaVersion 9014001 +BetaVersion 9014002