2014-05-30 08:53:19 +00:00
|
|
|
|
/*
|
|
|
|
|
This file is part of Telegram Desktop,
|
2014-12-01 10:47:38 +00:00
|
|
|
|
the official desktop version of Telegram messaging app, see https://telegram.org
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
|
|
Telegram Desktop is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
It is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
2015-10-03 13:16:42 +00:00
|
|
|
|
In addition, as a special exception, the copyright holders give permission
|
|
|
|
|
to link the code of portions of this program with the OpenSSL library.
|
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
|
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
2016-02-08 10:56:18 +00:00
|
|
|
|
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
2014-05-30 08:53:19 +00:00
|
|
|
|
*/
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2016-04-27 12:02:17 +00:00
|
|
|
|
#include "core/version.h"
|
|
|
|
|
#include "settings.h"
|
2014-09-30 22:50:35 +00:00
|
|
|
|
|
2016-05-04 10:41:41 +00:00
|
|
|
|
constexpr str_const AppNameOld = "Telegram Win (Unofficial)";
|
|
|
|
|
constexpr str_const AppName = "Telegram Desktop";
|
2014-09-30 22:50:35 +00:00
|
|
|
|
|
2016-05-04 10:41:41 +00:00
|
|
|
|
constexpr str_const AppId = "{53F49750-6209-4FBF-9CA8-7A333C87D1ED}"; // used in updater.cpp and Setup.iss for Windows
|
|
|
|
|
constexpr str_const AppFile = "Telegram";
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
MTPShortBufferSize = 65535, // of ints, 256 kb
|
|
|
|
|
MTPPacketSizeMax = 67108864, // 64 mb
|
|
|
|
|
MTPIdsBufferSize = 400, // received msgIds and wereAcked msgIds count stored
|
2014-10-30 16:23:44 +00:00
|
|
|
|
MTPCheckResendTimeout = 10000, // how much time passed from send till we resend request or check it's state, in ms
|
2014-05-30 08:53:19 +00:00
|
|
|
|
MTPCheckResendWaiting = 1000, // how much time to wait for some more requests, when resending request or checking it's state, in ms
|
2014-11-05 17:43:32 +00:00
|
|
|
|
MTPAckSendWaiting = 10000, // how much time to wait for some more requests, when sending msg acks
|
2014-05-30 08:53:19 +00:00
|
|
|
|
MTPResendThreshold = 1, // how much ints should message contain for us not to resend, but to check it's state
|
|
|
|
|
MTPContainerLives = 600, // container lives 10 minutes in haveSent map
|
2014-11-18 12:41:33 +00:00
|
|
|
|
MTPMinReceiveDelay = 4000, // 4 seconds
|
2014-05-30 08:53:19 +00:00
|
|
|
|
MTPMaxReceiveDelay = 64000, // 64 seconds
|
2015-06-02 11:22:00 +00:00
|
|
|
|
MTPMinConnectDelay = 1000, // tcp connect should take less then 1 second
|
|
|
|
|
MTPMaxConnectDelay = 8000, // tcp connect should take 8 seconds max
|
2014-05-30 08:53:19 +00:00
|
|
|
|
MTPConnectionOldTimeout = 192000, // 192 seconds
|
2015-06-10 12:48:26 +00:00
|
|
|
|
MTPTcpConnectionWaitTimeout = 2000, // 2 seconds waiting for tcp, until we accept http
|
|
|
|
|
MTPIPv4ConnectionWaitTimeout = 1000, // 1 seconds waiting for ipv4, until we accept ipv6
|
2014-05-30 08:53:19 +00:00
|
|
|
|
MTPMillerRabinIterCount = 30, // 30 Miller-Rabin iterations for dh_prime primality check
|
|
|
|
|
|
2016-02-29 11:34:44 +00:00
|
|
|
|
MTPUploadSessionsCount = 2, // max 2 upload sessions is created
|
|
|
|
|
MTPDownloadSessionsCount = 2, // max 2 download sessions is created
|
2014-10-30 16:23:44 +00:00
|
|
|
|
MTPKillFileSessionTimeout = 5000, // how much time without upload / download causes additional session kill
|
|
|
|
|
|
2016-02-23 09:52:18 +00:00
|
|
|
|
MTPEnumDCTimeout = 8000, // 8 seconds timeout for help_getConfig to work (then move to other dc)
|
2014-08-01 18:49:43 +00:00
|
|
|
|
|
2014-10-20 22:49:37 +00:00
|
|
|
|
MTPDebugBufferSize = 1024 * 1024, // 1 mb start size
|
|
|
|
|
|
2015-12-06 15:50:02 +00:00
|
|
|
|
MaxUsersPerInvite = 100, // max users in one super group invite request
|
|
|
|
|
|
2015-03-12 10:28:10 +00:00
|
|
|
|
MTPPingDelayDisconnect = 60, // 1 min
|
|
|
|
|
MTPPingSendAfterAuto = 30, // send new ping starting from 30 seconds (add to existing container)
|
|
|
|
|
MTPPingSendAfter = 45, // send new ping after 45 seconds without ping
|
|
|
|
|
|
2015-09-13 08:41:27 +00:00
|
|
|
|
MTPChannelGetDifferenceLimit = 100,
|
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
|
MaxSelectedItems = 100,
|
|
|
|
|
|
2015-10-11 08:37:24 +00:00
|
|
|
|
MaxPhoneCodeLength = 4, // max length of country phone code
|
2015-12-03 18:16:34 +00:00
|
|
|
|
MaxPhoneTailLength = 32, // rest of the phone number, without country code (seen 12 at least), need more for service numbers
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
|
|
MaxScrollSpeed = 37, // 37px per 15ms while select-by-drag
|
|
|
|
|
FingerAccuracyThreshold = 3, // touch flick ignore 3px
|
|
|
|
|
MaxScrollAccelerated = 4000, // 4000px per second
|
|
|
|
|
MaxScrollFlick = 2500, // 2500px per second
|
|
|
|
|
|
|
|
|
|
LocalEncryptIterCount = 4000, // key derivation iteration count
|
|
|
|
|
LocalEncryptNoPwdIterCount = 4, // key derivation iteration count without pwd (not secure anyway)
|
|
|
|
|
LocalEncryptSaltSize = 32, // 256 bit
|
|
|
|
|
LocalEncryptKeySize = 256, // 2048 bit
|
|
|
|
|
|
2014-07-04 11:12:54 +00:00
|
|
|
|
AnimationTimerDelta = 7,
|
2015-12-30 08:36:04 +00:00
|
|
|
|
ClipThreadsCount = 8,
|
2015-12-16 13:35:15 +00:00
|
|
|
|
AverageGifSize = 320 * 240,
|
2015-12-16 14:39:26 +00:00
|
|
|
|
WaitBeforeGifPause = 200, // wait 200ms for gif draw before pausing it
|
2015-12-30 19:09:20 +00:00
|
|
|
|
InlineBotRequestDelay = 400, // wait 400ms before context bot realtime request
|
2016-01-01 14:48:32 +00:00
|
|
|
|
RecentInlineBotsLimit = 10,
|
2014-07-04 11:12:54 +00:00
|
|
|
|
|
2015-12-17 17:31:28 +00:00
|
|
|
|
AVBlockSize = 4096, // 4Kb for ffmpeg blocksize
|
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
|
SaveRecentEmojisTimeout = 3000, // 3 secs
|
2014-07-16 05:03:01 +00:00
|
|
|
|
SaveWindowPositionTimeout = 1000, // 1 sec
|
2014-07-04 11:12:54 +00:00
|
|
|
|
|
2014-07-13 09:50:38 +00:00
|
|
|
|
AutoSearchTimeout = 900, // 0.9 secs
|
2014-07-04 11:12:54 +00:00
|
|
|
|
SearchPerPage = 50,
|
2014-08-15 11:19:32 +00:00
|
|
|
|
SearchManyPerPage = 100,
|
2015-08-28 15:15:56 +00:00
|
|
|
|
LinksOverviewPerPage = 12,
|
2014-08-11 09:03:45 +00:00
|
|
|
|
MediaOverviewStartPerPage = 5,
|
|
|
|
|
MediaOverviewPreloadCount = 4,
|
2014-09-04 07:33:44 +00:00
|
|
|
|
|
2016-03-22 19:43:47 +00:00
|
|
|
|
// a new message from the same sender is attached to previous within 15 minutes
|
|
|
|
|
AttachMessageToPreviousSecondsDelta = 900,
|
2016-03-21 18:40:00 +00:00
|
|
|
|
|
2014-09-04 07:33:44 +00:00
|
|
|
|
AudioVoiceMsgSimultaneously = 4,
|
2015-06-30 21:07:05 +00:00
|
|
|
|
AudioSongSimultaneously = 4,
|
2014-09-04 07:33:44 +00:00
|
|
|
|
AudioCheckPositionTimeout = 100, // 100ms per check audio pos
|
2015-07-03 08:47:16 +00:00
|
|
|
|
AudioCheckPositionDelta = 2400, // update position called each 2400 samples
|
2015-06-30 21:07:05 +00:00
|
|
|
|
AudioFadeTimeout = 7, // 7ms
|
2014-09-04 07:33:44 +00:00
|
|
|
|
AudioFadeDuration = 500,
|
2015-05-29 18:52:43 +00:00
|
|
|
|
AudioVoiceMsgSkip = 400, // 200ms
|
|
|
|
|
AudioVoiceMsgFade = 300, // 300ms
|
2014-09-04 07:33:44 +00:00
|
|
|
|
AudioPreloadSamples = 5 * 48000, // preload next part if less than 5 seconds remains
|
|
|
|
|
AudioVoiceMsgFrequency = 48000, // 48 kHz
|
2015-05-29 18:52:43 +00:00
|
|
|
|
AudioVoiceMsgMaxLength = 100 * 60, // 100 minutes
|
|
|
|
|
AudioVoiceMsgUpdateView = 100, // 100ms
|
2014-09-04 07:33:44 +00:00
|
|
|
|
AudioVoiceMsgChannels = 2, // stereo
|
|
|
|
|
AudioVoiceMsgBufferSize = 1024 * 1024, // 1 Mb buffers
|
2015-12-15 14:50:51 +00:00
|
|
|
|
AudioVoiceMsgInMemory = 2 * 1024 * 1024, // 2 Mb audio is hold in memory and auto loaded
|
2015-06-03 12:18:46 +00:00
|
|
|
|
AudioPauseDeviceTimeout = 3000, // pause in 3 secs after playing is over
|
2015-01-05 20:17:33 +00:00
|
|
|
|
|
2016-02-12 16:35:06 +00:00
|
|
|
|
WaveformSamplesCount = 100,
|
|
|
|
|
|
2015-12-23 16:48:44 +00:00
|
|
|
|
StickerInMemory = 2 * 1024 * 1024, // 2 Mb stickers hold in memory, auto loaded and displayed inline
|
2015-01-10 13:08:30 +00:00
|
|
|
|
StickerMaxSize = 2048, // 2048x2048 is a max image size for sticker
|
2014-10-07 17:57:57 +00:00
|
|
|
|
|
2015-12-23 16:48:44 +00:00
|
|
|
|
AnimationInMemory = 10 * 1024 * 1024, // 10 Mb gif and mp4 animations held in memory while playing
|
2015-12-15 14:50:51 +00:00
|
|
|
|
|
2014-10-10 12:46:20 +00:00
|
|
|
|
MediaViewImageSizeLimit = 100 * 1024 * 1024, // show up to 100mb jpg/png/gif docs in app
|
2014-10-07 17:57:57 +00:00
|
|
|
|
MaxZoomLevel = 7, // x8
|
2014-12-15 15:55:45 +00:00
|
|
|
|
ZoomToScreenLevel = 1024, // just constant
|
2014-10-08 07:42:36 +00:00
|
|
|
|
|
2016-02-27 19:39:51 +00:00
|
|
|
|
ShortcutsCountLimit = 256, // how many shortcuts can be in json file
|
|
|
|
|
|
2014-10-08 07:42:36 +00:00
|
|
|
|
PreloadHeightsCount = 3, // when 3 screens to scroll left make a preload request
|
2015-05-19 15:46:45 +00:00
|
|
|
|
EmojiPanPerRow = 7,
|
|
|
|
|
EmojiPanRowsPerPage = 6,
|
|
|
|
|
StickerPanPerRow = 5,
|
|
|
|
|
StickerPanRowsPerPage = 4,
|
2015-01-02 14:55:24 +00:00
|
|
|
|
StickersUpdateTimeout = 3600000, // update not more than once in an hour
|
2014-10-22 18:39:03 +00:00
|
|
|
|
|
|
|
|
|
SearchPeopleLimit = 5,
|
|
|
|
|
MinUsernameLength = 5,
|
|
|
|
|
MaxUsernameLength = 32,
|
|
|
|
|
UsernameCheckTimeout = 200,
|
2014-11-05 17:43:32 +00:00
|
|
|
|
|
2016-02-26 14:41:09 +00:00
|
|
|
|
MaxChannelDescription = 255,
|
2015-10-11 08:37:24 +00:00
|
|
|
|
MaxGroupChannelTitle = 255,
|
2016-02-26 14:41:09 +00:00
|
|
|
|
MaxPhotoCaption = 200,
|
2015-09-16 21:15:13 +00:00
|
|
|
|
|
2014-11-05 17:43:32 +00:00
|
|
|
|
MaxMessageSize = 4096,
|
2014-11-12 20:18:00 +00:00
|
|
|
|
MaxHttpRedirects = 5, // when getting external data/images
|
2014-11-22 09:45:04 +00:00
|
|
|
|
|
|
|
|
|
WriteMapTimeout = 1000,
|
|
|
|
|
SaveDraftTimeout = 1000, // save draft after 1 secs of not changing text
|
|
|
|
|
SaveDraftAnywayTimeout = 5000, // or save anyway each 5 secs
|
2014-12-12 16:27:03 +00:00
|
|
|
|
|
2015-06-10 12:48:26 +00:00
|
|
|
|
SetOnlineAfterActivity = 30, // user with hidden last seen stays online for such amount of seconds in the interface
|
2015-01-23 09:48:21 +00:00
|
|
|
|
|
2014-12-12 16:27:03 +00:00
|
|
|
|
ServiceUserId = 777000,
|
2015-04-04 20:01:34 +00:00
|
|
|
|
WebPageUserId = 701000,
|
2015-02-03 15:02:46 +00:00
|
|
|
|
|
|
|
|
|
CacheBackgroundTimeout = 3000, // cache background scaled image after 3s
|
|
|
|
|
BackgroundsInRow = 3,
|
2015-02-09 13:26:59 +00:00
|
|
|
|
|
|
|
|
|
UpdateDelayConstPart = 8 * 3600, // 8 hour min time between update check requests
|
|
|
|
|
UpdateDelayRandPart = 8 * 3600, // 8 hour max - min time between update check requests
|
2015-03-02 12:34:16 +00:00
|
|
|
|
|
|
|
|
|
WrongPasscodeTimeout = 1500,
|
2015-04-02 10:33:19 +00:00
|
|
|
|
SessionsShortPollTimeout = 60000,
|
2015-06-26 09:07:59 +00:00
|
|
|
|
|
|
|
|
|
ChoosePeerByDragTimeout = 1000, // 1 second mouse not moved to choose dialog when dragging a file
|
2015-09-25 07:47:32 +00:00
|
|
|
|
ReloadChannelMembersTimeout = 1000, // 1 second wait before reload members in channel after adding
|
2016-03-05 21:12:55 +00:00
|
|
|
|
|
|
|
|
|
PinnedMessageTextLimit = 16,
|
2014-05-30 08:53:19 +00:00
|
|
|
|
};
|
|
|
|
|
|
2015-08-12 18:01:32 +00:00
|
|
|
|
inline bool isNotificationsUser(uint64 id) {
|
2014-12-12 16:27:03 +00:00
|
|
|
|
return (id == 333000) || (id == ServiceUserId);
|
2014-11-22 09:45:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-08-12 18:01:32 +00:00
|
|
|
|
inline bool isServiceUser(uint64 id) {
|
|
|
|
|
return !(id % 1000);// (id == 333000) || (id == ServiceUserId);
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
|
inline const GUID &cGUID() {
|
|
|
|
|
static const GUID gGuid = { 0x87a94ab0, 0xe370, 0x4cde, { 0x98, 0xd3, 0xac, 0xc1, 0x10, 0xc5, 0x96, 0x7d } };
|
|
|
|
|
|
|
|
|
|
return gGuid;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
inline const char *cGUIDStr() {
|
|
|
|
|
static const char *gGuidStr = "{87A94AB0-E370-4cde-98D3-ACC110C5967D}";
|
|
|
|
|
|
|
|
|
|
return gGuidStr;
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-23 18:12:07 +00:00
|
|
|
|
inline const char **cPublicRSAKeys(int &keysCount) {
|
2014-05-30 08:53:19 +00:00
|
|
|
|
static const char *(keys[]) = {"\
|
|
|
|
|
-----BEGIN RSA PUBLIC KEY-----\n\
|
|
|
|
|
MIIBCgKCAQEAwVACPi9w23mF3tBkdZz+zwrzKOaaQdr01vAbU4E1pvkfj4sqDsm6\n\
|
|
|
|
|
lyDONS789sVoD/xCS9Y0hkkC3gtL1tSfTlgCMOOul9lcixlEKzwKENj1Yz/s7daS\n\
|
|
|
|
|
an9tqw3bfUV/nqgbhGX81v/+7RFAEd+RwFnK7a+XYl9sluzHRyVVaTTveB2GazTw\n\
|
|
|
|
|
Efzk2DWgkBluml8OREmvfraX3bkHZJTKX4EQSjBbbdJ2ZXIsRrYOXfaA+xayEGB+\n\
|
|
|
|
|
8hdlLmAjbCVfaigxX0CDqWeR1yFL9kwd9P0NsZRPsmoqVwMbMu7mStFai6aIhc3n\n\
|
|
|
|
|
Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB\n\
|
|
|
|
|
-----END RSA PUBLIC KEY-----"};
|
2016-03-23 18:12:07 +00:00
|
|
|
|
keysCount = arraysize(keys);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
return keys;
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-01 18:49:43 +00:00
|
|
|
|
struct BuiltInDc {
|
|
|
|
|
int id;
|
|
|
|
|
const char *ip;
|
|
|
|
|
int port;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const BuiltInDc _builtInDcs[] = {
|
2014-11-25 20:33:11 +00:00
|
|
|
|
{ 1, "149.154.175.50", 443 },
|
|
|
|
|
{ 2, "149.154.167.51", 443 },
|
2015-02-10 12:46:38 +00:00
|
|
|
|
{ 3, "149.154.175.100", 443 },
|
2014-11-25 20:33:11 +00:00
|
|
|
|
{ 4, "149.154.167.91", 443 },
|
|
|
|
|
{ 5, "149.154.171.5", 443 }
|
2014-08-01 18:49:43 +00:00
|
|
|
|
};
|
|
|
|
|
|
2015-06-10 12:48:26 +00:00
|
|
|
|
static const BuiltInDc _builtInDcsIPv6[] = {
|
|
|
|
|
{ 1, "2001:b28:f23d:f001::a", 443 },
|
|
|
|
|
{ 2, "2001:67c:4e8:f002::a", 443 },
|
|
|
|
|
{ 3, "2001:b28:f23d:f003::a", 443 },
|
|
|
|
|
{ 4, "2001:67c:4e8:f004::a", 443 },
|
|
|
|
|
{ 5, "2001:b28:f23f:f005::a", 443 }
|
|
|
|
|
};
|
|
|
|
|
|
2014-08-01 18:49:43 +00:00
|
|
|
|
static const BuiltInDc _builtInTestDcs[] = {
|
2015-01-23 15:24:36 +00:00
|
|
|
|
{ 1, "149.154.175.10", 443 },
|
2014-12-13 14:26:08 +00:00
|
|
|
|
{ 2, "149.154.167.40", 443 },
|
2015-06-10 12:48:26 +00:00
|
|
|
|
{ 3, "149.154.175.117", 443 }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const BuiltInDc _builtInTestDcsIPv6[] = {
|
|
|
|
|
{ 1, "2001:b28:f23d:f001::e", 443 },
|
|
|
|
|
{ 2, "2001:67c:4e8:f002::e", 443 },
|
|
|
|
|
{ 3, "2001:b28:f23d:f003::e", 443 }
|
2014-08-01 18:49:43 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
inline const BuiltInDc *builtInDcs() {
|
|
|
|
|
return cTestMode() ? _builtInTestDcs : _builtInDcs;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-08-01 18:49:43 +00:00
|
|
|
|
inline int builtInDcsCount() {
|
|
|
|
|
return (cTestMode() ? sizeof(_builtInTestDcs) : sizeof(_builtInDcs)) / sizeof(BuiltInDc);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-06-10 12:48:26 +00:00
|
|
|
|
inline const BuiltInDc *builtInDcsIPv6() {
|
|
|
|
|
return cTestMode() ? _builtInTestDcsIPv6 : _builtInDcsIPv6;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline int builtInDcsCountIPv6() {
|
|
|
|
|
return (cTestMode() ? sizeof(_builtInTestDcsIPv6) : sizeof(_builtInDcsIPv6)) / sizeof(BuiltInDc);
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
|
static const char *UpdatesPublicKey = "\
|
|
|
|
|
-----BEGIN RSA PUBLIC KEY-----\n\
|
|
|
|
|
MIGJAoGBAMA4ViQrjkPZ9xj0lrer3r23JvxOnrtE8nI69XLGSr+sRERz9YnUptnU\n\
|
|
|
|
|
BZpkIfKaRcl6XzNJiN28cVwO1Ui5JSa814UAiDHzWUqCaXUiUEQ6NmNTneiGx2sQ\n\
|
|
|
|
|
+9PKKlb8mmr3BB9A45ZNwLT6G9AK3+qkZLHojeSA+m84/a6GP4svAgMBAAE=\n\
|
|
|
|
|
-----END RSA PUBLIC KEY-----\
|
|
|
|
|
";
|
|
|
|
|
|
2016-04-27 12:02:17 +00:00
|
|
|
|
static const char *UpdatesPublicAlphaKey = "\
|
2015-02-05 14:49:50 +00:00
|
|
|
|
-----BEGIN RSA PUBLIC KEY-----\n\
|
|
|
|
|
MIGJAoGBALWu9GGs0HED7KG7BM73CFZ6o0xufKBRQsdnq3lwA8nFQEvmdu+g/I1j\n\
|
|
|
|
|
0LQ+0IQO7GW4jAgzF/4+soPDb6uHQeNFrlVx1JS9DZGhhjZ5rf65yg11nTCIHZCG\n\
|
|
|
|
|
w/CVnbwQOw0g5GBwwFV3r0uTTvy44xx8XXxk+Qknu4eBCsmrAFNnAgMBAAE=\n\
|
|
|
|
|
-----END RSA PUBLIC KEY-----\
|
|
|
|
|
";
|
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
|
#ifdef CUSTOM_API_ID
|
|
|
|
|
#include "../../../TelegramPrivate/custom_api_id.h" // Custom API id and API hash
|
|
|
|
|
#else
|
|
|
|
|
static const int32 ApiId = 17349;
|
|
|
|
|
static const char *ApiHash = "344583e45741c457fe1862106095a5eb";
|
|
|
|
|
#endif
|
|
|
|
|
|
2016-04-27 12:02:17 +00:00
|
|
|
|
#ifndef BETA_VERSION_MACRO
|
|
|
|
|
#error "Beta version macro is not defined."
|
2015-12-03 18:16:34 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
2016-04-27 12:02:17 +00:00
|
|
|
|
#if (defined CUSTOM_API_ID) && (BETA_VERSION_MACRO > 0ULL)
|
2015-12-03 18:16:34 +00:00
|
|
|
|
#include "../../../TelegramPrivate/beta_private.h" // private key for downloading closed betas
|
|
|
|
|
#else
|
|
|
|
|
static const char *BetaPrivateKey = "";
|
|
|
|
|
#endif
|
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
|
inline const char *cApiDeviceModel() {
|
2014-07-13 09:50:38 +00:00
|
|
|
|
#ifdef Q_OS_WIN
|
2015-04-06 22:15:29 +00:00
|
|
|
|
return "PC";
|
|
|
|
|
#elif defined Q_OS_MAC
|
|
|
|
|
return "Mac";
|
|
|
|
|
#elif defined Q_OS_LINUX
|
|
|
|
|
return "PC";
|
2014-07-13 09:50:38 +00:00
|
|
|
|
#endif
|
2014-05-30 08:53:19 +00:00
|
|
|
|
}
|
|
|
|
|
inline const char *cApiSystemVersion() {
|
2014-07-13 09:50:38 +00:00
|
|
|
|
#ifdef Q_OS_WIN
|
2015-04-06 22:15:29 +00:00
|
|
|
|
return "Windows";
|
2014-07-13 09:50:38 +00:00
|
|
|
|
#elif defined Q_OS_MAC
|
2015-04-06 22:15:29 +00:00
|
|
|
|
return "OS X";
|
2014-07-13 09:50:38 +00:00
|
|
|
|
#elif defined Q_OS_LINUX
|
2015-04-06 22:15:29 +00:00
|
|
|
|
return "Linux";
|
2014-07-13 09:50:38 +00:00
|
|
|
|
#endif
|
2014-05-30 08:53:19 +00:00
|
|
|
|
}
|
|
|
|
|
inline QString cApiAppVersion() {
|
|
|
|
|
return QString::number(AppVersion);
|
|
|
|
|
}
|
|
|
|
|
static const char *ApiLang = "en";
|
|
|
|
|
|
|
|
|
|
extern QString gKeyFile;
|
|
|
|
|
inline const QString &cDataFile() {
|
|
|
|
|
if (!gKeyFile.isEmpty()) return gKeyFile;
|
2015-04-02 10:33:19 +00:00
|
|
|
|
static const QString res(qsl("data"));
|
2014-05-30 08:53:19 +00:00
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline const QString &cTempDir() {
|
|
|
|
|
static const QString res = cWorkingDir() + qsl("tdata/tdld/");
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static const char *DefaultCountry = "US";
|
|
|
|
|
static const char *DefaultLanguage = "en";
|
|
|
|
|
|
|
|
|
|
enum {
|
2015-04-23 15:50:11 +00:00
|
|
|
|
DefaultChatBackground = 21,
|
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
|
DialogsFirstLoad = 20, // first dialogs part size requested
|
2015-09-06 10:17:09 +00:00
|
|
|
|
DialogsPerPage = 500, // next dialogs part size
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
2015-11-20 18:24:44 +00:00
|
|
|
|
MessagesFirstLoad = 30, // first history part size requested
|
|
|
|
|
MessagesPerPage = 50, // next history part size
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
2015-10-27 02:39:02 +00:00
|
|
|
|
FileLoaderQueueStopTimeout = 5000,
|
|
|
|
|
|
2014-10-30 16:23:44 +00:00
|
|
|
|
DownloadPartSize = 64 * 1024, // 64kb for photo
|
2014-05-30 08:53:19 +00:00
|
|
|
|
DocumentDownloadPartSize = 128 * 1024, // 128kb for document
|
2015-10-27 02:39:02 +00:00
|
|
|
|
MaxUploadPhotoSize = 256 * 1024 * 1024, // 256mb photos max
|
2014-05-30 08:53:19 +00:00
|
|
|
|
MaxUploadDocumentSize = 1500 * 1024 * 1024, // 1500mb documents max
|
|
|
|
|
UseBigFilesFrom = 10 * 1024 * 1024, // mtp big files methods used for files greater than 10mb
|
2014-10-30 16:23:44 +00:00
|
|
|
|
MaxFileQueries = 16, // max 16 file parts downloaded at the same time
|
2015-12-30 19:09:20 +00:00
|
|
|
|
MaxWebFileQueries = 8, // max 8 http[s] files downloaded at the same time
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
|
|
UploadPartSize = 32 * 1024, // 32kb for photo
|
|
|
|
|
DocumentMaxPartsCount = 3000, // no more than 3000 parts
|
|
|
|
|
DocumentUploadPartSize0 = 32 * 1024, // 32kb for tiny document ( < 1mb )
|
|
|
|
|
DocumentUploadPartSize1 = 64 * 1024, // 64kb for little document ( <= 32mb )
|
|
|
|
|
DocumentUploadPartSize2 = 128 * 1024, // 128kb for small document ( <= 375mb )
|
|
|
|
|
DocumentUploadPartSize3 = 256 * 1024, // 256kb for medium document ( <= 750mb )
|
|
|
|
|
DocumentUploadPartSize4 = 512 * 1024, // 512kb for large document ( <= 1500mb )
|
2014-10-30 16:23:44 +00:00
|
|
|
|
MaxUploadFileParallelSize = MTPUploadSessionsCount * 512 * 1024, // max 512kb uploaded at the same time in each session
|
2014-05-30 08:53:19 +00:00
|
|
|
|
UploadRequestInterval = 500, // one part each half second, if not uploaded faster
|
|
|
|
|
|
|
|
|
|
MaxPhotosInMemory = 50, // try to clear some memory after 50 photos are created
|
2015-04-16 14:59:42 +00:00
|
|
|
|
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
|
2015-03-13 13:01:25 +00:00
|
|
|
|
WaitForSkippedTimeout = 1000, // 1s wait for skipped seq or pts in updates
|
2015-09-20 08:55:41 +00:00
|
|
|
|
WaitForChannelGetDifference = 1000, // 1s wait after show channel history before sending getChannelDifference
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
|
|
MemoryForImageCache = 64 * 1024 * 1024, // after 64mb of unpacked images we try to clear some memory
|
2014-07-06 03:32:21 +00:00
|
|
|
|
NotifyWindowsCount = 3, // 3 desktop notifies at the same time
|
2014-05-30 08:53:19 +00:00
|
|
|
|
NotifySettingSaveTimeout = 1000, // wait 1 second before saving notify setting to server
|
2015-08-11 19:50:48 +00:00
|
|
|
|
NotifyDeletePhotoAfter = 60000, // delete notify photo after 1 minute
|
2014-05-30 08:53:19 +00:00
|
|
|
|
UpdateChunk = 100 * 1024, // 100kb parts when downloading the update
|
|
|
|
|
IdleMsecs = 60 * 1000, // after 60secs without user input we think we are idle
|
|
|
|
|
|
2015-09-21 20:57:42 +00:00
|
|
|
|
UpdateFullChannelTimeout = 5000, // not more than once in 5 seconds
|
|
|
|
|
SendViewsTimeout = 1000, // send views each second
|
|
|
|
|
|
2015-04-02 10:33:19 +00:00
|
|
|
|
ForwardOnAdd = 100, // how many messages from chat history server should forward to user, that was added to this chat
|
2014-05-30 08:53:19 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
inline const QRegularExpression &cWordSplit() {
|
2015-11-02 22:36:26 +00:00
|
|
|
|
static QRegularExpression regexp(qsl("[\\@\\s\\-\\+\\(\\)\\[\\]\\{\\}\\<\\>\\,\\.\\:\\!\\_\\;\\\"\\'\\x0]"));
|
2014-05-30 08:53:19 +00:00
|
|
|
|
return regexp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline const QRegularExpression &cRussianLetters() {
|
|
|
|
|
static QRegularExpression regexp(QString::fromUtf8("[а-яА-ЯёЁ]"));
|
|
|
|
|
return regexp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline QStringList cImgExtensions() {
|
|
|
|
|
static QStringList imgExtensions;
|
|
|
|
|
if (imgExtensions.isEmpty()) {
|
|
|
|
|
imgExtensions.reserve(4);
|
|
|
|
|
imgExtensions.push_back(qsl(".jpg"));
|
|
|
|
|
imgExtensions.push_back(qsl(".jpeg"));
|
|
|
|
|
imgExtensions.push_back(qsl(".png"));
|
|
|
|
|
imgExtensions.push_back(qsl(".gif"));
|
|
|
|
|
}
|
|
|
|
|
return imgExtensions;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline QStringList cPhotoExtensions() {
|
|
|
|
|
static QStringList photoExtensions;
|
|
|
|
|
if (photoExtensions.isEmpty()) {
|
|
|
|
|
photoExtensions.push_back(qsl(".jpg"));
|
|
|
|
|
photoExtensions.push_back(qsl(".jpeg"));
|
|
|
|
|
}
|
|
|
|
|
return photoExtensions;
|
|
|
|
|
}
|