diff --git a/Telegram/Build.bat b/Telegram/Build.bat
new file mode 100644
index 0000000000..e0a9d9ac3b
--- /dev/null
+++ b/Telegram/Build.bat
@@ -0,0 +1,123 @@
+@echo OFF
+FOR /F "tokens=1,2* delims= " %%i in (Version) do set "%%i=%%j"
+
+if %DevChannel% neq 0 goto preparedev
+
+set "DevParam="
+set "AppVersionStrFull=%AppVersionStr%"
+goto devprepared
+
+:preparedev
+
+set "DevParam=-dev"
+set "AppVersionStrFull=%AppVersionStr%.dev"
+
+:devprepared
+
+echo.
+echo Building version %AppVersionStrFull% for Windows..
+echo.
+
+if exist ..\Win32\Deploy\deploy\%AppVersionStrMajor%\%AppVersionStr%\ goto error_exist1
+if exist ..\Win32\Deploy\deploy\%AppVersionStrMajor%\%AppVersionStr%.dev\ goto error_exist2
+if exist ..\Win32\Deploy\tupdate%AppVersion% goto error_exist3
+
+cd SourceFiles\
+copy telegram.qrc /B+,,/Y
+cd ..\
+if %errorlevel% neq 0 goto error
+
+cd ..\
+MSBuild Telegram.sln /property:Configuration=Deploy
+if %errorlevel% neq 0 goto error0
+
+echo .
+echo Version %AppVersionStrFull% build successfull! Preparing..
+echo .
+
+set "PATH=%PATH%;C:\Program Files\7-Zip;C:\Program Files (x86)\Inno Setup 5"
+cd Win32\Deploy\
+
+call ..\..\..\TelegramPrivate\Sign.bat Telegram.exe
+if %errorlevel% neq 0 goto error1
+
+call ..\..\..\TelegramPrivate\Sign.bat Updater.exe
+if %errorlevel% neq 0 goto error1
+
+iscc /dMyAppVersion=%AppVersionStrSmall% /dMyAppVersionZero=%AppVersionStr% /dMyAppVersionFull=%AppVersionStrFull% ..\..\Telegram\Setup.iss
+if %errorlevel% neq 0 goto error1
+
+call ..\..\..\TelegramPrivate\Sign.bat tsetup.%AppVersionStrFull%.exe
+if %errorlevel% neq 0 goto error1
+
+call Packer.exe -version %AppVersion% -path Telegram.exe -path Updater.exe %DevParam%
+if %errorlevel% neq 0 goto error1
+
+if not exist deploy mkdir deploy
+if not exist deploy\%AppVersionStrMajor% mkdir deploy\%AppVersionStrMajor%
+mkdir deploy\%AppVersionStrMajor%\%AppVersionStrFull%
+mkdir deploy\%AppVersionStrMajor%\%AppVersionStrFull%\Telegram
+if %errorlevel% neq 0 goto error1
+
+move Telegram.exe deploy\%AppVersionStrMajor%\%AppVersionStrFull%\Telegram\
+move Updater.exe deploy\%AppVersionStrMajor%\%AppVersionStrFull%\
+move Telegram.pdb deploy\%AppVersionStrMajor%\%AppVersionStrFull%\
+move Updater.pdb deploy\%AppVersionStrMajor%\%AppVersionStrFull%\
+move tsetup.%AppVersionStrFull%.exe deploy\%AppVersionStrMajor%\%AppVersionStrFull%\
+move tupdate%AppVersion% deploy\%AppVersionStrMajor%\%AppVersionStrFull%\
+if %errorlevel% neq 0 goto error1
+
+cd deploy\%AppVersionStrMajor%\%AppVersionStrFull%\
+7z a -mx9 tportable.%AppVersionStrFull%.zip Telegram\
+if %errorlevel% neq 0 goto error2
+
+echo .
+echo Version %AppVersionStrFull% is ready for deploy!
+echo .
+
+if not exist tupdate%AppVersion% goto error2
+if not exist tportable.%AppVersionStrFull%.zip goto error2
+if not exist tsetup.%AppVersionStrFull%.exe goto error2
+if not exist Telegram.pdb goto error2
+if not exist Updater.exe goto error2
+if not exist Updater.pdb goto error2
+if not exist Z:\TBuild\tother\tsetup\%AppVersionStrMajor% mkdir Z:\TBuild\tother\tsetup\%AppVersionStrMajor%
+if not exist Z:\TBuild\tother\tsetup\%AppVersionStrMajor%\%AppVersionStrFull% mkdir Z:\TBuild\tother\tsetup\%AppVersionStrMajor%\%AppVersionStrFull%
+
+xcopy tupdate%AppVersion% Z:\TBuild\tother\tsetup\%AppVersionStrMajor%\%AppVersionStrFull%\
+xcopy tportable.%AppVersionStrFull%.zip Z:\TBuild\tother\tsetup\%AppVersionStrMajor%\%AppVersionStrFull%\
+xcopy tsetup.%AppVersionStrFull%.exe Z:\TBuild\tother\tsetup\%AppVersionStrMajor%\%AppVersionStrFull%\
+xcopy Telegram.pdb Z:\TBuild\tother\tsetup\%AppVersionStrMajor%\%AppVersionStrFull%\
+xcopy Updater.exe Z:\TBuild\tother\tsetup\%AppVersionStrMajor%\%AppVersionStrFull%\
+xcopy Updater.pdb Z:\TBuild\tother\tsetup\%AppVersionStrMajor%\%AppVersionStrFull%\
+
+echo Version %AppVersionStrFull% is ready!
+
+cd ..\..\..\..\..\Telegram\
+goto eof
+
+:error2
+cd ..\..\..\
+:error1
+cd ..\..\
+:error0
+cd Telegram\
+goto error
+
+:error_exist1
+echo Deploy folder for version %AppVersionStr% already exists!
+exit /b 1
+
+:error_exist2
+echo Deploy folder for version %AppVersionStr%.dev already exists!
+exit /b 1
+
+:error_exist3
+echo Update file for version %AppVersion% already exists!
+exit /b 1
+
+:error
+echo ERROR occured!
+exit /b %errorlevel%
+
+:eof
diff --git a/Telegram/FixMake.sh b/Telegram/FixMake.sh
index da1e041c05..77a933e1a1 100755
--- a/Telegram/FixMake.sh
+++ b/Telegram/FixMake.sh
@@ -21,7 +21,6 @@ Replace '\-lSM' '\/usr\/lib\/x86_64\-linux\-gnu\/libSM\.a'
Replace '\-lICE' '\/usr\/lib\/x86_64\-linux\-gnu\/libICE\.a'
Replace '\-lfontconfig' '\/usr\/lib\/x86_64\-linux\-gnu\/libfontconfig\.a \/usr\/lib\/x86_64\-linux\-gnu\/libexpat\.a'
Replace '\-lfreetype' '\/usr\/lib\/x86_64\-linux\-gnu\/libfreetype\.a'
-Replace '\-lpng' '\/usr\/lib\/x86_64\-linux\-gnu\/libpng\.a'
Replace '\-lXext' '\/usr\/lib\/x86_64\-linux\-gnu\/libXext\.a'
Replace '\-lopus' '\/usr\/local\/lib\/libopus\.a'
Replace '\-lopenal' '\/usr\/local\/lib\/libopenal\.a'
diff --git a/Telegram/SourceFiles/gui/text.h b/Telegram/SourceFiles/gui/text.h
index ef0b81d823..8c78bcb905 100644
--- a/Telegram/SourceFiles/gui/text.h
+++ b/Telegram/SourceFiles/gui/text.h
@@ -676,7 +676,7 @@ inline bool chIsTrimmed(QChar ch, bool rich = false) {
}
inline bool chIsDiac(QChar ch) { // diac and variation selectors
QChar::Category c = ch.category();
- return (c == QChar::Mark_NonSpacing);
+ return (c == QChar::Mark_NonSpacing) || (ch.unicode() == 1652);
}
inline int32 chMaxDiacAfterSymbol() {
return 2;
diff --git a/Telegram/Telegram.vcxproj b/Telegram/Telegram.vcxproj
index cc22e26c2d..2f5fd505dd 100644
--- a/Telegram/Telegram.vcxproj
+++ b/Telegram/Telegram.vcxproj
@@ -2119,6 +2119,9 @@
true
true
+
+
+
diff --git a/Telegram/Telegram.vcxproj.filters b/Telegram/Telegram.vcxproj.filters
index 47eb598686..ef06d3cd25 100644
--- a/Telegram/Telegram.vcxproj.filters
+++ b/Telegram/Telegram.vcxproj.filters
@@ -40,6 +40,12 @@
{67311646-a8af-4626-976d-0a5733bf90e8}
+
+ {df139398-6d5d-4bd5-8abe-b509b102f5d8}
+
+
+ {9d7bbb7d-817b-4f19-a719-74e674bdc84b}
+
@@ -1006,8 +1012,6 @@
gui
-
-
gui
@@ -1143,10 +1147,6 @@
Source Files
-
-
-
-
boxes
@@ -1189,13 +1189,27 @@
Source Files
-
-
-
-
-
-
-
+
+ Resources
+
+
+ Resources
+
+
+ Resources
+
+
+ Resources
+
+
+ Resources
+
+
+ Resources
+
+
+ Resources
+
@@ -1219,5 +1233,24 @@
Source Files
+
+ Version
+
+
+ Version
+
+
+ Version
+
+
+
+
+ Resources
+
+
+
+
+ Version
+
\ No newline at end of file
diff --git a/Telegram/_openssl_patch.diff b/Telegram/_openssl_patch.diff
new file mode 100644
index 0000000000..51df18a67d
--- /dev/null
+++ b/Telegram/_openssl_patch.diff
@@ -0,0 +1,13 @@
+diff --git a/e_os.h b/e_os.h
+index 7584485..0b37c94 100644
+--- a/e_os.h
++++ b/e_os.h
+@@ -315,7 +315,7 @@ static __inline unsigned int _strlen31(const char *str)
+ # undef isxdigit
+ # endif
+ # if defined(_MSC_VER) && !defined(_DLL) && defined(stdin)
+-# if _MSC_VER>=1300
++# if (_MSC_VER>=1300) && (_MSC_VER<=1800)
+ # undef stdin
+ # undef stdout
+ # undef stderr