git: 01e12e4ddf12 - main - net-im/telegram-desktop: update from 4.2.4 to 4.4.1

From: Sergey A. Osokin <osa_at_FreeBSD.org>
Date: Thu, 08 Dec 2022 22:11:02 UTC
The branch main has been updated by osa:

URL: https://cgit.FreeBSD.org/ports/commit/?id=01e12e4ddf12b64c1f49f9e17059678d8476b5c2

commit 01e12e4ddf12b64c1f49f9e17059678d8476b5c2
Author:     Sergey A. Osokin <osa@FreeBSD.org>
AuthorDate: 2022-12-08 22:07:24 +0000
Commit:     Sergey A. Osokin <osa@FreeBSD.org>
CommitDate: 2022-12-08 22:07:24 +0000

    net-im/telegram-desktop: update from 4.2.4 to 4.4.1
    
    Patches obtained from: https://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/net/tdesktop/patches/
    Hotfix for Qt5: https://github.com/telegramdesktop/tdesktop/commit/5990b0fabf4c28e70955b4b52965609dc282a5fe
    
    Special thanks to:      Klemens Nanni <kn@openbsd.org>
---
 net-im/telegram-desktop/Makefile                   |  9 ++--
 net-im/telegram-desktop/distinfo                   |  6 +--
 ...latform_linux_notifications__manager__linux.cpp | 54 ++++++++++++++++++++++
 ..._SourceFiles_platform_linux_specific__linux.cpp | 39 ++++++++++++++++
 ...ase_platform_linux_base__last__input__linux.cpp | 21 +++++++++
 net-im/telegram-desktop/pkg-plist                  |  4 +-
 6 files changed, 124 insertions(+), 9 deletions(-)

diff --git a/net-im/telegram-desktop/Makefile b/net-im/telegram-desktop/Makefile
index 2d1b9476ba07..4b61f33b21d4 100644
--- a/net-im/telegram-desktop/Makefile
+++ b/net-im/telegram-desktop/Makefile
@@ -1,6 +1,5 @@
 PORTNAME=	telegram-desktop
-DISTVERSION=	4.2.4
-PORTREVISION=	1
+DISTVERSION=	4.4.1
 CATEGORIES=	net-im
 MASTER_SITES=	https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/releases/download/v${DISTVERSION}/
 DISTNAME=	tdesktop-${DISTVERSION}-full
@@ -33,10 +32,12 @@ LIB_DEPENDS=	libabsl_base.so:devel/abseil \
 		libhunspell-1.7.so:textproc/hunspell \
 		libjpeg.so:graphics/jpeg-turbo \
 		liblz4.so:archivers/liblz4 \
+		libminizip.so:archivers/minizip \
 		libopenal.so:audio/openal-soft \
 		libopenh264.so:multimedia/openh264 \
 		libopus.so:audio/opus \
 		libpipewire-0.3.so:multimedia/pipewire \
+		libprotobuf.so:devel/protobuf \
 		libqrcodegencpp.so:graphics/qr-code-generator \
 		librnnoise.so:audio/rnnoise \
 		libxcb-keysyms.so:x11/xcb-util-keysyms \
@@ -52,7 +53,7 @@ qt5_CONFLICTS_INSTALL=	${PORTNAME}-qt6
 qt6_CONFLICTS_INSTALL=	${PORTNAME}
 
 USES=		cmake compiler:c++17-lang desktop-file-utils gl \
-		gnome pkgconfig python:3.7+,build ssl xorg
+		gnome localbase pkgconfig python:3.7+,build ssl xorg
 
 USE_GITHUB=	nodefault
 GH_ACCOUNT=	telegramdesktop
@@ -69,7 +70,7 @@ USE_QT=		5compat base imageformats lottie shadertools svg tools:build wayland
 .endif
 
 USE_GL=		gl
-USE_GNOME=	glib20 glibmm
+USE_GNOME=	glib20 glibmm26
 USE_XORG=	x11 xcb xcomposite xdamage xext xfixes xrandr xrender xtst
 
 CMAKE_ARGS=	-DDESKTOP_APP_SPECIAL_TARGET="" -DTDESKTOP_LAUNCHER_BASENAME="telegramdesktop" \
diff --git a/net-im/telegram-desktop/distinfo b/net-im/telegram-desktop/distinfo
index 1ef1665503fe..217bbbf98d1f 100644
--- a/net-im/telegram-desktop/distinfo
+++ b/net-im/telegram-desktop/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1664664542
-SHA256 (tdesktop-4.2.4-full.tar.gz) = a8109fce9d55553efcbc7c3d9349869e1e267113f5badaf48cf4e0c25cd559d1
-SIZE (tdesktop-4.2.4-full.tar.gz) = 49210806
+TIMESTAMP = 1670536925
+SHA256 (tdesktop-4.4.1-full.tar.gz) = 76981e32541c42b3212427e9abb4db2a6f55a14eaba31b3d7ad7d3d5ed8008b1
+SIZE (tdesktop-4.4.1-full.tar.gz) = 50077498
diff --git a/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_platform_linux_notifications__manager__linux.cpp b/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_platform_linux_notifications__manager__linux.cpp
new file mode 100644
index 000000000000..99edcb91d928
--- /dev/null
+++ b/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_platform_linux_notifications__manager__linux.cpp
@@ -0,0 +1,54 @@
+--- Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp.orig	2022-12-07 09:41:04 UTC
++++ Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp
+@@ -75,12 +75,17 @@ std::unique_ptr<base::Platform::DBus::ServiceWatcher> 
+ 	try {
+ 		const auto connection = Gio::DBus::Connection::get_sync(
+ 			Gio::DBus::BusType::SESSION);
++		const auto GlibNames =
++			base::Platform::DBus::ListActivatableNames(connection);
++		const std::vector<std::string> StringNames(
++			GlibNames.begin(), GlibNames.end()
++		);
+ 
+ 		const auto activatable = [&] {
+ 			try {
+ 				return ranges::contains(
+-					base::Platform::DBus::ListActivatableNames(connection),
+-					Glib::ustring(std::string(kService)));
++					StringNames,
++					std::string(kService));
+ 			} catch (...) {
+ 				// avoid service restart loop in sandboxed environments
+ 				return true;
+@@ -129,7 +134,7 @@ void StartServiceAsync(Fn<void()> callback) {
+ 						};
+ 
+ 						const auto errorName =
+-							Gio::DBus::ErrorUtils::get_remote_error(e);
++							Gio::DBus::ErrorUtils::get_remote_error(e).raw();
+ 
+ 						if (!ranges::contains(NotSupportedErrors, errorName)) {
+ 							throw e;
+@@ -151,6 +156,11 @@ bool GetServiceRegistered() {
+ 	try {
+ 		const auto connection = Gio::DBus::Connection::get_sync(
+ 			Gio::DBus::BusType::SESSION);
++		const auto GlibNames =
++			base::Platform::DBus::ListActivatableNames(connection);
++		const std::vector<std::string> StringNames(
++			GlibNames.begin(), GlibNames.end()
++		);
+ 
+ 		const auto hasOwner = [&] {
+ 			try {
+@@ -165,8 +175,8 @@ bool GetServiceRegistered() {
+ 		static const auto activatable = [&] {
+ 			try {
+ 				return ranges::contains(
+-					DBus::ListActivatableNames(connection),
+-					Glib::ustring(std::string(kService)));
++					StringNames,
++					std::string(kService));
+ 			} catch (...) {
+ 				return false;
+ 			}
diff --git a/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_platform_linux_specific__linux.cpp b/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_platform_linux_specific__linux.cpp
new file mode 100644
index 000000000000..364d86fdf5f7
--- /dev/null
+++ b/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_platform_linux_specific__linux.cpp
@@ -0,0 +1,39 @@
+--- Telegram/SourceFiles/platform/linux/specific_linux.cpp.orig	2022-12-07 09:41:04 UTC
++++ Telegram/SourceFiles/platform/linux/specific_linux.cpp
+@@ -244,12 +244,16 @@ void LaunchGApplication() {
+ 	const auto activatableNames = [&] {
+ 		try {
+ 			if (connection) {
+-				return ListActivatableNames(connection);
++				const auto GlibNames =
++				    ListActivatableNames(connection);
++				return std::vector<std::string>(
++				    GlibNames.begin(), GlibNames.end()
++				);
+ 			}
+ 		} catch (...) {
+ 		}
+ 
+-		return std::vector<Glib::ustring>();
++		return std::vector<std::string>();
+ 	}();
+ 
+ 	const auto freedesktopNotifications = [&] {
+@@ -356,7 +360,7 @@ void LaunchGApplication() {
+ 
+ 			using Window::Notifications::Manager;
+ 			using NotificationId = Manager::NotificationId;
+-			using NotificationIdTuple = std::result_of<
++			using NotificationIdTuple = ranges::result_of<
+ 				decltype(&NotificationId::toTuple)(NotificationId*)
+ 			>::type;
+ 
+@@ -731,7 +735,7 @@ void start() {
+ 					md5Hash.data());
+ 			}
+ 
+-			return u"org.telegram.desktop._%1.desktop"_q.arg(md5Hash);
++			return u"org.telegram.desktop._%1.desktop"_q.arg(md5Hash.constData());
+ 		}
+ 
+ 		return u"org.telegram.desktop.desktop"_q;
diff --git a/net-im/telegram-desktop/files/patch-Telegram_lib__base_base_platform_linux_base__last__input__linux.cpp b/net-im/telegram-desktop/files/patch-Telegram_lib__base_base_platform_linux_base__last__input__linux.cpp
new file mode 100644
index 000000000000..82f5a0b7acf8
--- /dev/null
+++ b/net-im/telegram-desktop/files/patch-Telegram_lib__base_base_platform_linux_base__last__input__linux.cpp
@@ -0,0 +1,21 @@
+--- Telegram/lib_base/base/platform/linux/base_last_input_linux.cpp.orig	2022-12-07 06:59:17 UTC
++++ Telegram/lib_base/base/platform/linux/base_last_input_linux.cpp
+@@ -103,7 +103,7 @@ std::optional<crl::time> FreedesktopDBusLastUserInputT
+ 			"org.freedesktop.DBus.Error.AccessDenied",
+ 		};
+ 
+-		const auto errorName = Gio::DBus::ErrorUtils::get_remote_error(e);
++		const auto errorName = Gio::DBus::ErrorUtils::get_remote_error(e).raw();
+ 		if (ranges::contains(NotSupportedErrors, errorName)) {
+ 			NotSupported = true;
+ 			return std::nullopt;
+@@ -163,7 +163,7 @@ std::optional<crl::time> MutterDBusLastUserInputTime()
+ 			"org.freedesktop.DBus.Error.AccessDenied",
+ 		};
+ 
+-		const auto errorName = Gio::DBus::ErrorUtils::get_remote_error(e);
++		const auto errorName = Gio::DBus::ErrorUtils::get_remote_error(e).raw();
+ 		if (ranges::contains(NotSupportedErrors, errorName)) {
+ 			NotSupported = true;
+ 			return std::nullopt;
+
diff --git a/net-im/telegram-desktop/pkg-plist b/net-im/telegram-desktop/pkg-plist
index 9f9a17a5ff0e..106d6671dbba 100644
--- a/net-im/telegram-desktop/pkg-plist
+++ b/net-im/telegram-desktop/pkg-plist
@@ -1,5 +1,5 @@
 bin/telegram-desktop
-share/applications/telegramdesktop.desktop
+share/applications/org.telegram.desktop.desktop
 share/icons/hicolor/128x128/apps/telegram.png
 share/icons/hicolor/16x16/apps/telegram.png
 share/icons/hicolor/256x256/apps/telegram.png
@@ -7,4 +7,4 @@ share/icons/hicolor/32x32/apps/telegram.png
 share/icons/hicolor/48x48/apps/telegram.png
 share/icons/hicolor/512x512/apps/telegram.png
 share/icons/hicolor/64x64/apps/telegram.png
-share/metainfo/telegramdesktop.metainfo.xml
+share/metainfo/org.telegram.desktop.metainfo.xml