From f0d6ec736618a4f3bb3f5d1edb244132052f9077 Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> Date: Wed, 15 Apr 2026 13:21:10 +1000 Subject: [PATCH] Telegram: add recipe for 6.7.5 version --- .../patches/telegram_desktop-6.7.5.patchset | 1370 +++++++++++++++++ .../telegram_desktop-6.7.5.recipe | 252 +++ 2 files changed, 1622 insertions(+) create mode 100644 net-im/telegram-desktop/patches/telegram_desktop-6.7.5.patchset create mode 100644 net-im/telegram-desktop/telegram_desktop-6.7.5.recipe diff --git a/net-im/telegram-desktop/patches/telegram_desktop-6.7.5.patchset b/net-im/telegram-desktop/patches/telegram_desktop-6.7.5.patchset new file mode 100644 index 000000000..81566988b --- /dev/null +++ b/net-im/telegram-desktop/patches/telegram_desktop-6.7.5.patchset @@ -0,0 +1,1370 @@ +From 62f5fea4121250951bcd637c8bce341318979261 Mon Sep 17 00:00:00 2001 +From: Gerasim Troeglazov <3dEyes@gmail.com> +Date: Mon, 13 Apr 2026 13:35:20 +1000 +Subject: Add haiku support + + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e762a3c..c14f24a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -16,12 +16,12 @@ if (NOT DEFINED CMAKE_CONFIGURATION_TYPES) + set(configuration_types_init 1) + endif() + +-project(Telegram +- LANGUAGES C CXX +- VERSION ${desktop_app_version_cmake} +- DESCRIPTION "Official Telegram Desktop messenger" +- HOMEPAGE_URL "https://desktop.telegram.org" +-) ++#project(Telegram ++# LANGUAGES C CXX ++# VERSION ${desktop_app_version_cmake} ++# DESCRIPTION "Official Telegram Desktop messenger" ++# HOMEPAGE_URL "https://desktop.telegram.org" ++#) + + if (APPLE) + enable_language(OBJC OBJCXX) +diff --git a/SendToAddon/Makefile b/SendToAddon/Makefile +new file mode 100644 +index 0000000..5098366 +--- /dev/null ++++ b/SendToAddon/Makefile +@@ -0,0 +1,12 @@ ++NAME = Send\ to\ Telegram ++TYPE = SHARED ++APP_MIME_SIG = application/x-vnd.Telegram-SendTo ++SRCS = SendToTelegram.cpp ++LIBS = be ++OPTIMIZE := FULL ++WARNINGS = NONE ++RDEFS = resource.rdef ++ ++DEVEL_DIRECTORY := \ ++ $(shell findpaths -r "makefile_engine" B_FIND_PATH_DEVELOP_DIRECTORY) ++include $(DEVEL_DIRECTORY)/etc/makefile-engine +diff --git a/SendToAddon/SendToTelegram.cpp b/SendToAddon/SendToTelegram.cpp +new file mode 100644 +index 0000000..c68a21d +--- /dev/null ++++ b/SendToAddon/SendToTelegram.cpp +@@ -0,0 +1,44 @@ ++#include ++ ++#include ++#include ++#include ++ ++#include ++ ++const char* kTelegramSignature = "application/x-vnd.Telegram"; ++ ++void ++process_refs(entry_ref base_ref, BMessage* message, void* reserved) ++{ ++ char **argv = new char*[ARG_MAX]; ++ ++ int argc = 0; ++ argv[argc++] = strdup("-sendpath"); ++ argv[argc] = NULL; ++ ++ BEntry entry; ++ entry_ref ref; ++ ++ int32 i; ++ ++ for (i = 0; message->FindRef("refs", i, &ref) == B_OK; i++) { ++ if (entry.SetTo(&ref, true) != B_OK) ++ continue; ++ if (entry.IsDirectory()) ++ continue; ++ ++ BPath path; ++ entry.GetPath(&path); ++ argv[argc++] = strdup(path.Path()); ++ argv[argc] = NULL; ++ } ++ ++ if (argc > 1) ++ be_roster->Launch(kTelegramSignature, argc, argv); ++ ++ for(i = 0; argv[i] != NULL; i++) ++ free(argv[i]); ++ ++ delete[] argv; ++} +diff --git a/SendToAddon/resource.rdef b/SendToAddon/resource.rdef +new file mode 100644 +index 0000000..e5f8b64 +--- /dev/null ++++ b/SendToAddon/resource.rdef +@@ -0,0 +1,36 @@ ++resource app_signature "application/x-vnd.Telegram-SendTo"; ++ ++resource app_version { ++ major = 1, ++ middle = 0, ++ minor = 0, ++ variety = 0, ++ internal = 1, ++ ++ short_info = "Send to Telegram", ++ long_info = "Send selected files to Telegram" ++}; ++ ++resource file_types message { ++ "types" = "application/octet-stream" ++}; ++ ++resource vector_icon { ++ $"6E6369660604005A0500020106023F2D01ABB6552BBE233F33AF499EC5487829" ++ $"0092B8EBFF1E5AA005F102000602BA6C443B6D6F3A833D398D6D4BD8904DC08F" ++ $"00888A85FFB0B2AE05C4070207375FB843CE80445764584E54CF55C9897460D3" ++ $"F9CA8775646E6873666B69656B6A6A5F6E3E773F773C77406FC039D28E346D02" ++ $"04B454C190B454C991B454B98FC2D2B312BAD1B312CAD3B312D150C190D150B9" ++ $"8FD150C991C2D2D00ECAD3D00EBAD1D00E0A08BD13B904D0EEBB14BF76C965BC" ++ $"40C6D5B582CA40B954C275BCD4C187BAF4BE820A03BB01BE6FD12FBB02BD2EB9" ++ $"250A03BBFEC63ABF76C93BD09BBB160A03D0C0BB40B971C27CB5A4CA110A03BA" ++ $"F4BE68BCDFC17AD0D9BB1D090A000100023EE9780000000000003EA3FE41B2B1" ++ $"4532B50A010101023F28320000000000003F1EC9C24BDB36864D0A020101023E" ++ $"EFE40000000000003EE67BB99B69420C9F0A030102023F5FC20000000000003F" ++ $"3403C2809BBB8D630A010102123F5FC20000000000003F3403C2809BBB8D6301" ++ $"178522040A030103023F5FC20000000000003F3403C2809BBB8D630A04010402" ++ $"3F5FC20000000000003F3403C2809BBB8D630A030105023F5FC2000000000000" ++ $"3F3403C2809BBB8D630A050106023F5FC20000000000003F3403C2809BBB8D63" ++}; ++ ++resource("BEOS:default_shortcut") "S"; +diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt +index a737da8..ded9862 100644 +--- a/Telegram/CMakeLists.txt ++++ b/Telegram/CMakeLists.txt +@@ -101,6 +101,15 @@ if (NOT DESKTOP_APP_DISABLE_SWIFT6) + telegram_add_apple_swift_runtime(Telegram) + endif() + ++if (HAIKU) ++ target_link_libraries(Telegram ++ PRIVATE ++ be ++ jpeg ++ translation ++ ) ++endif() ++ + target_precompile_headers(Telegram PRIVATE $<$:${src_loc}/stdafx.h>) + nice_target_sources(Telegram ${src_loc} + PRIVATE +@@ -1908,6 +1917,16 @@ if (NOT build_winstore) + ) + endif() + ++if (HAIKU) ++ remove_target_sources(Telegram ${src_loc} ++ platform/linux/notifications_manager_linux.cpp ++ ) ++ nice_target_sources(Telegram ${src_loc} ++ PRIVATE ++ platform/linux/notifications_manager_haiku.cpp ++ ) ++endif() ++ + if (DESKTOP_APP_USE_PACKAGED) + remove_target_sources(Telegram ${src_loc} + platform/mac/mac_iconv_helper.c +diff --git a/Telegram/SourceFiles/calls/group/calls_group_menu.cpp b/Telegram/SourceFiles/calls/group/calls_group_menu.cpp +index 354e9c0..9073d98 100644 +--- a/Telegram/SourceFiles/calls/group/calls_group_menu.cpp ++++ b/Telegram/SourceFiles/calls/group/calls_group_menu.cpp +@@ -580,6 +580,7 @@ void FillMenu( + real->recordStartDateValue(), + handler)); + } ++#ifndef Q_OS_HAIKU + if (addScreenCast) { + const auto sharing = call->isSharingScreen(); + const auto toggle = [=] { +@@ -597,6 +598,7 @@ void FillMenu( + : tr::lng_group_call_screen_share_start(tr::now)), + toggle); + } ++#endif + menu->addAction(tr::lng_group_call_settings(tr::now), [=] { + if (const auto strong = weak.get()) { + showBox(Box(SettingsBox, strong)); +diff --git a/Telegram/SourceFiles/core/core_settings.h b/Telegram/SourceFiles/core/core_settings.h +index 26da92f..ddfc116 100644 +--- a/Telegram/SourceFiles/core/core_settings.h ++++ b/Telegram/SourceFiles/core/core_settings.h +@@ -1140,7 +1140,7 @@ private: + rpl::variable _dialogsNoChatWidthRatio; // per-window + rpl::variable _thirdColumnWidth = kDefaultThirdColumnWidth; // p-w + bool _notifyFromAll = true; +- rpl::variable _nativeWindowFrame = false; ++ rpl::variable _nativeWindowFrame = true; + rpl::variable> _systemDarkMode = std::nullopt; + rpl::variable _systemDarkModeEnabled = true; + bool _systemAccentColorEnabled = false; +diff --git a/Telegram/SourceFiles/core/sandbox.cpp b/Telegram/SourceFiles/core/sandbox.cpp +index 81ea4e4..a2dabb2 100644 +--- a/Telegram/SourceFiles/core/sandbox.cpp ++++ b/Telegram/SourceFiles/core/sandbox.cpp +@@ -203,7 +203,7 @@ void Sandbox::setupScreenScale() { + + const auto screen = Sandbox::primaryScreen(); + const auto dpi = screen->logicalDotsPerInch(); +- const auto basePair = screen->handle()->logicalBaseDpi(); ++ const auto basePair = screen->handle()->logicalDpi(); // TODO: requires a fix at the QPA level + const auto base = (basePair.first + basePair.second) * 0.5; + const auto screenScaleExact = dpi / base; + const auto screenScale = int(base::SafeRound(screenScaleExact * 20)) * 5; +@@ -229,9 +229,12 @@ bool Sandbox::event(QEvent *e) { + if (Quitting()) { + return QCoreApplication::event(e); + } +- Quit(QuitReason::QtQuitEvent); +- e->ignore(); +- return false; ++ if (IsAppLaunched() && App().preventsQuit(QuitReason::QtQuitEvent)) { ++ e->ignore(); ++ return false; ++ } else { ++ Quit(QuitReason::QtQuitEvent); ++ } + } else if (e->type() == QEvent::Close) { + Quit(); + } else if (e->type() == DeadlockDetector::PingPongEvent::Type()) { +@@ -245,7 +248,7 @@ bool Sandbox::event(QEvent *e) { + void Sandbox::socketConnected() { + LOG(("Socket connected, this is not the first application instance, sending show command...")); + _secondInstance = true; +- ++ + QString commands; + if (qEnvironmentVariableIsSet("XDG_ACTIVATION_TOKEN")) { + commands += u"XDG_ACTIVATION_TOKEN:"_q + qgetenv("XDG_ACTIVATION_TOKEN").toBase64() + ';'; +diff --git a/Telegram/SourceFiles/iv/iv_controller.cpp b/Telegram/SourceFiles/iv/iv_controller.cpp +index 87ab701..1cfc888 100644 +--- a/Telegram/SourceFiles/iv/iv_controller.cpp ++++ b/Telegram/SourceFiles/iv/iv_controller.cpp +@@ -50,7 +50,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL + #include + #include + +-#include ++#include "ada.cpp" ++#include "ada.h" + + namespace Iv { + namespace { +diff --git a/Telegram/SourceFiles/platform/linux/current_geo_location_linux.cpp b/Telegram/SourceFiles/platform/linux/current_geo_location_linux.cpp +index fe26b13..c18d9b0 100644 +--- a/Telegram/SourceFiles/platform/linux/current_geo_location_linux.cpp ++++ b/Telegram/SourceFiles/platform/linux/current_geo_location_linux.cpp +@@ -12,6 +12,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL + + #include + ++#ifdef __HAIKU__ ++#define RTLD_NODELETE 0 ++#endif ++ + namespace Platform { + namespace { + +diff --git a/Telegram/SourceFiles/platform/linux/file_utilities_linux.cpp b/Telegram/SourceFiles/platform/linux/file_utilities_linux.cpp +index f314fb0..331db8a 100644 +--- a/Telegram/SourceFiles/platform/linux/file_utilities_linux.cpp ++++ b/Telegram/SourceFiles/platform/linux/file_utilities_linux.cpp +@@ -16,6 +16,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL + #include + #include + ++#ifdef Q_OS_HAIKU ++#include ++#include ++#include ++#include ++#include ++#include ++#endif ++ + namespace Platform { + namespace File { + namespace { +@@ -26,6 +35,22 @@ using base::Platform::XdgActivationToken; + } // namespace + + bool UnsafeShowOpenWith(const QString &filepath) { ++#ifdef Q_OS_HAIKU ++ BMessenger trackerMessenger("application/x-vnd.Be-TRAK"); ++ if (trackerMessenger.IsValid()) { ++ update_mime_info(filepath.toUtf8().data(), false, true, false); ++ ++ BEntry fileEntry(filepath.toUtf8().data()); ++ entry_ref fileRef; ++ if (fileEntry.GetRef(&fileRef) == B_OK) { ++ BMessage openCommand(B_REFS_RECEIVED); ++ openCommand.AddRef("refs", &fileRef); ++ openCommand.AddInt32("launchUsingSelector", 0); ++ if (trackerMessenger.SendMessage(&openCommand) == B_OK) ++ return true; ++ } ++ } ++#else + auto proxy = XdpOpenURI::OpenURIProxy::new_for_bus_sync( + Gio::BusType::SESSION_, + Gio::DBusProxyFlags::NONE_, +@@ -118,7 +143,7 @@ bool UnsafeShowOpenWith(const QString &filepath) { + window.setWindowModality(Qt::ApplicationModal); + window.show(); + loop.run(); +- ++#endif + return true; + } + +diff --git a/Telegram/SourceFiles/platform/linux/integration_linux.cpp b/Telegram/SourceFiles/platform/linux/integration_linux.cpp +index f5d9473..0c83cdd 100644 +--- a/Telegram/SourceFiles/platform/linux/integration_linux.cpp ++++ b/Telegram/SourceFiles/platform/linux/integration_linux.cpp +@@ -20,8 +20,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL + + #include + ++#ifndef Q_OS_HAIKU + #include + #include ++#endif + + #ifdef __GLIBC__ + #include +@@ -29,7 +31,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL + + namespace Platform { + namespace { +- ++#ifdef Q_OS_HAIKU ++class LinuxIntegration final : public Integration { ++}; ++#else + using namespace gi::repository; + namespace GObject = gi::repository::GObject; + +@@ -258,7 +263,7 @@ void LinuxIntegration::initInhibit() { + }), + nullptr); + } +- ++#endif + } // namespace + + std::unique_ptr CreateIntegration() { +diff --git a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp +index 3bee37b..f595170 100644 +--- a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp ++++ b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp +@@ -35,6 +35,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL + #include "base/platform/linux/base_linux_xcb_utilities.h" + #endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION + ++#ifdef Q_OS_HAIKU ++#include ++#endif ++ + #include + #include + #include +@@ -149,6 +153,12 @@ void MainWindow::workmodeUpdated(Core::Settings::WorkMode mode) { + SkipTaskbar(windowHandle(), mode == WorkMode::TrayOnly); + } + ++#ifdef Q_OS_HAIKU ++bool MainWindow::isActiveForTrayMenu() { ++ return isVisible(); ++} ++#endif ++ + void MainWindow::unreadCounterChangedHook() { + updateUnityCounter(); + } +diff --git a/Telegram/SourceFiles/platform/linux/main_window_linux.h b/Telegram/SourceFiles/platform/linux/main_window_linux.h +index 4a5ba8f..4eb0dbe 100644 +--- a/Telegram/SourceFiles/platform/linux/main_window_linux.h ++++ b/Telegram/SourceFiles/platform/linux/main_window_linux.h +@@ -21,6 +21,9 @@ namespace Platform { + class MainWindow : public Window::MainWindow { + public: + explicit MainWindow(not_null controller); ++#ifdef Q_OS_HAIKU ++ bool isActiveForTrayMenu() override; ++#endif + ~MainWindow(); + + void updateWindowIcon() override; +diff --git a/Telegram/SourceFiles/platform/linux/notifications_manager_haiku.cpp b/Telegram/SourceFiles/platform/linux/notifications_manager_haiku.cpp +new file mode 100644 +index 0000000..055b95d +--- /dev/null ++++ b/Telegram/SourceFiles/platform/linux/notifications_manager_haiku.cpp +@@ -0,0 +1,279 @@ ++/* ++This file is part of Telegram Desktop for Haiku, ++ ++For license and copyright information please follow this link: ++https://github.com/desktop-app/legal/blob/master/LEGAL ++ ++Copyright (c) 2018-2021 Gerasim Troeglazov, 3dEyes@gmail.com ++*/ ++ ++ ++#include ++#include ++#include ++#include ++ ++#include "platform/linux/notifications_manager_linux.h" ++ ++#include "base/options.h" ++#include "base/platform/base_platform_info.h" ++#include "core/application.h" ++#include "core/sandbox.h" ++#include "core/core_settings.h" ++#include "data/data_forum_topic.h" ++#include "history/history.h" ++#include "history/history_item.h" ++#include "ui/empty_userpic.h" ++#include "main/main_session.h" ++#include "lang/lang_keys.h" ++#include "base/weak_ptr.h" ++#include "window/notifications_utilities.h" ++#include "styles/style_window.h" ++ ++#define USE_HAIKU_UINT64 ++#include "base/haiku_types.h" ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define NOTIFY_MESSAGE_DEEP 16 ++#define NOTIFY_PORT_NAME "tg_notify" ++#define NOTIFY_GATE_NAME "/bin/qnotify" ++#define NOTIFY_MESSAGE 'QNTF' ++ ++#include ++#include ++#include ++#include ++ ++namespace Platform { ++namespace Notifications { ++ ++bool Supported() { ++ return true; ++} ++ ++void Finish() { ++} ++ ++bool SkipAudio() { ++ return false; ++} ++ ++bool SkipToast() { ++ return false; ++} ++ ++bool SkipFlashBounce() { ++ return false; ++} ++ ++bool SkipAudioForCustom() { ++ return false; ++} ++ ++bool SkipToastForCustom() { ++ return false; ++} ++ ++bool SkipFlashBounceForCustom() { ++ return false; ++} ++ ++bool Enforced() { ++ return false; ++} ++ ++bool ByDefault() { ++ return true; ++} ++ ++bool WaitForInputForCustom() { ++ return false; ++} ++ ++void MaybePlaySoundForCustom(Fn playSound) { ++ playSound(); ++} ++ ++void MaybeFlashBounceForCustom(Fn flashBounce) { ++ flashBounce(); ++} ++ ++bool VolumeSupported() { ++ return false; ++} ++ ++void Create(Window::Notifications::System *system) { ++ if (Core::App().settings().nativeNotifications() && Supported()) { ++ system->setManager([=] { ++ auto manager = std::make_unique(system); ++ return manager; ++ }); ++ return; ++ } ++ system->setManager(nullptr); ++} ++ ++class Manager::Private : public QObject { ++ ++public: ++ explicit Private(not_null manager); ++ ++ void showNotification( ++ NotificationInfo &&info, ++ Ui::PeerUserpicView &userpicView); ++ ++ ~Private(); ++ ++private: ++ void CheckNotificationAction(); ++ ++ QTimer *_checkNotificationTimer; ++ const not_null _manager; ++ int32 _portId; ++}; ++ ++Manager::Private::Private(not_null manager) ++: _manager(manager) { ++ _portId = create_port(NOTIFY_MESSAGE_DEEP, NOTIFY_PORT_NAME); ++ _checkNotificationTimer = new QTimer(this); ++ connect(_checkNotificationTimer, &QTimer::timeout, this, &Manager::Private::CheckNotificationAction); ++ _checkNotificationTimer->start(250); ++} ++ ++Manager::Private::~Private() { ++ delete _checkNotificationTimer; ++ if (_portId > 0) ++ delete_port(_portId); ++} ++ ++void Manager::Private::CheckNotificationAction() ++{ ++ ssize_t msgSize; ++ ++ do { ++ msgSize = port_buffer_size_etc(_portId, B_RELATIVE_TIMEOUT, 0); ++ } while (msgSize == B_INTERRUPTED); ++ ++ if (msgSize < 0) ++ return; ++ ++ char* buffer = new(std::nothrow) char[msgSize]; ++ if (!buffer) ++ return; ++ ++ int32 code; ++ status_t result; ++ do { ++ result = read_port(_portId, &code, buffer, msgSize); ++ } while (result == B_INTERRUPTED); ++ ++ BMessage message; ++ ++ if (result < 0 || code != NOTIFY_MESSAGE) { ++ delete[] buffer; ++ return; ++ } ++ ++ if (message.Unflatten(buffer) == B_OK) { ++ uint64 sessionId = message.GetUInt64("session", 0); ++ uint64 peerId = message.GetUInt64("peer", 0); ++ int64 messageId = message.GetInt64("message", 0); ++ ++ const auto key = ContextId{ ++ .sessionId = sessionId, ++ .peerId = PeerId(peerId), ++ .topicRootId = 0, ++ }; ++ const auto notificationId = NotificationId{ .contextId = key, .msgId = messageId }; ++ ++ crl::on_main(this, [=] { ++ _manager->notificationActivated(notificationId); ++ }); ++ } ++ delete[] buffer; ++} ++ ++void Manager::Private::showNotification( ++ NotificationInfo &&info, ++ Ui::PeerUserpicView &userpicView) { ++ const auto peer = info.peer; ++ const auto options = info.options; ++ const auto titleText = info.title; ++ const auto subtitleText = info.subtitle; ++ const auto msgText = info.message; ++ const auto msgId = info.itemId; ++ ++ QString args = QString( ++ "mode:port " ++ "target:tg_notify " ++ "session:uint64:%1 " ++ "peer:uint64:%2 " ++ "message:int64:%3") ++ .arg(peer->session().uniqueId()).arg(peer->id.value).arg(msgId.bare); ++ ++ BNotification notify(B_INFORMATION_NOTIFICATION); ++ notify.SetGroup("Telegram"); ++ notify.SetTitle(titleText.toUtf8().data()); ++ notify.SetContent(msgText.toUtf8().data()); ++ entry_ref ref; ++ BEntry entry(NOTIFY_GATE_NAME); ++ entry.GetRef(&ref); ++ notify.SetOnClickFile(&ref); ++ notify.AddOnClickArg(BString(args.toUtf8().data())); ++ ++ if (!options.hideNameAndPhoto) { ++ QImage userpic = Window::Notifications::GenerateUserpic(peer, userpicView); ++ BBitmap *icon = new BBitmap(BRect(0, 0, userpic.width() - 1, userpic.height() - 1), B_RGBA32); ++ icon->SetBits((void*)userpic.bits(), userpic.sizeInBytes(), 0, B_RGBA32); ++ notify.SetIcon(icon); ++ delete icon; ++ } ++ ++ notify.Send(); ++} ++ ++Manager::Manager(not_null system) ++: NativeManager(system) ++, _private(std::make_unique(this)) { ++} ++ ++Manager::~Manager() = default; ++ ++void Manager::doShowNativeNotification( ++ NotificationInfo &&info, ++ Ui::PeerUserpicView &userpicView) { ++ _private->showNotification(std::move(info), userpicView); ++} ++ ++void Manager::doClearAllFast() { } ++ ++void Manager::doClearFromItem(not_null item) { } ++ ++void Manager::doClearFromHistory(not_null history) { } ++ ++void Manager::doClearFromSession(not_null session) { } ++ ++void Manager::doClearFromTopic(not_null topic) { } ++ ++void Manager::doClearFromSublist(not_null sublist) { } ++ ++bool Manager::doSkipToast() const { ++ return false; ++} ++ ++void Manager::doMaybePlaySound(Fn playSound) { ++ playSound(); ++} ++ ++void Manager::doMaybeFlashBounce(Fn flashBounce) { ++ flashBounce(); ++} ++ ++} // namespace Notifications ++} // namespace Platform +diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.cpp b/Telegram/SourceFiles/platform/linux/specific_linux.cpp +index cc9e032..70223aa 100644 +--- a/Telegram/SourceFiles/platform/linux/specific_linux.cpp ++++ b/Telegram/SourceFiles/platform/linux/specific_linux.cpp +@@ -26,6 +26,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL + #include "base/platform/linux/base_linux_xcb_utilities.h" + #endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION + ++#ifdef Q_OS_HAIKU ++#include ++#endif ++ + #include + #include + #include +@@ -49,6 +53,33 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL + #include + + namespace { ++ ++#ifdef Q_OS_HAIKU ++void HaikuAutostart(bool start) { ++ const auto home = QDir::homePath(); ++ if (home.isEmpty()) { ++ return; ++ } ++ ++ QFile file(home + "/config/settings/boot/launch/telegram-desktop"); ++ if (start) { ++ if (file.open(QIODevice::WriteOnly | QIODevice::Text)) { ++ QTextStream out(&file); ++ out ++ << "#!/bin/bash" << Qt::endl ++ << "cd /system/apps" << Qt::endl ++ << "./Telegram -autostart" << " &" << Qt::endl; ++ file.close(); ++ file.setPermissions(file.permissions() ++ | QFileDevice::ExeOwner ++ | QFileDevice::ExeGroup ++ | QFileDevice::ExeOther); ++ } ++ } else { ++ file.remove(); ++ } ++} ++#endif // Q_OS_HAIKU + + using namespace gi::repository; + namespace GObject = gi::repository::GObject; +@@ -445,7 +476,7 @@ bool GenerateServiceFile(bool silent = false) { + targetPath, + md5Hash)); + } +- ++#ifndef Q_OS_HAIKU + XdgDBus::DBusProxy::new_for_bus( + Gio::BusType::SESSION_, + Gio::DBusProxyFlags::NONE_, +@@ -461,7 +492,7 @@ bool GenerateServiceFile(bool silent = false) { + + interface.call_reload_config(nullptr); + }); +- ++#endif + return true; + } + +@@ -620,6 +651,10 @@ bool AutostartSupported() { + } + + void AutostartToggle(bool enabled, Fn done) { ++#ifdef Q_OS_HAIKU ++ HaikuAutostart(enabled); ++ return; ++#else + if (KSandbox::isFlatpak()) { + PortalAutostart(enabled, done); + return; +@@ -647,6 +682,7 @@ void AutostartToggle(bool enabled, Fn done) { + if (done) { + done(enabled && success); + } ++#endif + } + + bool AutostartSkip() { +@@ -699,7 +735,11 @@ QString psAppDataPath() { + } + } + ++#ifdef Q_OS_HAIKU ++ return QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + '/'; ++#else + return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + '/'; ++#endif + } + + void psDoCleanup() { +@@ -796,6 +836,7 @@ bool OpenSystemSettings(SystemSettingsType type) { + } + options.push_back(std::move(command)); + }; ++ add("Media"); + add("unity-control-center", "sound"); + add("kcmshell6", "kcm_pulseaudio"); + add("kcmshell5", "kcm_pulseaudio"); +@@ -805,7 +846,7 @@ bool OpenSystemSettings(SystemSettingsType type) { + add("mate-volume-control"); + add("pavucontrol-qt"); + add("pavucontrol"); +- add("alsamixergui"); ++ add("alsamixergui"); + return ranges::any_of(options, [](const Command &command) { + return QProcess::startDetached( + command.command, +diff --git a/Telegram/SourceFiles/platform/linux/tray_linux.cpp b/Telegram/SourceFiles/platform/linux/tray_linux.cpp +index d386316..90a9cb4 100644 +--- a/Telegram/SourceFiles/platform/linux/tray_linux.cpp ++++ b/Telegram/SourceFiles/platform/linux/tray_linux.cpp +@@ -256,6 +256,7 @@ rpl::producer<> TrayEventFilter::contextMenuFilters() const { + } + + Tray::Tray() { ++#ifndef Q_OS_HAIKU + auto connection = Gio::bus_get_sync(Gio::BusType::SESSION_, nullptr); + if (connection) { + _sniWatcher = std::make_unique( +@@ -273,6 +274,7 @@ Tray::Tray() { + }); + }); + } ++#endif + } + + void Tray::createIcon() { +@@ -341,10 +343,12 @@ void Tray::createMenu() { + if (!_menu) { + _menu = base::make_unique_q(nullptr); + } ++#ifndef Q_OS_HAIKU + if (!_menuCustom) { + _menuCustom = base::make_unique_q(nullptr); + _menuCustom->deleteOnHide(false); + } ++#endif + } + + void Tray::destroyMenu() { +diff --git a/Telegram/SourceFiles/platform/linux/tray_linux.h b/Telegram/SourceFiles/platform/linux/tray_linux.h +index 181de22..a897c02 100644 +--- a/Telegram/SourceFiles/platform/linux/tray_linux.h ++++ b/Telegram/SourceFiles/platform/linux/tray_linux.h +@@ -55,7 +55,9 @@ public: + [[nodiscard]] rpl::lifetime &lifetime(); + + private: ++#ifndef Q_OS_HAIKU + std::unique_ptr _sniWatcher; ++#endif + std::unique_ptr _iconGraphic; + + base::unique_qptr _icon; +diff --git a/Telegram/ThirdParty/tgcalls/tgcalls/MediaManager.cpp b/Telegram/ThirdParty/tgcalls/tgcalls/MediaManager.cpp +index 9ee2939..8c75330 100644 +--- a/Telegram/ThirdParty/tgcalls/tgcalls/MediaManager.cpp ++++ b/Telegram/ThirdParty/tgcalls/tgcalls/MediaManager.cpp +@@ -1073,7 +1073,7 @@ void MediaManager::fillCallStats(CallStats &callStats) { + } + + void MediaManager::setAudioInputDevice(std::string id) { +-#if defined(WEBRTC_IOS) ++#if defined(WEBRTC_IOS) || defined(__HAIKU__) + #else + SetAudioInputDeviceById(_audioDeviceModule.get(), id); + #endif +diff --git a/Telegram/ThirdParty/tgcalls/tgcalls/group/GroupInstanceCustomImpl.cpp b/Telegram/ThirdParty/tgcalls/tgcalls/group/GroupInstanceCustomImpl.cpp +index 17bfa52..e581b70 100644 +--- a/Telegram/ThirdParty/tgcalls/tgcalls/group/GroupInstanceCustomImpl.cpp ++++ b/Telegram/ThirdParty/tgcalls/tgcalls/group/GroupInstanceCustomImpl.cpp +@@ -3810,7 +3810,7 @@ public: + } + + void setAudioOutputDevice(const std::string &id) { +-#ifndef WEBRTC_IOS ++#if !defined(WEBRTC_IOS) && !defined(__HAIKU__) + _threads->getWorkerThread()->BlockingCall([&] { + SetAudioOutputDeviceById(_audioDeviceModule.get(), id); + }); +@@ -3818,7 +3818,7 @@ public: + } + + void setAudioInputDevice(const std::string &id) { +-#ifndef WEBRTC_IOS ++#if !defined(WEBRTC_IOS) && !defined(__HAIKU__) + _threads->getWorkerThread()->BlockingCall([&] { + SetAudioInputDeviceById(_audioDeviceModule.get(), id); + }); +diff --git a/Telegram/cmake/td_iv.cmake b/Telegram/cmake/td_iv.cmake +index 1d4edf9..602abf4 100644 +--- a/Telegram/cmake/td_iv.cmake ++++ b/Telegram/cmake/td_iv.cmake +@@ -38,7 +38,6 @@ PUBLIC + tdesktop::td_scheme + PRIVATE + desktop-app::lib_webview +- desktop-app::external_ada + tdesktop::td_lang + tdesktop::td_ui + ) +diff --git a/Telegram/lib_base/base/haiku_types.h b/Telegram/lib_base/base/haiku_types.h +new file mode 100644 +index 0000000..3a57ce2 +--- /dev/null ++++ b/Telegram/lib_base/base/haiku_types.h +@@ -0,0 +1,24 @@ ++#pragma once ++ ++#ifdef Q_OS_HAIKU ++ ++#define _SUPPORT_DEFS_H ++ ++#ifdef __x86_64__ ++#define int64 __haiku_int64 ++#ifdef USE_HAIKU_UINT64 ++#define uint64 __haiku_uint64 ++#endif ++#else ++#define int32 __haiku_int32 ++#define uint32 __haiku_uint32 ++#endif ++ ++typedef int32 status_t; ++typedef uint32 type_code; ++typedef uint32 perform_code; ++ ++typedef int64 bigtime_t; ++typedef int64 nanotime_t; ++ ++#endif +diff --git a/Telegram/lib_base/base/platform/linux/base_file_utilities_linux.cpp b/Telegram/lib_base/base/platform/linux/base_file_utilities_linux.cpp +index ff70a1c..b49c8c0 100644 +--- a/Telegram/lib_base/base/platform/linux/base_file_utilities_linux.cpp ++++ b/Telegram/lib_base/base/platform/linux/base_file_utilities_linux.cpp +@@ -26,8 +26,58 @@ + #include + #include + ++#ifdef Q_OS_HAIKU ++#include ++#include ++#include ++#endif ++ + namespace base::Platform { + namespace { ++ ++#ifdef Q_OS_HAIKU ++bool HaikuShowInFolder(const QString &filepath) { ++ try { ++ BMessenger trackerMessenger("application/x-vnd.Be-TRAK"); ++ if (!trackerMessenger.IsValid()) ++ return false; ++ ++ BEntry fileEntry(filepath.toUtf8().data()); ++ entry_ref fileRef; ++ if (fileEntry.GetRef(&fileRef) != B_OK) ++ return false; ++ ++ if (!fileEntry.Exists()) ++ return false; ++ ++ BEntry folderEntry; ++ if (fileEntry.GetParent(&folderEntry) != B_OK) ++ return false; ++ ++ entry_ref folderRef; ++ if (folderEntry.GetRef(&folderRef) != B_OK) ++ return false; ++ ++ BMessage openCommand(B_REFS_RECEIVED); ++ openCommand.AddRef("refs", &folderRef); ++ node_ref fileNodeRef; ++ if (fileEntry.GetNodeRef(&fileNodeRef) == B_OK) { ++ openCommand.AddData("nodeRefToSelect", B_RAW_TYPE, ++ static_cast(&fileNodeRef), sizeof(node_ref)); ++ } ++ if (trackerMessenger.SendMessage(&openCommand) == B_OK) { ++ snooze(300000); ++ BMessage selectCommand('Tsel'); ++ selectCommand.AddRef("refs", &fileRef); ++ trackerMessenger.SendMessage(&selectCommand); ++ return true; ++ } ++ } catch (...) { ++ } ++ ++ return false; ++} ++#endif + + using namespace gi::repository; + namespace GObject = gi::repository::GObject; +@@ -127,12 +177,19 @@ void DBusShowInFolder(const QString &filepath, Fn fail) { + } // namespace + + void ShowInFolder(const QString &filepath) { ++#ifdef Q_OS_HAIKU ++ if (!HaikuShowInFolder(filepath)) { ++ QDesktopServices::openUrl( ++ QUrl::fromLocalFile(QFileInfo(filepath).absolutePath())); ++ } ++#else + DBusShowInFolder(filepath, [=] { + PortalShowInFolder(filepath, [=] { + QDesktopServices::openUrl( + QUrl::fromLocalFile(QFileInfo(filepath).absolutePath())); + }); + }); ++#endif + } + + QString CurrentExecutablePath(int argc, char *argv[]) { +diff --git a/Telegram/lib_base/base/platform/linux/base_haptic_linux.cpp b/Telegram/lib_base/base/platform/linux/base_haptic_linux.cpp +index e92bf6a..7082723 100644 +--- a/Telegram/lib_base/base/platform/linux/base_haptic_linux.cpp ++++ b/Telegram/lib_base/base/platform/linux/base_haptic_linux.cpp +@@ -7,18 +7,21 @@ + #include "base/platform/linux/base_haptic_linux.h" + + #include +- ++#ifndef Q_OS_HAIKU + #include +- ++#endif + namespace base::Platform { ++#ifndef Q_OS_HAIKU + namespace { + + using namespace gi::repository; + namespace GObject = gi::repository::GObject; + + } // namespace ++#endif + + void Haptic() { ++#ifndef Q_OS_HAIKU + SigxcpuFeedback::HapticProxy::new_for_bus( + Gio::BusType::SESSION_, + Gio::DBusProxyFlags::NONE_, +@@ -44,6 +47,7 @@ void Haptic() { + }), + nullptr); + }); ++#endif + } + + bool IsSwipeBackEnabled() { +diff --git a/Telegram/lib_base/base/platform/linux/base_info_linux.cpp b/Telegram/lib_base/base/platform/linux/base_info_linux.cpp +index c703810..bfc4a44 100644 +--- a/Telegram/lib_base/base/platform/linux/base_info_linux.cpp ++++ b/Telegram/lib_base/base/platform/linux/base_info_linux.cpp +@@ -319,6 +319,7 @@ bool IsX11() { + } + + bool IsWayland() { ++#ifndef Q_OS_HAIKU + if (!qApp) { + static const auto result = []() -> bool { + struct wl_display *(*wl_display_connect)(const char *name); +@@ -338,6 +339,7 @@ bool IsWayland() { + }(); + return result; + } ++#endif + static const bool result = + #if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) + #if defined QT_FEATURE_wayland && QT_CONFIG(wayland) +diff --git a/Telegram/lib_base/base/platform/linux/base_last_input_linux.cpp b/Telegram/lib_base/base/platform/linux/base_last_input_linux.cpp +index 9a52714..9bd332a 100644 +--- a/Telegram/lib_base/base/platform/linux/base_last_input_linux.cpp ++++ b/Telegram/lib_base/base/platform/linux/base_last_input_linux.cpp +@@ -16,6 +16,11 @@ + + #include + ++#ifdef Q_OS_HAIKU ++#include ++#include ++#endif ++ + namespace base::Platform { + namespace { + +@@ -83,9 +88,23 @@ std::optional MutterDBusLastUserInputTime() { + return (crl::now() - static_cast(std::get<1>(*result))); + } + ++#ifdef Q_OS_HAIKU ++std::optional HaikuLastUserInputTime() { ++ const auto idle = idle_time() / 1000; ++ return (crl::now() - static_cast(idle)); ++} ++#endif ++ + } // namespace + + std::optional LastUserInputTime() { ++#ifdef Q_OS_HAIKU ++ const auto haikuResult = HaikuLastUserInputTime(); ++ if (haikuResult.has_value()) { ++ return haikuResult; ++ } ++#endif ++ + #ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION + const auto xcbResult = XCBLastUserInputTime(); + if (xcbResult.has_value()) { +diff --git a/Telegram/lib_base/base/platform/linux/base_linux_dbus_utilities.cpp b/Telegram/lib_base/base/platform/linux/base_linux_dbus_utilities.cpp +index 86316e9..ef0c8d5 100644 +--- a/Telegram/lib_base/base/platform/linux/base_linux_dbus_utilities.cpp ++++ b/Telegram/lib_base/base/platform/linux/base_linux_dbus_utilities.cpp +@@ -6,6 +6,8 @@ + // + #include "base/platform/linux/base_linux_dbus_utilities.h" + ++#ifndef Q_OS_HAIKU ++ + #include + + namespace base::Platform::DBus { +@@ -150,3 +152,5 @@ ServiceWatcher::ServiceWatcher( + ServiceWatcher::~ServiceWatcher() = default; + + } // namespace base::Platform::DBus ++ ++#endif +diff --git a/Telegram/lib_base/base/platform/linux/base_linux_dbus_utilities.h b/Telegram/lib_base/base/platform/linux/base_linux_dbus_utilities.h +index fc8e694..43adaa1 100644 +--- a/Telegram/lib_base/base/platform/linux/base_linux_dbus_utilities.h ++++ b/Telegram/lib_base/base/platform/linux/base_linux_dbus_utilities.h +@@ -9,6 +9,8 @@ + #include "base/expected.h" + #include "base/weak_ptr.h" + ++#ifndef Q_OS_HAIKU ++ + typedef struct _GDBusConnection GDBusConnection; + + namespace base::Platform::DBus { +@@ -59,3 +61,5 @@ private: + }; + + } // namespace base::Platform::DBus ++ ++#endif +diff --git a/Telegram/lib_base/base/platform/linux/base_linux_xdp_utilities.cpp b/Telegram/lib_base/base/platform/linux/base_linux_xdp_utilities.cpp +index 6b781fb..c0dd69f 100644 +--- a/Telegram/lib_base/base/platform/linux/base_linux_xdp_utilities.cpp ++++ b/Telegram/lib_base/base/platform/linux/base_linux_xdp_utilities.cpp +@@ -10,6 +10,10 @@ + + #include + ++#ifdef Q_OS_HAIKU ++#include ++#endif ++ + #include + #include + +diff --git a/Telegram/lib_base/base/platform/linux/base_power_save_blocker_linux.cpp b/Telegram/lib_base/base/platform/linux/base_power_save_blocker_linux.cpp +index 1f6244b..c77d3da 100644 +--- a/Telegram/lib_base/base/platform/linux/base_power_save_blocker_linux.cpp ++++ b/Telegram/lib_base/base/platform/linux/base_power_save_blocker_linux.cpp +@@ -16,6 +16,10 @@ + #include "base/platform/linux/base_linux_xcb_utilities.h" + #endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION + ++#ifdef Q_OS_HAIKU ++#include ++#endif ++ + #include + + #include +diff --git a/Telegram/lib_base/base/platform/linux/base_url_scheme_linux.cpp b/Telegram/lib_base/base/platform/linux/base_url_scheme_linux.cpp +index 8d6a984..3eefda0 100644 +--- a/Telegram/lib_base/base/platform/linux/base_url_scheme_linux.cpp ++++ b/Telegram/lib_base/base/platform/linux/base_url_scheme_linux.cpp +@@ -9,6 +9,10 @@ + #include "base/integration.h" + #include "base/debug_log.h" + ++#ifdef Q_OS_HAIKU ++#include ++#endif ++ + #include + + #include +diff --git a/Telegram/lib_spellcheck/spellcheck/third_party/language_cld3.cpp b/Telegram/lib_spellcheck/spellcheck/third_party/language_cld3.cpp +index 3a4d243..514f3a7 100644 +--- a/Telegram/lib_spellcheck/spellcheck/third_party/language_cld3.cpp ++++ b/Telegram/lib_spellcheck/spellcheck/third_party/language_cld3.cpp +@@ -4,6 +4,10 @@ + // For license and copyright information please follow this link: + // https://github.com/desktop-app/legal/blob/master/LEGAL + // ++#ifdef Q_OS_HAIKU ++#include ++#endif ++ + #include "spellcheck/third_party/language_cld3.h" + + #include +diff --git a/Telegram/lib_ui/ui/ui_utility.cpp b/Telegram/lib_ui/ui/ui_utility.cpp +index 92d40e6..5dc5708 100644 +--- a/Telegram/lib_ui/ui/ui_utility.cpp ++++ b/Telegram/lib_ui/ui/ui_utility.cpp +@@ -11,6 +11,10 @@ + #include "ui/platform/ui_platform_utility.h" + #include "ui/style/style_core.h" + ++#ifdef Q_OS_HAIKU ++#include ++#endif ++ + #include + #include + #include +diff --git a/Telegram/lib_ui/ui/widgets/popup_menu.cpp b/Telegram/lib_ui/ui/widgets/popup_menu.cpp +index 1fb9d65..7689a2b 100644 +--- a/Telegram/lib_ui/ui/widgets/popup_menu.cpp ++++ b/Telegram/lib_ui/ui/widgets/popup_menu.cpp +@@ -20,6 +20,10 @@ + #include "ui/screen_reader_mode.h" + #include "ui/ui_utility.h" + ++#ifdef Q_OS_HAIKU ++#include ++#endif ++ + #include + #include + #include +diff --git a/Telegram/lib_webrtc/webrtc/details/webrtc_openal_adm.cpp b/Telegram/lib_webrtc/webrtc/details/webrtc_openal_adm.cpp +index 4962d89..9646bd7 100644 +--- a/Telegram/lib_webrtc/webrtc/details/webrtc_openal_adm.cpp ++++ b/Telegram/lib_webrtc/webrtc/details/webrtc_openal_adm.cpp +@@ -4,6 +4,11 @@ + // For license and copyright information please follow this link: + // https://github.com/desktop-app/legal/blob/master/LEGAL + // ++ ++#ifdef Q_OS_HAIKU ++#include ++#endif ++ + #include "webrtc/details/webrtc_openal_adm.h" + + #include "base/timer.h" +diff --git a/Telegram/lib_webrtc/webrtc/webrtc_audio_input_tester.cpp b/Telegram/lib_webrtc/webrtc/webrtc_audio_input_tester.cpp +index 3b25c94..22e4b14 100644 +--- a/Telegram/lib_webrtc/webrtc/webrtc_audio_input_tester.cpp ++++ b/Telegram/lib_webrtc/webrtc/webrtc_audio_input_tester.cpp +@@ -4,6 +4,11 @@ + // For license and copyright information please follow this link: + // https://github.com/desktop-app/legal/blob/master/LEGAL + // ++ ++#ifdef Q_OS_HAIKU ++#include ++#endif ++ + #include "webrtc/webrtc_audio_input_tester.h" + + #include "webrtc/webrtc_device_common.h" +diff --git a/Telegram/lib_webview/webview/platform/linux/webview_linux_webkitgtk.cpp b/Telegram/lib_webview/webview/platform/linux/webview_linux_webkitgtk.cpp +index c0fc13e..295b378 100644 +--- a/Telegram/lib_webview/webview/platform/linux/webview_linux_webkitgtk.cpp ++++ b/Telegram/lib_webview/webview/platform/linux/webview_linux_webkitgtk.cpp +@@ -837,7 +837,7 @@ void Instance::dataRequest( + socket->write("HTTP/1.1 "); + socket->write(partial ? "206 Partial Content\r\n" : "200 OK\r\n"); + +- const auto mime = QByteArray(stream->mime()); ++ const auto mime = QByteArray(stream->mime().c_str()); + socket->write("Content-Type: " + mime + "\r\n"); + socket->write("Accept-Ranges: bytes\r\n"); + socket->write("Cache-Control: no-store\r\n"); +diff --git a/Telegram/lib_webview/webview/platform/linux/webview_linux_webkitgtk_library.cpp b/Telegram/lib_webview/webview/platform/linux/webview_linux_webkitgtk_library.cpp +index d0af014..4c38a6e 100644 +--- a/Telegram/lib_webview/webview/platform/linux/webview_linux_webkitgtk_library.cpp ++++ b/Telegram/lib_webview/webview/platform/linux/webview_linux_webkitgtk_library.cpp +@@ -8,6 +8,10 @@ + + #include "base/platform/linux/base_linux_library.h" + ++#ifdef __HAIKU__ ++#define RTLD_NODELETE 0 ++#endif ++ + namespace Webview::WebKitGTK::Library { + + ResolveResult Resolve(const Platform &platform) { +diff --git a/cmake/external/CMakeLists.txt b/cmake/external/CMakeLists.txt +index d370526..7224f6b 100644 +--- a/cmake/external/CMakeLists.txt ++++ b/cmake/external/CMakeLists.txt +@@ -11,7 +11,7 @@ macro(add_checked_subdirectory name) + endif() + endmacro() + +-add_checked_subdirectory(ada) ++#add_checked_subdirectory(ada) + add_checked_subdirectory(angle) + add_checked_subdirectory(auto_updates) + add_checked_subdirectory(boost) +@@ -19,7 +19,7 @@ if (add_cld3_library) + add_checked_subdirectory(cld3) + endif() + add_checked_subdirectory(crash_reports) +-if (LINUX) ++if (LINUX AND NOT HAIKU) + add_checked_subdirectory(dispatch) + endif() + add_checked_subdirectory(expected) +diff --git a/cmake/external/cld3/CMakeLists.txt b/cmake/external/cld3/CMakeLists.txt +index fdbc4b0..4aab9ea 100644 +--- a/cmake/external/cld3/CMakeLists.txt ++++ b/cmake/external/cld3/CMakeLists.txt +@@ -29,7 +29,10 @@ set(gen_loc ${CMAKE_CURRENT_BINARY_DIR}/gen) + set(gen_dst ${gen_loc}/cld_3/protos) + + if (DESKTOP_APP_USE_PACKAGED OR LINUX) +- find_package(protobuf REQUIRED CONFIG) ++ find_package(protobuf CONFIG) ++ if (NOT protobuf_FOUND) ++ find_package(Protobuf MODULE REQUIRED) ++ endif() + set(protoc_executable protobuf::protoc) + set(protobuf_lib protobuf::libprotobuf-lite) + elseif (WIN32) +-- +2.52.0 + + +From b78b116eddc2d498f488d61ff6a40e027dc46d05 Mon Sep 17 00:00:00 2001 +From: Gerasim Troeglazov <3dEyes@gmail.com> +Date: Wed, 15 Apr 2026 10:11:41 +1000 +Subject: Disable webview + + +diff --git a/Telegram/lib_webview/webview/platform/linux/webview_linux_webkitgtk_library.cpp b/Telegram/lib_webview/webview/platform/linux/webview_linux_webkitgtk_library.cpp +index 4c38a6e..7793829 100644 +--- a/Telegram/lib_webview/webview/platform/linux/webview_linux_webkitgtk_library.cpp ++++ b/Telegram/lib_webview/webview/platform/linux/webview_linux_webkitgtk_library.cpp +@@ -15,6 +15,9 @@ + namespace Webview::WebKitGTK::Library { + + ResolveResult Resolve(const Platform &platform) { ++#ifdef __HAIKU__ ++ return ResolveResult::NoLibrary; ++#else + const auto lib = (platform != Platform::X11 + ? base::Platform::LoadLibrary("libwebkitgtk-6.0.so.4", RTLD_NODELETE) + : nullptr) +@@ -109,6 +112,7 @@ ResolveResult Resolve(const Platform &platform) { + return gtk_init_check(0, 0) + ? ResolveResult::Success + : ResolveResult::CantInit; ++#endif + } + + } // namespace Webview::WebKitGTK::Library +-- +2.52.0 + diff --git a/net-im/telegram-desktop/telegram_desktop-6.7.5.recipe b/net-im/telegram-desktop/telegram_desktop-6.7.5.recipe new file mode 100644 index 000000000..de6e3ed49 --- /dev/null +++ b/net-im/telegram-desktop/telegram_desktop-6.7.5.recipe @@ -0,0 +1,252 @@ +SUMMARY="Telegram Desktop Messenger" +DESCRIPTION="Unofficial build of the original Telegram client for Haiku." +HOMEPAGE="https://www.telegram.org/" +COPYRIGHT="2013-2026 Telegram" +LICENSE="GNU GPL v3" +REVISION="1" +SOURCE_URI="https://github.com/telegramdesktop/tdesktop/releases/download/v$portVersion/tdesktop-$portVersion-full.tar.gz" +CHECKSUM_SHA256="b96b2cbaf72d72f801c09df2c2fc4cd36ba2354ab062ce73b19fec08608bde92" +SOURCE_FILENAME="tdesktop-$portVersion-full.tar.gz" +SOURCE_DIR="tdesktop-$portVersion-full" +SOURCE_URI_2="https://github.com/ada-url/ada/releases/download/v2.9.0/singleheader.zip" +CHECKSUM_SHA256_2="20b09948cf58362abe4de20b8e709d5041477fb798350fd1a02cde6aad121e08" +srcGitRev_3="2b383fe05f8ae78ac99470b9a2b9ea22b3ee5a92" +SOURCE_URI_3="https://salsa.debian.org/debian/telegram-desktop/-/raw/$srcGitRev_3/debian/rules#noarchive" +CHECKSUM_SHA256_3="613e7e357518739e1f7d035337f37c344b248283fd4d916ddc95df73c2ff84ad" + +PATCHES="telegram_desktop-$portVersion.patchset" + +ADDITIONAL_FILES="telegram_desktop.rdef.in" + +ARCHITECTURES="all !x86_gcc2" +SECONDARY_ARCHITECTURES="?x86" + +PROVIDES=" + telegram_desktop$secondaryArchSuffix = $portVersion + app:Telegram + " +REQUIRES=" + haiku$secondaryArchSuffix + lib:libabsl_strings$secondaryArchSuffix + lib:libatomic$secondaryArchSuffix + lib:libavcodec$secondaryArchSuffix + lib:libavformat$secondaryArchSuffix + lib:libavif$secondaryArchSuffix + lib:libavutil$secondaryArchSuffix + lib:libboost_filesystem$secondaryArchSuffix + lib:libboost_regex$secondaryArchSuffix + lib:libboost_system$secondaryArchSuffix + lib:libboost_program_options$secondaryArchSuffix + lib:libbrotlienc$secondaryArchSuffix + lib:libcrypto$secondaryArchSuffix + lib:libfmt$secondaryArchSuffix + lib:libgirepository_1.0$secondaryArchSuffix + lib:libgiomm_2.68$secondaryArchSuffix + lib:libglib_2.0$secondaryArchSuffix + lib:libglibmm_2.68$secondaryArchSuffix + lib:libgthread_2.0$secondaryArchSuffix + lib:libheif$secondaryArchSuffix + lib:libhwy$secondaryArchSuffix + lib:libhunspell_1.7$secondaryArchSuffix + lib:libintl$secondaryArchSuffix + lib:libjpeg$secondaryArchSuffix + lib:libjxl$secondaryArchSuffix + lib:liblz4$secondaryArchSuffix + lib:liblzma$secondaryArchSuffix + lib:libminizip$secondaryArchSuffix + lib:libopenal$secondaryArchSuffix + lib:libopenh264$secondaryArchSuffix + lib:libopus$secondaryArchSuffix + lib:libprotobuf$secondaryArchSuffix + lib:libqrcodegen$secondaryArchSuffix + lib:libQt6Core$secondaryArchSuffix + lib:libQt6Gui$secondaryArchSuffix + lib:libQt6Network$secondaryArchSuffix + lib:libQt6Svg$secondaryArchSuffix + lib:libQt6Widgets$secondaryArchSuffix + lib:librnnoise$secondaryArchSuffix + lib:libsigc_3.0$secondaryArchSuffix + lib:libstdc++$secondaryArchSuffix + lib:libswresample$secondaryArchSuffix + lib:libswscale$secondaryArchSuffix + lib:libvpx$secondaryArchSuffix + lib:libxkbcommon$secondaryArchSuffix + lib:libxxhash$secondaryArchSuffix + lib:libz$secondaryArchSuffix + qt6_imageformats$secondaryArchSuffix + open_sans + " + +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel + qt6_tools${secondaryArchSuffix}_devel + devel:libabsl_strings$secondaryArchSuffix >= 2301.0.0 + devel:libavif$secondaryArchSuffix + devel:libboost_filesystem$secondaryArchSuffix >= 1.83.0 + devel:libboost_regex$secondaryArchSuffix >= 1.83.0 + devel:libboost_system$secondaryArchSuffix >= 1.83.0 + devel:libboost_program_options$secondaryArchSuffix >= 1.83.0 + devel:libbrotlienc$secondaryArchSuffix + devel:libcrypto$secondaryArchSuffix >= 3 + devel:libfmt$secondaryArchSuffix + devel:libgirepository_1.0$secondaryArchSuffix + devel:libglib_2.0$secondaryArchSuffix + devel:libglibmm_2.68$secondaryArchSuffix + devel:libgthread_2.0$secondaryArchSuffix + devel:libheif$secondaryArchSuffix + devel:libhunspell_1.7$secondaryArchSuffix + devel:libhwy$secondaryArchSuffix + devel:libjpeg$secondaryArchSuffix + devel:libjxl$secondaryArchSuffix >= 0.11 + devel:liblz4$secondaryArchSuffix + devel:liblzma$secondaryArchSuffix + devel:libminizip$secondaryArchSuffix + devel:libopenal$secondaryArchSuffix + devel:libopenh264$secondaryArchSuffix + devel:libopus$secondaryArchSuffix + devel:libprotobuf$secondaryArchSuffix + devel:libqrcodegen$secondaryArchSuffix + devel:libQt6Core$secondaryArchSuffix + devel:libQt6Gui$secondaryArchSuffix + devel:libQt6Network$secondaryArchSuffix + devel:libQt6Svg$secondaryArchSuffix + devel:libQt6Widgets$secondaryArchSuffix + devel:librapidjson$secondaryArchSuffix + devel:librav1e$secondaryArchSuffix + devel:librnnoise$secondaryArchSuffix + devel:libsigc_3.0$secondaryArchSuffix + devel:libsharpyuv$secondaryArchSuffix + devel:libtde2e$secondaryArchSuffix + devel:libtg_owt$secondaryArchSuffix + devel:libvpx$secondaryArchSuffix + devel:libxkbcommon$secondaryArchSuffix + devel:libxxhash$secondaryArchSuffix + devel:libz$secondaryArchSuffix + " +if [ $targetArchitecture == x86_gcc2 ]; then + BUILD_REQUIRES+=" + ffmpeg${secondaryArchSuffix}_devel + " +else + BUILD_REQUIRES+=" + ffmpeg8${secondaryArchSuffix}_devel + " +fi + +BUILD_PREREQUIRES=" + makefile_engine + cmd:cmake + cmd:find + cmd:gawk + cmd:gcc$secondaryArchSuffix + cmd:g_ir_scanner + cmd:make + cmd:lld >= 20 + cmd:ninja + cmd:patch + cmd:pkg_config$secondaryArchSuffix + cmd:python3.10 + cmd:sed + cmd:xargs + cmd:yasm + " + +BUILD() +{ + export DISABLE_ASLR=1 + export GI_GIR_PATH="`finddir B_SYSTEM_DATA_DIRECTORY`"/gir-1.0 + local DISABLE_PRECOMPILE_HEADERS="OFF" + local CXX_FLAGS_RELEASE="-O3" + + if [ $targetArchitecture == x86_gcc2 ]; then + sed -i -e '/-fstack-protector-all/d' cmake/options_linux.cmake + sed -i -e '/_GLIBCXX_ASSERTIONS/d' cmake/options_linux.cmake + DISABLE_PRECOMPILE_HEADERS="ON" + CXX_FLAGS_RELEASE="-O1 -fuse-ld=lld -Wl,--no-keep-memory -Wl,--undefined-version" + fi + + # copy ada library files + cp $sourceDir2/ada.* Telegram/SourceFiles/iv + + # get API_ID and API_HASH from Debian + local TELEGRAM_API_ID=`sed -n "/TDESKTOP_API_ID/p" $sourceDir3/rules | cut -d'=' -f2 | cut -d' ' -f1` + local TELEGRAM_API_HASH=`sed -n "/TDESKTOP_API_HASH/p" $sourceDir3/rules | cut -d'=' -f2 | cut -d' ' -f1` + + if [ -z $TELEGRAM_API_ID ] || [ -z $TELEGRAM_API_HASH ]; then + TELEGRAM_API_ID="17349" + TELEGRAM_API_HASH="344583e45741c457fe1862106095a5eb" + echo -e "\e[91m***************************************************************************\e[39m" + echo -e "\e[91m Use demo API_ID = $TELEGRAM_API_ID and API_HASH = $TELEGRAM_API_HASH \e[39m" + echo -e "\e[91m***************************************************************************\e[39m" + else + echo -e "\e[32m***************************************************************************\e[39m" + echo -e "\e[32m Use custom API_ID = $TELEGRAM_API_ID and API_HASH = $TELEGRAM_API_HASH \e[39m" + echo -e "\e[32m***************************************************************************\e[39m" + fi + + cmake -S . -B build -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_CXX_FLAGS_RELEASE="$CXX_FLAGS_RELEASE" \ + -DCMAKE_EXE_LINKER_FLAGS="-lnetwork -lbe -lmedia" \ + -DCMAKE_DISABLE_PRECOMPILE_HEADERS=$DISABLE_PRECOMPILE_HEADERS \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ + -DBoost_USE_STATIC_LIBS=OFF \ + -DBUILD_SHARED_LIBS=ON \ + -DTDESKTOP_API_TEST=OFF \ + -DTDESKTOP_DISABLE_GTK_INTEGRATION=ON \ + -DDESKTOP_APP_DISABLE_AUTOUPDATE=ON \ + -DDESKTOP_APP_DISABLE_CRASH_REPORTS=ON \ + -DDESKTOP_APP_DISABLE_DBUS_INTEGRATION=ON \ + -DDESKTOP_APP_DISABLE_GTK_INTEGRATION=ON \ + -DDESKTOP_APP_DISABLE_JEMALLOC=ON \ + -DDESKTOP_APP_DISABLE_WEBKITGTK=ON \ + -DDESKTOP_APP_DISABLE_SCUDO=ON \ + -DDESKTOP_APP_DISABLE_WAYLAND_INTEGRATION=ON \ + -DDESKTOP_APP_DISABLE_X11_INTEGRATION=ON \ + -DDESKTOP_APP_USE_PACKAGED_FONTS=ON \ + -DDESKTOP_APP_USE_HUNSPELL_ONLY=ON \ + -DTDESKTOP_USE_PACKAGED_TGVOIP=OFF \ + -DLIBTGVOIP_DISABLE_ALSA=ON \ + -DLIBTGVOIP_DISABLE_PULSEAUDIO=ON \ + -DTDESKTOP_API_ID=$TELEGRAM_API_ID \ + -DTDESKTOP_API_HASH=$TELEGRAM_API_HASH \ + -DLZ4_INCLUDE_DIRS=/system/$relativeIncludeDir + + # hack for info_profile_actions.cpp file (fix OOM error) + if [ $targetArchitecture == x86_gcc2 ]; then + sed -i -e '/info_profile_actions\.cpp\.o:/,/^$/{ /^[[:space:]]*FLAGS[[:space:]]*=/s/-O1/-Os/ }' $sourceDir/build/build.ninja + sed -i -e '/history_widget\.cpp\.o:/,/^$/{ /^[[:space:]]*FLAGS[[:space:]]*=/s/-O1/-O0/ }' $sourceDir/build/build.ninja + fi + + ninja -C build -v $jobArgs + + cd SendToAddon + make $jobArgs +} + +INSTALL() +{ + mkdir -p $appsDir + cp build/bin/Telegram $appsDir + strip $appsDir/Telegram + + pushd SendToAddon + make install INSTALL_DIR=$addOnsDir/Tracker + popd + + local APP_SIGNATURE="application/x-vnd.telegram" + local MAJOR="`echo "$portVersion" | cut -d. -f1`" + local MIDDLE="`echo "$portVersion" | cut -d. -f2`" + local MINOR="`echo "$portVersion" | cut -d. -f3`" + local LONG_INFO="$SUMMARY" + sed \ + -e "s|@APP_SIGNATURE@|$APP_SIGNATURE|" \ + -e "s|@MAJOR@|$MAJOR|" \ + -e "s|@MIDDLE@|$MIDDLE|" \ + -e "s|@MINOR@|$MINOR|" \ + -e "s|@LONG_INFO@|$LONG_INFO|" \ + $portDir/additional-files/telegram_desktop.rdef.in > build/telegram_desktop.rdef + + addResourcesToBinaries build/telegram_desktop.rdef $appsDir/Telegram + addAppDeskbarSymlink $appsDir/Telegram +}