Files
haikuports/net-im/telegram-desktop/patches/telegram_desktop-1.5.15.patchset
Gerasim Troeglazov c9b1ae6c70 Telegram: bump version
2019-02-14 22:43:32 +10:00

2707 lines
80 KiB
Plaintext

From 90ef5477ee4c8ebb41a3ce3613aa1d0ec6db8951 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sun, 3 Feb 2019 00:23:28 +1000
Subject: Add Haiku support
diff --git a/Telegram/Resources/etc/qt_haiku.conf b/Telegram/Resources/etc/qt_haiku.conf
new file mode 100644
index 0000000..6d80862
--- /dev/null
+++ b/Telegram/Resources/etc/qt_haiku.conf
@@ -0,0 +1,2 @@
+[Paths]
+Libraries=:/gui/art
diff --git a/Telegram/Resources/qrc/telegram_haiku.qrc b/Telegram/Resources/qrc/telegram_haiku.qrc
new file mode 100644
index 0000000..33115f9
--- /dev/null
+++ b/Telegram/Resources/qrc/telegram_haiku.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/qt">
+ <file alias="etc/qt.conf">../etc/qt_haiku.conf</file>
+ </qresource>
+</RCC>
diff --git a/Telegram/SourceFiles/base/algorithm_tests.cpp b/Telegram/SourceFiles/base/algorithm_tests.cpp
index 9e3df82..3092663 100644
--- a/Telegram/SourceFiles/base/algorithm_tests.cpp
+++ b/Telegram/SourceFiles/base/algorithm_tests.cpp
@@ -5,7 +5,11 @@ the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
+#if !defined(Q_OS_HAIKU)
#include "catch.hpp"
+#else
+#include "../ThirdParty/variant/test/include/catch.hpp"
+#endif
#include "base/index_based_iterator.h"
@@ -47,4 +51,4 @@ TEST_CASE("index_based_iterator tests", "[base::algorithm]") {
auto expected = std::vector<int> { 5 };
REQUIRE(v == expected);
}
-}
\ No newline at end of file
+}
diff --git a/Telegram/SourceFiles/base/build_config.h b/Telegram/SourceFiles/base/build_config.h
index 3bcb595..b97d66a 100644
--- a/Telegram/SourceFiles/base/build_config.h
+++ b/Telegram/SourceFiles/base/build_config.h
@@ -17,13 +17,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#define OS_LINUX 1
#elif defined(_WIN32) // __APPLE__ || __linux__
#define OS_WIN 1
+#elif defined(__HAIKU__)
+#define OS_HAIKU 1
#else // __APPLE__ || __linux__ || _WIN32
#error Please add support for your platform in base/build_config.h
#endif // else for __APPLE__ || __linux__ || _WIN32
// For access to standard POSIXish features, use OS_POSIX instead of a
// more specific macro.
-#if defined(OS_MAC) || defined(OS_LINUX)
+#if defined(OS_MAC) || defined(OS_LINUX) || defined(OS_HAIKU)
#define OS_POSIX 1
#endif // OS_MAC || OS_LINUX
diff --git a/Telegram/SourceFiles/base/flags_tests.cpp b/Telegram/SourceFiles/base/flags_tests.cpp
index 786dc49..b1ed887 100644
--- a/Telegram/SourceFiles/base/flags_tests.cpp
+++ b/Telegram/SourceFiles/base/flags_tests.cpp
@@ -5,7 +5,11 @@ the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
+#if !defined(Q_OS_HAIKU)
#include "catch.hpp"
+#else
+#include "../ThirdParty/variant/test/include/catch.hpp"
+#endif
#include "base/flags.h"
diff --git a/Telegram/SourceFiles/base/flat_map_tests.cpp b/Telegram/SourceFiles/base/flat_map_tests.cpp
index 7dad013..1cb7036 100644
--- a/Telegram/SourceFiles/base/flat_map_tests.cpp
+++ b/Telegram/SourceFiles/base/flat_map_tests.cpp
@@ -5,7 +5,11 @@ the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
+#if !defined(Q_OS_HAIKU)
#include "catch.hpp"
+#else
+#include "../ThirdParty/variant/test/include/catch.hpp"
+#endif
#include "base/flat_map.h"
#include <string>
diff --git a/Telegram/SourceFiles/base/flat_set_tests.cpp b/Telegram/SourceFiles/base/flat_set_tests.cpp
index a73f1d2..77d98a6 100644
--- a/Telegram/SourceFiles/base/flat_set_tests.cpp
+++ b/Telegram/SourceFiles/base/flat_set_tests.cpp
@@ -5,7 +5,11 @@ the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
+#if !defined(Q_OS_HAIKU)
#include "catch.hpp"
+#else
+#include "../ThirdParty/variant/test/include/catch.hpp"
+#endif
#include "base/flat_set.h"
diff --git a/Telegram/SourceFiles/base/tests_main.cpp b/Telegram/SourceFiles/base/tests_main.cpp
index fbdcb56..0eb0e4f 100644
--- a/Telegram/SourceFiles/base/tests_main.cpp
+++ b/Telegram/SourceFiles/base/tests_main.cpp
@@ -6,8 +6,12 @@ For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#define CATCH_CONFIG_RUNNER
+#if !defined(Q_OS_HAIKU)
#include "catch.hpp"
#include "reporters/catch_reporter_compact.hpp"
+#else
+#include "../ThirdParty/variant/test/include/catch.hpp"
+#endif
#include <QFile>
int (*TestForkedMethod)()/* = nullptr*/;
diff --git a/Telegram/SourceFiles/boxes/add_contact_box.cpp b/Telegram/SourceFiles/boxes/add_contact_box.cpp
index a7a150d..d95a157 100644
--- a/Telegram/SourceFiles/boxes/add_contact_box.cpp
+++ b/Telegram/SourceFiles/boxes/add_contact_box.cpp
@@ -88,7 +88,7 @@ void ShowAddParticipantsError(
const auto makeAdmin = [=] {
const auto user = users.front();
const auto weak = std::make_shared<QPointer<EditAdminBox>>();
- const auto close = [=](auto&&...) {
+ const auto close = [=] {
if (*weak) {
(*weak)->closeBox();
}
@@ -96,7 +96,7 @@ void ShowAddParticipantsError(
const auto saveCallback = SaveAdminCallback(
channel,
user,
- close,
+ [=](auto&&...) { close(); },
close);
auto box = Box<EditAdminBox>(
channel,
diff --git a/Telegram/SourceFiles/core/launcher.cpp b/Telegram/SourceFiles/core/launcher.cpp
index faf45cd..ea4691f 100644
--- a/Telegram/SourceFiles/core/launcher.cpp
+++ b/Telegram/SourceFiles/core/launcher.cpp
@@ -5,6 +5,7 @@ the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
+
#include "core/launcher.h"
#include "platform/platform_launcher.h"
@@ -15,6 +16,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "core/sandbox.h"
#include "base/concurrent_timer.h"
+#ifdef __HAIKU__
+#include <signal.h>
+#include <unistd.h>
+#endif
+
namespace Core {
namespace {
@@ -230,6 +236,10 @@ int Launcher::exec() {
// I don't know why path is not in QT_PLUGIN_PATH by default
QCoreApplication::addLibraryPath("/usr/lib/qt/plugins");
+#if defined(Q_OS_HAIKU)
+ QCoreApplication::addLibraryPath("/boot/system/add-ons/Qt5");
+ QCoreApplication::addLibraryPath("/boot/system/add-ons/x86/Qt5");
+#endif
// without this Telegram doesn't start on Ubuntu 17.04 due GTK errors
setenv("QT_STYLE_OVERRIDE", "qwerty", false);
// Telegram doesn't start when extraordinary theme is set, see launchpad.net/bugs/1680943
@@ -331,6 +341,9 @@ void Launcher::prepareSettings() {
case dbipMacOld:
gPlatformString = qsl("MacOSold");
break;
+ case dbipHaiku:
+ gPlatformString = qsl("HaikuDepot");
+ break;
case dbipLinux64:
gPlatformString = qsl("Linux64bit");
break;
@@ -447,7 +460,16 @@ int Launcher::executeApplication() {
Sandbox sandbox(this, _argc, _argv);
MainQueueProcessor processor;
base::ConcurrentTimerEnvironment environment;
+#ifdef __HAIKU__
+ int res = sandbox.start();
+ CrashReports::Finish();
+ Platform::finish();
+ Logs::finish();
+ kill(::getpid(), SIGKILL);
+ return res;
+#else
return sandbox.start();
+#endif
}
} // namespace Core
diff --git a/Telegram/SourceFiles/core/update_checker.cpp b/Telegram/SourceFiles/core/update_checker.cpp
index dabeddc..20dd2c1 100644
--- a/Telegram/SourceFiles/core/update_checker.cpp
+++ b/Telegram/SourceFiles/core/update_checker.cpp
@@ -500,6 +500,7 @@ bool ParseCommonMap(
case dbipWindows: return "win";
case dbipMac: return "mac";
case dbipMacOld: return "mac32";
+ case dbipHaiku: return "haiku";
case dbipLinux64: return "linux";
case dbipLinux32: return "linux32";
}
@@ -1509,6 +1510,9 @@ bool checkReadyUpdate() {
#elif defined Q_OS_LINUX // Q_OS_MAC
QString curUpdater = (cExeDir() + qsl("Updater"));
QFileInfo updater(cWorkingDir() + qsl("tupdates/temp/Updater"));
+#elif defined Q_OS_HAIKU // Q_OS_LINUX
+ QString curUpdater = (cExeDir() + qsl("Updater"));
+ QFileInfo updater(cWorkingDir() + qsl("tupdates/temp/Updater"));
#endif // Q_OS_LINUX
if (!updater.exists()) {
QFileInfo current(curUpdater);
diff --git a/Telegram/SourceFiles/core/utils.h b/Telegram/SourceFiles/core/utils.h
index e8b0d33..99d61bc 100644
--- a/Telegram/SourceFiles/core/utils.h
+++ b/Telegram/SourceFiles/core/utils.h
@@ -350,6 +350,7 @@ enum DBIPlatform {
dbipLinux64 = 2,
dbipLinux32 = 3,
dbipMacOld = 4,
+ dbipHaiku = 5,
};
enum DBIPeerReportSpamStatus {
diff --git a/Telegram/SourceFiles/export/data/export_data_types.cpp b/Telegram/SourceFiles/export/data/export_data_types.cpp
index 3dc7b4e..3506b23 100644
--- a/Telegram/SourceFiles/export/data/export_data_types.cpp
+++ b/Telegram/SourceFiles/export/data/export_data_types.cpp
@@ -242,7 +242,8 @@ Image ParseMaxImage(
result.width = data.vw.v;
result.height = data.vh.v;
result.file.location = ParseLocation(data.vlocation);
- if constexpr (MTPDphotoCachedSize::Is<decltype(data)>()) {
+ constexpr bool is = (MTPDphotoCachedSize::Is<decltype(data)>());
+ if constexpr (is) {
result.file.content = data.vbytes.v;
result.file.size = result.file.content.size();
} else {
@@ -431,7 +432,8 @@ Image ParseDocumentThumb(
result.width = data.vw.v;
result.height = data.vh.v;
result.file.location = ParseLocation(data.vlocation);
- if constexpr (MTPDphotoCachedSize::Is<decltype(data)>()) {
+ constexpr bool is = (MTPDphotoCachedSize::Is<decltype(data)>());
+ if constexpr (is) {
result.file.content = data.vbytes.v;
result.file.size = result.file.content.size();
} else {
@@ -1122,7 +1124,8 @@ Message ParseMessage(
auto result = Message();
data.match([&](const auto &data) {
result.id = data.vid.v;
- if constexpr (!MTPDmessageEmpty::Is<decltype(data)>()) {
+ constexpr bool is = (!MTPDmessageEmpty::Is<decltype(data)>());
+ if constexpr (is) {
result.toId = ParsePeerId(data.vto_id);
const auto peerId = (!data.is_out()
&& data.has_from_id()
diff --git a/Telegram/SourceFiles/export/export_api_wrap.cpp b/Telegram/SourceFiles/export/export_api_wrap.cpp
index f183f3b..44053fc 100644
--- a/Telegram/SourceFiles/export/export_api_wrap.cpp
+++ b/Telegram/SourceFiles/export/export_api_wrap.cpp
@@ -720,7 +720,8 @@ void ApiWrap::handleUserpicsSlice(const MTPphotos_Photos &result) {
Expects(_userpicsProcess != nullptr);
result.match([&](const auto &data) {
- if constexpr (MTPDphotos_photos::Is<decltype(data)>()) {
+ constexpr bool is = (MTPDphotos_photos::Is<decltype(data)>());
+ if constexpr (is) {
_userpicsProcess->lastSlice = true;
}
loadUserpicsFiles(Data::ParseUserpicsSlice(
@@ -1257,7 +1258,8 @@ void ApiWrap::requestMessagesSlice() {
result.match([&](const MTPDmessages_messagesNotModified &data) {
error("Unexpected messagesNotModified received.");
}, [&](const auto &data) {
- if constexpr (MTPDmessages_messages::Is<decltype(data)>()) {
+ constexpr bool is = (MTPDmessages_messages::Is<decltype(data)>());
+ if constexpr (is) {
_chatProcess->lastSlice = true;
}
loadMessagesFiles(Data::ParseMessagesSlice(
diff --git a/Telegram/SourceFiles/logs.cpp b/Telegram/SourceFiles/logs.cpp
index 84c9af0..5e343c6 100644
--- a/Telegram/SourceFiles/logs.cpp
+++ b/Telegram/SourceFiles/logs.cpp
@@ -333,7 +333,7 @@ void start(not_null<Core::Launcher*> launcher) {
if (cAlphaVersion()) {
workingDirChosen = true;
-#if defined Q_OS_MAC || defined Q_OS_LINUX
+#if defined Q_OS_MAC || defined Q_OS_LINUX || defined Q_OS_HAIKU
} else {
if (!cWorkingDir().isEmpty()) {
// This value must come from TelegramForcePortable
diff --git a/Telegram/SourceFiles/media/media_audio.cpp b/Telegram/SourceFiles/media/media_audio.cpp
index b9843c2..898fbb2 100644
--- a/Telegram/SourceFiles/media/media_audio.cpp
+++ b/Telegram/SourceFiles/media/media_audio.cpp
@@ -99,6 +99,7 @@ void EnumeratePlaybackDevices() {
void EnumerateCaptureDevices() {
auto deviceNames = QStringList();
auto devices = alcGetString(nullptr, ALC_CAPTURE_DEVICE_SPECIFIER);
+#ifndef __HAIKU__
Assert(devices != nullptr);
while (*devices != 0) {
auto deviceName8Bit = QByteArray(devices);
@@ -107,7 +108,7 @@ void EnumerateCaptureDevices() {
devices += deviceName8Bit.size() + 1;
}
LOG(("Audio Capture Devices: %1").arg(deviceNames.join(';')));
-
+#endif
if (auto device = alcGetString(nullptr, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER)) {
LOG(("Audio Capture Default Device: %1").arg(QString::fromLocal8Bit(device)));
} else {
diff --git a/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.cpp b/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.cpp
new file mode 100644
index 0000000..47a223f
--- /dev/null
+++ b/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.cpp
@@ -0,0 +1,133 @@
+/*
+This file is part of Telegram Desktop for Haiku,
+
+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.
+
+Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
+Copyright (c) 2018 Gerasim Troeglazov, 3dEyes@gmail.com
+*/
+
+#include "platform/haiku/file_utilities_haiku.h"
+
+#include "mainwindow.h"
+#include "storage/localstorage.h"
+
+namespace Platform {
+namespace File {
+namespace internal {
+
+QByteArray EscapeShell(const QByteArray &content) {
+ auto result = QByteArray();
+
+ auto b = content.constData(), e = content.constEnd();
+ for (auto ch = b; ch != e; ++ch) {
+ if (*ch == ' ' || *ch == '"' || *ch == '\'' || *ch == '\\') {
+ if (result.isEmpty()) {
+ result.reserve(content.size() * 2);
+ }
+ if (ch > b) {
+ result.append(b, ch - b);
+ }
+ result.append('\\');
+ b = ch;
+ }
+ }
+ if (result.isEmpty()) {
+ return content;
+ }
+
+ if (e > b) {
+ result.append(b, e - b);
+ }
+ return result;
+}
+
+} // namespace internal
+
+void UnsafeShowInFolder(const QString &filepath) {
+ Ui::hideLayer(anim::type::instant); // Hide mediaview to make other apps visible.
+ auto absolutePath = QFileInfo(filepath).absoluteFilePath();
+ QProcess process;
+ auto command = qsl("open");
+ auto arguments = QStringList();
+ arguments << QFileInfo(filepath).absoluteDir().absolutePath();
+
+ if (!process.startDetached(command, arguments)) {
+ LOG(("Failed to launch '%1 %2'").arg(command).arg(arguments.join(' ')));
+ }
+}
+
+bool UnsafeShowOpenWith(const QString &filepath) {
+ auto absolutePath = QFileInfo(filepath).absoluteFilePath();
+
+ QProcess process;
+ auto command = qsl("open");
+ auto arguments = QStringList();
+ arguments << absolutePath;
+
+ if (!process.startDetached(command, arguments)) {
+ LOG(("Failed to launch '%1 %2'").arg(command).arg(arguments.join(' ')));
+ return false;
+ }
+ return true;
+}
+
+} // namespace File
+
+namespace FileDialog {
+namespace {
+
+using Type = ::FileDialog::internal::Type;
+
+bool NativeSupported() {
+ return false;
+}
+
+bool PreviewSupported() {
+ return false;
+}
+
+
+
+} // namespace
+
+bool Get(QPointer<QWidget> parent, QStringList &files, QByteArray &remoteContent, const QString &caption, \
+ const QString &filter, Type type, QString startFile) {
+ return ::FileDialog::internal::GetDefault(parent, files, remoteContent, caption, filter, type, startFile);
+}
+
+namespace internal {
+
+
+
+
+namespace {
+
+const char *filterRegExp =
+"^(.*)\\(([a-zA-Z0-9_.,*? +;#\\-\\[\\]@\\{\\}/!<>\\$%&=^~:\\|]*)\\)$";
+
+// Makes a list of filters from a normal filter string "Image Files (*.png *.jpg)"
+QStringList cleanFilterList(const QString &filter) {
+ QRegExp regexp(QString::fromLatin1(filterRegExp));
+ Q_ASSERT(regexp.isValid());
+ QString f = filter;
+ int i = regexp.indexIn(f);
+ if (i >= 0)
+ f = regexp.cap(2);
+ return f.split(QLatin1Char(' '), QString::SkipEmptyParts);
+}
+
+} // namespace
+
+
+
+} // namespace internal
+} // namespace FileDialog
+} // namespace Platform
diff --git a/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.h b/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.h
new file mode 100644
index 0000000..ed8367c
--- /dev/null
+++ b/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.h
@@ -0,0 +1,67 @@
+/*
+This file is part of Telegram Desktop for Haiku,
+
+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.
+
+Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
+Copyright (c) 2018 Gerasim Troeglazov, 3dEyes@gmail.com
+*/
+
+#pragma once
+
+#include "platform/platform_file_utilities.h"
+
+extern "C" {
+#undef signals
+#define signals public
+} // extern "C"
+
+namespace Platform {
+namespace File {
+namespace internal {
+
+QByteArray EscapeShell(const QByteArray &content);
+
+} // namespace internal
+
+inline QString UrlToLocal(const QUrl &url) {
+ return ::File::internal::UrlToLocalDefault(url);
+}
+
+inline void UnsafeOpenEmailLink(const QString &email) {
+ return ::File::internal::UnsafeOpenEmailLinkDefault(email);
+}
+
+inline bool UnsafeShowOpenWithDropdown(const QString &filepath, QPoint menuPosition) {
+ return false;
+}
+
+inline void UnsafeLaunch(const QString &filepath) {
+ return ::File::internal::UnsafeLaunchDefault(filepath);
+}
+
+inline void PostprocessDownloaded(const QString &filepath) {
+}
+
+} // namespace File
+
+namespace FileDialog {
+
+inline void InitLastPath() {
+ ::FileDialog::internal::InitLastPathDefault();
+}
+
+namespace internal {
+
+
+
+} // namespace internal
+} // namespace FileDialog
+} // namespace Platform
diff --git a/Telegram/SourceFiles/platform/haiku/haiku_desktop_environment.cpp b/Telegram/SourceFiles/platform/haiku/haiku_desktop_environment.cpp
new file mode 100644
index 0000000..5fe1b94
--- /dev/null
+++ b/Telegram/SourceFiles/platform/haiku/haiku_desktop_environment.cpp
@@ -0,0 +1,67 @@
+/*
+This file is part of Telegram Desktop for Haiku,
+
+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.
+
+Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
+Copyright (c) 2018 Gerasim Troeglazov, 3dEyes@gmail.com
+*/
+
+#include "platform/haiku/haiku_desktop_environment.h"
+
+namespace Platform {
+namespace DesktopEnvironment {
+namespace {
+
+QString GetEnv(const char *name) {
+ auto result = getenv(name);
+ auto value = result ? QString::fromLatin1(result) : QString();
+ LOG(("Getting DE, %1: '%2'").arg(name).arg(value));
+ return value;
+}
+
+Type Compute() {
+ return Type::Other;
+}
+
+Type ComputeAndLog() {
+ auto result = Compute();
+ auto name = [result]() -> QString {
+ switch (result) {
+ case Type::Other: return "Other";
+ }
+ return QString::number(static_cast<int>(result));
+ };
+ LOG(("DE: %1").arg(name()));
+ return result;
+}
+
+} // namespace
+
+// Thanks Chromium.
+Type Get() {
+ static const auto result = ComputeAndLog();
+ return result;
+}
+
+bool TryQtTrayIcon() {
+ return true;
+}
+
+bool PreferAppIndicatorTrayIcon() {
+ return false;
+}
+
+bool TryUnityCounter() {
+ return false;
+}
+
+} // namespace DesktopEnvironment
+} // namespace Platform
diff --git a/Telegram/SourceFiles/platform/haiku/haiku_desktop_environment.h b/Telegram/SourceFiles/platform/haiku/haiku_desktop_environment.h
new file mode 100644
index 0000000..248d8a8
--- /dev/null
+++ b/Telegram/SourceFiles/platform/haiku/haiku_desktop_environment.h
@@ -0,0 +1,33 @@
+/*
+This file is part of Telegram Desktop for Haiku,
+
+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.
+
+Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
+Copyright (c) 2018 Gerasim Troeglazov, 3dEyes@gmail.com
+*/
+
+#pragma once
+
+namespace Platform {
+namespace DesktopEnvironment {
+
+enum class Type {
+ Other
+};
+
+Type Get();
+
+bool TryQtTrayIcon();
+bool PreferAppIndicatorTrayIcon();
+bool TryUnityCounter();
+
+} // namespace DesktopEnvironment
+} // namespace Platform
diff --git a/Telegram/SourceFiles/platform/haiku/launcher_haiku.cpp b/Telegram/SourceFiles/platform/haiku/launcher_haiku.cpp
new file mode 100644
index 0000000..7cae4cc
--- /dev/null
+++ b/Telegram/SourceFiles/platform/haiku/launcher_haiku.cpp
@@ -0,0 +1,68 @@
+/*
+This file is part of Telegram Desktop for Haiku,
+
+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.
+
+Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
+Copyright (c) 2018 Gerasim Troeglazov, 3dEyes@gmail.com
+*/
+
+#include "platform/haiku/launcher_haiku.h"
+
+#include "core/crash_reports.h"
+
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <cstdlib>
+#include <unistd.h>
+#include <dirent.h>
+#include <pwd.h>
+
+namespace Platform {
+namespace {
+
+class Arguments {
+public:
+ void push(QByteArray argument) {
+ argument.append(char(0));
+ _argumentValues.push_back(argument);
+ _arguments.push_back(_argumentValues.back().data());
+ }
+
+ char **result() {
+ _arguments.push_back(nullptr);
+ return _arguments.data();
+ }
+
+private:
+ std::vector<QByteArray> _argumentValues;
+ std::vector<char*> _arguments;
+
+};
+
+QString DeviceModel() {
+ return "PC";
+}
+
+QString SystemVersion() {
+ return "Haiku";
+}
+
+} // namespace
+
+Launcher::Launcher(int argc, char *argv[])
+: Core::Launcher(argc, argv, DeviceModel(), SystemVersion()) {
+}
+
+bool Launcher::launchUpdater(UpdaterLaunch action) {
+ return false;
+}
+
+} // namespace
diff --git a/Telegram/SourceFiles/platform/haiku/launcher_haiku.h b/Telegram/SourceFiles/platform/haiku/launcher_haiku.h
new file mode 100644
index 0000000..54073f5
--- /dev/null
+++ b/Telegram/SourceFiles/platform/haiku/launcher_haiku.h
@@ -0,0 +1,32 @@
+/*
+This file is part of Telegram Desktop for Haiku,
+
+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.
+
+Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
+Copyright (c) 2018 Gerasim Troeglazov, 3dEyes@gmail.com
+*/
+
+#pragma once
+
+#include "core/launcher.h"
+
+namespace Platform {
+
+class Launcher : public Core::Launcher {
+public:
+ Launcher(int argc, char *argv[]);
+
+private:
+ bool launchUpdater(UpdaterLaunch action) override;
+
+};
+
+} // namespace Platform
diff --git a/Telegram/SourceFiles/platform/haiku/main_window_haiku.cpp b/Telegram/SourceFiles/platform/haiku/main_window_haiku.cpp
new file mode 100644
index 0000000..af88932
--- /dev/null
+++ b/Telegram/SourceFiles/platform/haiku/main_window_haiku.cpp
@@ -0,0 +1,128 @@
+/*
+This file is part of Telegram Desktop for Haiku,
+
+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.
+
+Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
+Copyright (c) 2018 Gerasim Troeglazov, 3dEyes@gmail.com
+*/
+
+#include "platform/haiku/main_window_haiku.h"
+
+#include "styles/style_window.h"
+#include "platform/haiku/haiku_desktop_environment.h"
+#include "history/history.h"
+#include "mainwindow.h"
+#include "core/application.h"
+#include "lang/lang_keys.h"
+#include "storage/localstorage.h"
+
+namespace Platform {
+
+MainWindow::MainWindow() {
+ connect(&_psCheckStatusIconTimer, SIGNAL(timeout()), this, SLOT(psStatusIconCheck()));
+ _psCheckStatusIconTimer.setSingleShot(false);
+
+ connect(&_psUpdateIndicatorTimer, SIGNAL(timeout()), this, SLOT(psUpdateIndicator()));
+ _psUpdateIndicatorTimer.setSingleShot(true);
+}
+
+bool MainWindow::hasTrayIcon() const {
+ return true;
+}
+
+void MainWindow::psStatusIconCheck() {
+ if (cSupportTray() || !--_psCheckStatusIconLeft) {
+ _psCheckStatusIconTimer.stop();
+ return;
+ }
+}
+
+void MainWindow::psShowTrayMenu() {
+}
+
+void MainWindow::psTrayMenuUpdated() {
+}
+
+void MainWindow::psSetupTrayIcon() {
+ if (!trayIcon) {
+ trayIcon = new QSystemTrayIcon(this);
+
+ auto icon = QIcon(App::pixmapFromImageInPlace(Core::App().logoNoMargin()));
+
+ trayIcon->setIcon(icon);
+ trayIcon->setToolTip(str_const_toString(AppName));
+ connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(toggleTray(QSystemTrayIcon::ActivationReason)), Qt::UniqueConnection);
+ connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(showFromTray()));
+ App::wnd()->updateTrayMenu();
+ }
+ updateIconCounters();
+
+ trayIcon->show();
+}
+
+void MainWindow::workmodeUpdated(DBIWorkMode mode) {
+ psSetupTrayIcon();
+ if (mode == dbiwmWindowOnly) {
+ if (trayIcon) {
+ trayIcon->setContextMenu(0);
+ delete trayIcon;
+ trayIcon = nullptr;
+ }
+ }
+}
+
+
+void MainWindow::psUpdateIndicator() {
+}
+
+void MainWindow::unreadCounterChangedHook() {
+ setWindowTitle(titleText());
+ updateIconCounters();
+}
+
+void MainWindow::updateIconCounters() {
+ const auto counter = Core::App().unreadBadge();
+ const auto muted = Core::App().unreadBadgeMuted();
+ auto &bg = (muted ? st::trayCounterBgMute : st::trayCounterBg);
+ auto &fg = st::trayCounterFg;
+ if (trayIcon) {
+ QIcon icon;
+ icon.addPixmap(App::pixmapFromImageInPlace(iconWithCounter(16, counter, bg, fg, true)));
+ icon.addPixmap(App::pixmapFromImageInPlace(iconWithCounter(32, counter, bg, fg, true)));
+ trayIcon->setIcon(icon);
+ }
+}
+
+void MainWindow::LibsLoaded() {
+}
+
+void MainWindow::psCreateTrayIcon() {
+
+}
+
+void MainWindow::psFirstShow() {
+ psCreateTrayIcon();
+ psUpdateMargins();
+ bool showShadows = true;
+ show();
+ setPositionInited();
+}
+
+void MainWindow::psInitSysMenu() {
+}
+
+void MainWindow::psUpdateMargins() {
+}
+
+MainWindow::~MainWindow() {
+}
+
+} // namespace Platform
diff --git a/Telegram/SourceFiles/platform/haiku/main_window_haiku.h b/Telegram/SourceFiles/platform/haiku/main_window_haiku.h
new file mode 100644
index 0000000..ceb89c0
--- /dev/null
+++ b/Telegram/SourceFiles/platform/haiku/main_window_haiku.h
@@ -0,0 +1,75 @@
+/*
+This file is part of Telegram Desktop for Haiku,
+
+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.
+
+Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
+Copyright (c) 2018 Gerasim Troeglazov, 3dEyes@gmail.com
+*/
+
+#pragma once
+
+#include "platform/platform_main_window.h"
+
+namespace Platform {
+
+class MainWindow : public Window::MainWindow {
+ Q_OBJECT
+
+public:
+ MainWindow();
+
+ void psFirstShow();
+ void psInitSysMenu();
+ void psUpdateMargins();
+
+ void psRefreshTaskbarIcon() {
+ }
+
+ virtual QImage iconWithCounter(int size, int count, style::color bg, style::color fg, bool smallIcon) = 0;
+
+ static void LibsLoaded();
+
+ ~MainWindow();
+
+public slots:
+ void psShowTrayMenu();
+
+ void psStatusIconCheck();
+ void psUpdateIndicator();
+
+protected:
+ void unreadCounterChangedHook() override;
+
+ bool hasTrayIcon() const override;
+
+ void workmodeUpdated(DBIWorkMode mode) override;
+
+ QSystemTrayIcon *trayIcon = nullptr;
+ QMenu *trayIconMenu = nullptr;
+
+ void psTrayMenuUpdated();
+ void psSetupTrayIcon();
+
+ virtual void placeSmallCounter(QImage &img, int size, int count, style::color bg, const QPoint &shift, style::color color) = 0;
+
+private:
+ void updateIconCounters();
+ void psCreateTrayIcon();
+
+ QTimer _psCheckStatusIconTimer;
+ int _psCheckStatusIconLeft = 100;
+
+ QTimer _psUpdateIndicatorTimer;
+ TimeMs _psLastIndicatorUpdate = 0;
+
+};
+
+} // namespace Platform
diff --git a/Telegram/SourceFiles/platform/haiku/notifications_haiku_gate.cpp b/Telegram/SourceFiles/platform/haiku/notifications_haiku_gate.cpp
new file mode 100644
index 0000000..9709580
--- /dev/null
+++ b/Telegram/SourceFiles/platform/haiku/notifications_haiku_gate.cpp
@@ -0,0 +1,70 @@
+/*
+This file is part of Telegram Desktop for Haiku,
+
+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.
+
+Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
+Copyright (c) 2018 Gerasim Troeglazov, 3dEyes@gmail.com
+*/
+
+#include <Application.h>
+#include <OS.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#define APPSIGNATURE "application/x-vnd.tg-notify-gate"
+#define NOTIFY_PORT_NAME "tg_notify"
+#define NOTIFY_MESSAGE 'TGNF'
+
+typedef struct notify_msg
+{
+ uint64 peerId;
+ int32 msgId;
+} notify_msg;
+
+class SimpleLauncherApp : public BApplication {
+ public:
+ SimpleLauncherApp(int argc, char **argv);
+ void ArgvReceived(int32 argc, char **argv);
+ virtual void ReadyToRun();
+};
+
+SimpleLauncherApp::SimpleLauncherApp(int argc, char **argv) : BApplication(APPSIGNATURE)
+{
+}
+
+void
+SimpleLauncherApp::ArgvReceived(int32 argc, char **argv)
+{
+ if (argc==2) {
+ notify_msg message;
+ sscanf(argv[1], "%lld %d", &message.peerId, &message.msgId);
+ if (message.peerId != 0 && message.msgId != 0) {
+ port_id portId = find_port(NOTIFY_PORT_NAME);
+ if (portId > 0) {
+ write_port(portId, NOTIFY_MESSAGE, &message, sizeof(message));
+ }
+ }
+ }
+}
+
+void
+SimpleLauncherApp::ReadyToRun()
+{
+ Quit();
+}
+
+int main(int argc, char **argv)
+{
+ SimpleLauncherApp application(argc, argv);
+ application.Run();
+ return 0;
+}
diff --git a/Telegram/SourceFiles/platform/haiku/notifications_haiku_gate.rdef b/Telegram/SourceFiles/platform/haiku/notifications_haiku_gate.rdef
new file mode 100644
index 0000000..b6f3490
--- /dev/null
+++ b/Telegram/SourceFiles/platform/haiku/notifications_haiku_gate.rdef
@@ -0,0 +1,13 @@
+resource app_flags B_MULTIPLE_LAUNCH | B_BACKGROUND_APP;
+
+resource app_version {
+ major = 0,
+ middle = 0,
+ minor = 1,
+ variety = B_APPV_FINAL,
+ internal = 0,
+ short_info = "tg-notify-gate",
+ long_info = "Telegram native notifications gate"
+};
+
+resource app_signature "application/x-vnd.tg-notify-gate";
diff --git a/Telegram/SourceFiles/platform/haiku/notifications_manager_haiku.cpp b/Telegram/SourceFiles/platform/haiku/notifications_manager_haiku.cpp
new file mode 100644
index 0000000..def91de
--- /dev/null
+++ b/Telegram/SourceFiles/platform/haiku/notifications_manager_haiku.cpp
@@ -0,0 +1,212 @@
+/*
+This file is part of Telegram Desktop for Haiku,
+
+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.
+
+Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
+Copyright (c) 2018 Gerasim Troeglazov, 3dEyes@gmail.com
+*/
+
+#define int64 XXX
+#define uint64 YYY
+
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include <SupportDefs.h>
+#include <Notification.h>
+#include <Bitmap.h>
+#include <TranslationUtils.h>
+#include <Entry.h>
+#include <OS.h>
+
+#include "platform/haiku/notifications_manager_haiku.h"
+
+#include "window/notifications_utilities.h"
+#include "lang/lang_keys.h"
+#include "history/history.h"
+
+#include <QProcess>
+#include <QThread>
+#include <QObject>
+#include <QString>
+#include <QStringList>
+
+namespace Platform {
+namespace Notifications {
+namespace {
+
+} // namespace
+
+bool Supported() {
+ return true;
+}
+
+std::unique_ptr<Window::Notifications::Manager> Create(Window::Notifications::System *system) {
+ if (Global::NativeNotifications() && Supported()) {
+ auto result = std::make_unique<Manager>(system);
+ if (result->init()) {
+ return std::move(result);
+ }
+ }
+ return nullptr;
+}
+
+void Finish() {
+}
+
+NotifyReader::NotifyReader()
+{
+ portId = create_port(NOTIFY_MESSAGE_DEEP, NOTIFY_PORT_NAME);
+}
+
+NotifyReader::~NotifyReader()
+{
+ if (portId >= B_OK)
+ delete_port(portId);
+}
+
+void NotifyReader::run()
+{
+ notify_msg message;
+ int32 code;
+
+ while (true) {
+ ssize_t bytesRead = read_port(portId, &code, &message, sizeof(message));
+ if (bytesRead == B_BAD_PORT_ID)
+ break;
+ if (bytesRead < (ssize_t)sizeof(message) || code != NOTIFY_MESSAGE)
+ continue;
+ if (message.peerId != 0 && message.msgId != 0)
+ notificationActivated(message.peerId, message.msgId);
+ }
+}
+
+Manager::Private::Private(Manager *instance, Type type)
+: _guarded(std::make_shared<Manager*>(instance))
+, _cachedUserpics(type) {
+ _weak = _guarded;
+}
+
+bool Manager::Private::init() {
+ portReaderThread = new QThread;
+ portReader = new NotifyReader();
+ portReader->moveToThread(portReaderThread);
+ connect(portReaderThread, SIGNAL(started()), portReader, SLOT(run()));
+ qRegisterMetaType<PeerId>("PeerId");
+ qRegisterMetaType<MsgId>("MsgId");
+ connect(portReader, SIGNAL(notificationActivated(PeerId, MsgId)), \
+ this, SLOT(notificationActivatedSlot(PeerId, MsgId)));
+ portReaderThread->start();
+ return true;
+}
+
+Manager::Private::~Private() {
+ clearAll();
+}
+
+void Manager::Private::clearAll() {
+}
+
+void Manager::Private::clearFromHistory(History *history) {
+}
+
+void Manager::Private::beforeNotificationActivated(PeerId peerId, MsgId msgId) {
+}
+
+void Manager::Private::afterNotificationActivated(PeerId peerId, MsgId msgId) {
+}
+
+void Manager::Private::clearNotification(PeerId peerId, MsgId msgId) {
+}
+
+bool Manager::Private::showNotification(PeerData *peer, MsgId msgId, const QString &title, \
+ const QString &subtitle, const QString &msg, bool hideNameAndPhoto, bool hideReplyButton) {
+ auto titleText = title;
+ auto subtitleText = subtitle;
+ auto msgText = msg;
+
+ StorageKey key;
+ if (hideNameAndPhoto) {
+ key = StorageKey(0, 0);
+ } else {
+ key = peer->userpicUniqueKey();
+ }
+
+ auto userpicPath = _cachedUserpics.get(key, peer);
+ BBitmap *icon = BTranslationUtils::GetBitmapFile(userpicPath.toUtf8().data());
+ QString args = QString("%1 %2").arg(peer->id).arg(msgId);
+ BNotification notify(B_INFORMATION_NOTIFICATION);
+ if (icon)
+ notify.SetIcon(icon);
+ 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()));
+ notify.Send();
+
+ return true;
+}
+
+void Manager::Private::notificationActivatedSlot(PeerId _peerId, MsgId _msgId)
+{
+ qDebug() << _peerId << _msgId;
+ performOnMainQueue([peerId = _peerId, msgId = _msgId](Manager *manager) {
+ manager->notificationActivated(peerId, msgId);
+ });
+}
+
+Manager::Manager(Window::Notifications::System *system) : NativeManager(system)
+, _private(std::make_unique<Private>(this, Private::Type::Rounded)) {
+}
+
+bool Manager::init() {
+ return _private->init();
+}
+
+void Manager::clearNotification(PeerId peerId, MsgId msgId) {
+ _private->clearNotification(peerId, msgId);
+}
+
+Manager::~Manager() = default;
+
+void Manager::doShowNativeNotification(PeerData *peer, MsgId msgId, const QString &title, \
+ const QString &subtitle, const QString &msg, bool hideNameAndPhoto, bool hideReplyButton) {
+ _private->showNotification(peer, msgId, title, subtitle, msg, hideNameAndPhoto, hideReplyButton);
+}
+
+void Manager::doClearAllFast() {
+ _private->clearAll();
+}
+
+void Manager::doClearFromHistory(History *history) {
+ _private->clearFromHistory(history);
+}
+
+void Manager::onBeforeNotificationActivated(PeerId peerId, MsgId msgId) {
+ _private->beforeNotificationActivated(peerId, msgId);
+}
+
+void Manager::onAfterNotificationActivated(PeerId peerId, MsgId msgId) {
+ _private->afterNotificationActivated(peerId, msgId);
+}
+
+bool Manager::hasActionsSupport() const {
+ return _private->hasActionsSupport();
+}
+
+} // namespace Notifications
+} // namespace Platform
diff --git a/Telegram/SourceFiles/platform/haiku/notifications_manager_haiku.h b/Telegram/SourceFiles/platform/haiku/notifications_manager_haiku.h
new file mode 100644
index 0000000..25c8e26
--- /dev/null
+++ b/Telegram/SourceFiles/platform/haiku/notifications_manager_haiku.h
@@ -0,0 +1,130 @@
+/*
+This file is part of Telegram Desktop for Haiku,
+
+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.
+
+Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
+Copyright (c) 2018 Gerasim Troeglazov, 3dEyes@gmail.com
+*/
+
+#pragma once
+
+#include "platform/platform_notifications_manager.h"
+#include "window/notifications_utilities.h"
+
+#include <QProcess>
+#include <QThread>
+#include <QObject>
+
+#define NOTIFY_MESSAGE_DEEP 16
+#define NOTIFY_PORT_NAME "tg_notify"
+#define NOTIFY_GATE_NAME "/bin/tg-notify-gate"
+#define NOTIFY_MESSAGE 'TGNF'
+
+typedef struct notify_msg
+{
+ uint64 peerId;
+ int32 msgId;
+} notify_msg;
+
+namespace Platform {
+namespace Notifications {
+
+inline bool SkipAudio() {
+ return false;
+}
+
+inline bool SkipToast() {
+ return false;
+}
+
+inline void FlashBounce() {
+}
+
+void Finish();
+
+class NotifyReader:public QObject {
+ Q_OBJECT
+public:
+ NotifyReader();
+ ~NotifyReader();
+public slots:
+ void run();
+signals:
+ void notificationActivated(PeerId peerId, MsgId msgId);
+private:
+ int32 portId;
+};
+
+
+class Manager : public Window::Notifications::NativeManager {
+public:
+ Manager(Window::Notifications::System *system);
+
+ bool init();
+
+ void clearNotification(PeerId peerId, MsgId msgId);
+
+ ~Manager();
+
+protected:
+ void doShowNativeNotification(PeerData *peer, MsgId msgId, const QString &title, \
+ const QString &subtitle, const QString &msg, bool hideNameAndPhoto, bool hideReplyButton) override;
+ void doClearAllFast() override;
+ void doClearFromHistory(History *history) override;
+ void onBeforeNotificationActivated(PeerId peerId, MsgId msgId) override;
+ void onAfterNotificationActivated(PeerId peerId, MsgId msgId) override;
+
+ bool hasActionsSupport() const;
+
+private:
+ class Private;
+ const std::unique_ptr<Private> _private;
+};
+
+class Manager::Private : public QObject {
+ Q_OBJECT
+public:
+ using Type = Window::Notifications::CachedUserpics::Type;
+ explicit Private(Manager *instance, Type type);
+ bool init();
+
+ bool showNotification(PeerData *peer, MsgId msgId, const QString &title, const QString &subtitle, \
+ const QString &msg, bool hideNameAndPhoto, bool hideReplyButton);
+ void clearAll();
+ void clearFromHistory(History *history);
+ void beforeNotificationActivated(PeerId peerId, MsgId msgId);
+ void afterNotificationActivated(PeerId peerId, MsgId msgId);
+ void clearNotification(PeerId peerId, MsgId msgId);
+
+ bool hasActionsSupport() const {
+ return true;
+ }
+
+ void performOnMainQueue(FnMut<void(Manager *manager)> task) {
+ const auto weak = _weak;
+ crl::on_main(weak, [=, task = std::move(task)]() mutable {
+ task(*weak.lock());
+ });
+ }
+
+ ~Private();
+public slots:
+ void notificationActivatedSlot(PeerId peerId, MsgId msgId);
+private:
+ Window::Notifications::CachedUserpics _cachedUserpics;
+ std::shared_ptr<Manager*> _guarded;
+ std::weak_ptr<Manager*> _weak;
+ QThread *portReaderThread;
+ NotifyReader *portReader;
+};
+
+} // namespace Notifications
+} // namespace Platform
diff --git a/Telegram/SourceFiles/platform/haiku/specific_haiku.cpp b/Telegram/SourceFiles/platform/haiku/specific_haiku.cpp
new file mode 100644
index 0000000..5acf791
--- /dev/null
+++ b/Telegram/SourceFiles/platform/haiku/specific_haiku.cpp
@@ -0,0 +1,431 @@
+/*
+This file is part of Telegram Desktop for Haiku,
+
+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.
+
+Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
+Copyright (c) 2018 Gerasim Troeglazov, 3dEyes@gmail.com
+*/
+
+#include "platform/haiku/specific_haiku.h"
+
+#include "lang/lang_keys.h"
+#include "mainwidget.h"
+#include "mainwindow.h"
+#include "storage/localstorage.h"
+#include "platform/haiku/file_utilities_haiku.h"
+
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <cstdlib>
+#include <unistd.h>
+#include <dirent.h>
+#include <pwd.h>
+
+#include <iostream>
+
+#include <qpa/qplatformnativeinterface.h>
+
+using namespace Platform;
+
+using Platform::File::internal::EscapeShell;
+
+namespace Platform {
+
+QString CurrentExecutablePath(int argc, char *argv[]) {
+ return argc ? QFile::decodeName(argv[0]) : QString();
+}
+
+} // namespace Platform
+
+namespace {
+
+class _PsEventFilter : public QAbstractNativeEventFilter {
+public:
+ bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) {
+ //auto wnd = App::wnd();
+ //if (!wnd) return false;
+
+ return false;
+ }
+};
+_PsEventFilter *_psEventFilter = nullptr;
+
+QRect _monitorRect;
+auto _monitorLastGot = 0LL;
+
+} // namespace
+
+QRect psDesktopRect() {
+ auto tnow = getms();
+ if (tnow > _monitorLastGot + 1000LL || tnow < _monitorLastGot) {
+ _monitorLastGot = tnow;
+ _monitorRect = QApplication::desktop()->availableGeometry(App::wnd());
+ }
+ return _monitorRect;
+}
+
+void psShowOverAll(QWidget *w, bool canFocus) {
+ w->show();
+}
+
+void psBringToBack(QWidget *w) {
+ w->hide();
+}
+
+QAbstractNativeEventFilter *psNativeEventFilter() {
+ delete _psEventFilter;
+ _psEventFilter = new _PsEventFilter();
+ return _psEventFilter;
+}
+
+void psWriteDump() {
+}
+
+QString demanglestr(const QString &mangled) {
+ if (mangled.isEmpty()) return mangled;
+
+ QByteArray cmd = ("c++filt -n " + mangled).toUtf8();
+ FILE *f = popen(cmd.constData(), "r");
+ if (!f) return "BAD_SYMBOL_" + mangled;
+
+ QString result;
+ char buffer[4096] = { 0 };
+ while (!feof(f)) {
+ if (fgets(buffer, 4096, f) != NULL) {
+ result += buffer;
+ }
+ }
+ pclose(f);
+ return result.trimmed();
+}
+
+QStringList addr2linestr(uint64 *addresses, int count) {
+ QStringList result;
+ if (!count || cExeName().isEmpty()) return result;
+
+ result.reserve(count);
+ QByteArray cmd = "addr2line -e " + EscapeShell(QFile::encodeName(cExeDir() + cExeName()));
+ for (int i = 0; i < count; ++i) {
+ if (addresses[i]) {
+ cmd += qsl(" 0x%1").arg(addresses[i], 0, 16).toUtf8();
+ }
+ }
+ FILE *f = popen(cmd.constData(), "r");
+
+ QStringList addr2lineResult;
+ if (f) {
+ char buffer[4096] = {0};
+ while (!feof(f)) {
+ if (fgets(buffer, 4096, f) != NULL) {
+ addr2lineResult.push_back(QString::fromUtf8(buffer));
+ }
+ }
+ pclose(f);
+ }
+ for (int i = 0, j = 0; i < count; ++i) {
+ if (addresses[i]) {
+ if (j < addr2lineResult.size() && !addr2lineResult.at(j).isEmpty() && !addr2lineResult.at(j).startsWith(qstr("0x"))) {
+ QString res = addr2lineResult.at(j).trimmed();
+ if (int index = res.indexOf(qstr("/Telegram/"))) {
+ if (index > 0) {
+ res = res.mid(index + qstr("/Telegram/").size());
+ }
+ }
+ result.push_back(res);
+ } else {
+ result.push_back(QString());
+ }
+ ++j;
+ } else {
+ result.push_back(QString());
+ }
+ }
+ return result;
+}
+
+QString psPrepareCrashDump(const QByteArray &crashdump, QString dumpfile) {
+ QString initial = QString::fromUtf8(crashdump), result;
+ QStringList lines = initial.split('\n');
+ result.reserve(initial.size());
+ int32 i = 0, l = lines.size();
+
+ while (i < l) {
+ uint64 addresses[1024] = { 0 };
+ for (; i < l; ++i) {
+ result.append(lines.at(i)).append('\n');
+ QString line = lines.at(i).trimmed();
+ if (line == qstr("Backtrace:")) {
+ ++i;
+ break;
+ }
+ }
+
+ int32 start = i;
+ for (; i < l; ++i) {
+ QString line = lines.at(i).trimmed();
+ if (line.isEmpty()) break;
+
+ QRegularExpressionMatch m1 = QRegularExpression(qsl("^(.+)\\(([^+]+)\\+([^\\)]+)\\)\\[(.+)\\]$")).match(line);
+ QRegularExpressionMatch m2 = QRegularExpression(qsl("^(.+)\\[(.+)\\]$")).match(line);
+ QString addrstr = m1.hasMatch() ? m1.captured(4) : (m2.hasMatch() ? m2.captured(2) : QString());
+ if (!addrstr.isEmpty()) {
+ uint64 addr = addrstr.startsWith(qstr("0x")) ? addrstr.mid(2).toULongLong(0, 16) : addrstr.toULongLong();
+ if (addr > 1) {
+ addresses[i - start] = addr;
+ }
+ }
+ }
+
+ QStringList addr2line = addr2linestr(addresses, i - start);
+ for (i = start; i < l; ++i) {
+ QString line = lines.at(i).trimmed();
+ if (line.isEmpty()) break;
+
+ result.append(qsl("\n%1. ").arg(i - start));
+ if (line.startsWith(qstr("ERROR: "))) {
+ result.append(line).append('\n');
+ continue;
+ }
+ if (line == qstr("[0x1]")) {
+ result.append(qsl("(0x1 separator)\n"));
+ continue;
+ }
+
+ QRegularExpressionMatch m1 = QRegularExpression(qsl("^(.+)\\(([^+]*)\\+([^\\)]+)\\)(.+)$")).match(line);
+ QRegularExpressionMatch m2 = QRegularExpression(qsl("^(.+)\\[(.+)\\]$")).match(line);
+ if (!m1.hasMatch() && !m2.hasMatch()) {
+ result.append(qstr("BAD LINE: ")).append(line).append('\n');
+ continue;
+ }
+
+ if (m1.hasMatch()) {
+ result.append(demanglestr(m1.captured(2))).append(qsl(" + ")).append(m1.captured(3)).append(qsl(" [")).append(m1.captured(1)).append(qsl("] "));
+ if (!addr2line.at(i - start).isEmpty() && addr2line.at(i - start) != qsl("??:0")) {
+ result.append(qsl(" (")).append(addr2line.at(i - start)).append(qsl(")\n"));
+ } else {
+ result.append(m1.captured(4)).append(qsl(" (demangled)")).append('\n');
+ }
+ } else {
+ result.append('[').append(m2.captured(1)).append(']');
+ if (!addr2line.at(i - start).isEmpty() && addr2line.at(i - start) != qsl("??:0")) {
+ result.append(qsl(" (")).append(addr2line.at(i - start)).append(qsl(")\n"));
+ } else {
+ result.append(' ').append(m2.captured(2)).append('\n');
+ }
+ }
+ }
+ }
+ return result;
+}
+
+bool _removeDirectory(const QString &path) { // from http://stackoverflow.com/questions/2256945/removing-a-non-empty-directory-programmatically-in-c-or-c
+ QByteArray pathRaw = QFile::encodeName(path);
+ DIR *d = opendir(pathRaw.constData());
+ if (!d) return false;
+
+ while (struct dirent *p = readdir(d)) {
+ /* Skip the names "." and ".." as we don't want to recurse on them. */
+ if (!strcmp(p->d_name, ".") || !strcmp(p->d_name, "..")) continue;
+
+ QString fname = path + '/' + p->d_name;
+ QByteArray fnameRaw = QFile::encodeName(fname);
+ struct stat statbuf;
+ if (!stat(fnameRaw.constData(), &statbuf)) {
+ if (S_ISDIR(statbuf.st_mode)) {
+ if (!_removeDirectory(fname)) {
+ closedir(d);
+ return false;
+ }
+ } else {
+ if (unlink(fnameRaw.constData())) {
+ closedir(d);
+ return false;
+ }
+ }
+ }
+ }
+ closedir(d);
+
+ return !rmdir(pathRaw.constData());
+}
+
+void psDeleteDir(const QString &dir) {
+ _removeDirectory(dir);
+}
+
+namespace {
+
+auto _lastUserAction = 0LL;
+
+} // namespace
+
+void psUserActionDone() {
+ _lastUserAction = getms(true);
+}
+
+bool psIdleSupported() {
+ return false;
+}
+
+TimeMs psIdleTime() {
+ return getms(true) - _lastUserAction;
+}
+
+void psActivateProcess(uint64 pid) {
+// objc_activateProgram();
+}
+
+
+QString psAppDataPath() {
+ return QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + '/';
+}
+
+QString psDownloadPath() {
+ return QStandardPaths::writableLocation(QStandardPaths::DownloadLocation) + '/' + str_const_toString(AppName) + '/';
+}
+
+void psDoCleanup() {
+ try {
+ psAutoStart(false, true);
+ psSendToMenu(false, true);
+ } catch (...) {
+ }
+}
+
+int psCleanup() {
+ psDoCleanup();
+ return 0;
+}
+
+void psDoFixPrevious() {
+}
+
+int psFixPrevious() {
+ psDoFixPrevious();
+ return 0;
+}
+
+namespace Platform {
+
+void start() {
+}
+
+void finish() {
+}
+
+bool TranslucentWindowsSupported(QPoint globalPosition) {
+ return false;
+}
+
+bool IsApplicationActive() {
+ return static_cast<QApplication*>(QApplication::instance())->activeWindow() != nullptr;
+}
+
+void SetApplicationIcon(const QIcon &icon) {
+ qApp->setWindowIcon(icon);
+}
+
+QString SystemCountry() {
+ return QString();
+}
+
+QString SystemLanguage() {
+ return QString();
+}
+
+void RegisterCustomScheme() {
+}
+
+PermissionStatus GetPermissionStatus(PermissionType type){
+ return PermissionStatus::Granted;
+}
+
+void RequestPermission(PermissionType type, Fn<void(PermissionStatus)> resultCallback){
+ resultCallback(PermissionStatus::Granted);
+}
+
+void OpenSystemSettingsForPermission(PermissionType type){
+}
+
+bool OpenSystemSettings(SystemSettingsType type) {
+ if (type == SystemSettingsType::Audio) {
+ auto options = std::vector<QString>();
+ const auto add = [&](const char *option) {
+ options.emplace_back(option);
+ };
+ add("Media");
+ return ranges::find_if(options, [](const QString &command) {
+ return QProcess::startDetached(command);
+ }) != end(options);
+ }
+ return true;
+}
+
+namespace ThirdParty {
+
+void start() {
+}
+
+void finish() {
+}
+
+} // namespace ThirdParty
+
+} // namespace Platform
+
+namespace {
+
+bool _psRunCommand(const QByteArray &command) {
+ auto result = system(command.constData());
+ if (result) {
+ DEBUG_LOG(("App Error: command failed, code: %1, command (in utf8): %2").arg(result).arg(command.constData()));
+ return false;
+ }
+ DEBUG_LOG(("App Info: command succeeded, command (in utf8): %1").arg(command.constData()));
+ return true;
+}
+
+} // namespace
+
+void psRegisterCustomScheme() {
+}
+
+void psNewVersion() {
+ Platform::RegisterCustomScheme();
+}
+
+bool _execUpdater(bool update = true, const QString &crashreport = QString()) {
+ return false;
+}
+
+void psExecUpdater() {
+}
+
+void psExecTelegram(const QString &crashreport) {
+ _execUpdater(false, crashreport);
+}
+
+bool psShowOpenWithMenu(int x, int y, const QString &file) {
+ return false;
+}
+
+void psAutoStart(bool start, bool silent) {
+}
+
+void psSendToMenu(bool send, bool silent) {
+}
+
+void psUpdateOverlayed(QWidget *widget) {
+}
+
+bool psLaunchMaps(const LocationCoords &coords) {
+ return false;
+}
diff --git a/Telegram/SourceFiles/platform/haiku/specific_haiku.h b/Telegram/SourceFiles/platform/haiku/specific_haiku.h
new file mode 100644
index 0000000..a9cc589
--- /dev/null
+++ b/Telegram/SourceFiles/platform/haiku/specific_haiku.h
@@ -0,0 +1,120 @@
+/*
+This file is part of Telegram Desktop for Haiku,
+
+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.
+
+Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
+Copyright (c) 2018 Gerasim Troeglazov, 3dEyes@gmail.com
+*/
+
+#pragma once
+
+#include <signal.h>
+
+class LocationCoords;
+
+namespace Platform {
+
+inline void SetWatchingMediaKeys(bool watching) {
+}
+
+inline void StartTranslucentPaint(QPainter &p, QPaintEvent *e) {
+}
+
+inline void InitOnTopPanel(QWidget *panel) {
+}
+
+inline void DeInitOnTopPanel(QWidget *panel) {
+}
+
+inline void ReInitOnTopPanel(QWidget *panel) {
+}
+
+QString CurrentExecutablePath(int argc, char *argv[]);
+
+} // namespace Platform
+
+inline QString psServerPrefix() {
+ return qsl("/tmp/");
+}
+inline void psCheckLocalSocket(const QString &serverName) {
+ QFile address(serverName);
+ if (address.exists()) {
+ address.remove();
+ }
+}
+
+void psWriteDump();
+QString psPrepareCrashDump(const QByteArray &crashdump, QString dumpfile);
+
+void psDeleteDir(const QString &dir);
+
+void psUserActionDone();
+bool psIdleSupported();
+TimeMs psIdleTime();
+
+QStringList psInitLogs();
+void psClearInitLogs();
+
+void psActivateProcess(uint64 pid = 0);
+QString psLocalServerPrefix();
+QString psAppDataPath();
+QString psDownloadPath();
+void psAutoStart(bool start, bool silent = false);
+void psSendToMenu(bool send, bool silent = false);
+
+QRect psDesktopRect();
+void psShowOverAll(QWidget *w, bool canFocus = true);
+void psBringToBack(QWidget *w);
+
+int psCleanup();
+int psFixPrevious();
+
+void psExecUpdater();
+void psExecTelegram(const QString &arg = QString());
+
+QAbstractNativeEventFilter *psNativeEventFilter();
+
+void psNewVersion();
+
+void psUpdateOverlayed(QWidget *widget);
+inline QByteArray psDownloadPathBookmark(const QString &path) {
+ return QByteArray();
+}
+inline QByteArray psPathBookmark(const QString &path) {
+ return QByteArray();
+}
+inline void psDownloadPathEnableAccess() {
+}
+
+class PsFileBookmark {
+public:
+ PsFileBookmark(const QByteArray &bookmark) {
+ }
+ bool check() const {
+ return true;
+ }
+ bool enable() const {
+ return true;
+ }
+ void disable() const {
+ }
+ const QString &name(const QString &original) const {
+ return original;
+ }
+ QByteArray bookmark() const {
+ return QByteArray();
+ }
+
+};
+
+//ool linuxMoveFile(const char *from, const char *to);
+
+bool psLaunchMaps(const LocationCoords &coords);
diff --git a/Telegram/SourceFiles/platform/platform_audio.h b/Telegram/SourceFiles/platform/platform_audio.h
index 7705b2e..cfc1fc9 100644
--- a/Telegram/SourceFiles/platform/platform_audio.h
+++ b/Telegram/SourceFiles/platform/platform_audio.h
@@ -19,7 +19,7 @@ void DeInit();
// Platform dependent implementations.
-#if defined Q_OS_MAC || defined Q_OS_LINUX
+#if defined Q_OS_MAC || defined Q_OS_LINUX || defined(Q_OS_HAIKU)
namespace Platform {
namespace Audio {
diff --git a/Telegram/SourceFiles/platform/platform_file_utilities.h b/Telegram/SourceFiles/platform/platform_file_utilities.h
index 68b1058..2839790 100644
--- a/Telegram/SourceFiles/platform/platform_file_utilities.h
+++ b/Telegram/SourceFiles/platform/platform_file_utilities.h
@@ -47,6 +47,8 @@ bool Get(
#include "platform/mac/file_utilities_mac.h"
#elif defined Q_OS_LINUX // Q_OS_MAC
#include "platform/linux/file_utilities_linux.h"
+#elif defined Q_OS_HAIKU // Q_OS_LINUX
+#include "platform/haiku/file_utilities_haiku.h"
#elif defined Q_OS_WINRT || defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX
#include "platform/win/file_utilities_win.h"
#endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WINRT || Q_OS_WIN
diff --git a/Telegram/SourceFiles/platform/platform_launcher.h b/Telegram/SourceFiles/platform/platform_launcher.h
index 27180d0..953b47f 100644
--- a/Telegram/SourceFiles/platform/platform_launcher.h
+++ b/Telegram/SourceFiles/platform/platform_launcher.h
@@ -25,6 +25,8 @@ namespace Platform {
#include "platform/mac/launcher_mac.h"
#elif defined Q_OS_LINUX // Q_OS_MAC
#include "platform/linux/launcher_linux.h"
+#elif defined Q_OS_HAIKU
+#include "platform/haiku/launcher_haiku.h"
#elif defined Q_OS_WINRT || defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX
#include "platform/win/launcher_win.h"
#endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WINRT || Q_OS_WIN
diff --git a/Telegram/SourceFiles/platform/platform_main_window.h b/Telegram/SourceFiles/platform/platform_main_window.h
index 33277c9..4e28b24 100644
--- a/Telegram/SourceFiles/platform/platform_main_window.h
+++ b/Telegram/SourceFiles/platform/platform_main_window.h
@@ -21,6 +21,8 @@ class MainWindow;
#include "platform/mac/main_window_mac.h"
#elif defined Q_OS_LINUX // Q_OS_MAC
#include "platform/linux/main_window_linux.h"
-#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX
+#elif defined Q_OS_HAIKU // Q_OS_MAC || Q_OS_LINUX
+#include "platform/haiku/main_window_haiku.h"
+#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX || Q_OS_HAIKU
#include "platform/win/main_window_win.h"
#endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WIN
diff --git a/Telegram/SourceFiles/platform/platform_notifications_manager.h b/Telegram/SourceFiles/platform/platform_notifications_manager.h
index 692f4b4..a40f830 100644
--- a/Telegram/SourceFiles/platform/platform_notifications_manager.h
+++ b/Telegram/SourceFiles/platform/platform_notifications_manager.h
@@ -28,6 +28,8 @@ void FlashBounce();
#include "platform/mac/notifications_manager_mac.h"
#elif defined Q_OS_LINUX // Q_OS_MAC
#include "platform/linux/notifications_manager_linux.h"
+#elif defined Q_OS_HAIKU // Q_OS_LINUX
+#include "platform/haiku/notifications_manager_haiku.h"
#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX
#include "platform/win/notifications_manager_win.h"
#endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WIN
diff --git a/Telegram/SourceFiles/platform/platform_specific.h b/Telegram/SourceFiles/platform/platform_specific.h
index 848ff21..dbc0076 100644
--- a/Telegram/SourceFiles/platform/platform_specific.h
+++ b/Telegram/SourceFiles/platform/platform_specific.h
@@ -55,6 +55,8 @@ void finish();
#include "platform/mac/specific_mac.h"
#elif defined Q_OS_LINUX // Q_OS_MAC
#include "platform/linux/specific_linux.h"
-#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX
+#elif defined Q_OS_HAIKU // Q_OS_MAC || Q_OS_LINUX
+#include "platform/haiku/specific_haiku.h"
+#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX || Q_OS_HAIKU
#include "platform/win/specific_win.h"
#endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WIN
diff --git a/Telegram/SourceFiles/platform/platform_window_title.h b/Telegram/SourceFiles/platform/platform_window_title.h
index 7aed20b..dc0212c 100644
--- a/Telegram/SourceFiles/platform/platform_window_title.h
+++ b/Telegram/SourceFiles/platform/platform_window_title.h
@@ -25,7 +25,7 @@ void PreviewWindowFramePaint(QImage &preview, const style::palette &palette, QRe
#include "platform/mac/window_title_mac.h"
#elif defined Q_OS_WIN // Q_OS_MAC
#include "platform/win/window_title_win.h"
-#elif defined Q_OS_WINRT || defined Q_OS_LINUX // Q_OS_MAC || Q_OS_WIN
+#elif defined Q_OS_WINRT || defined Q_OS_LINUX || defined Q_OS_HAIKU // Q_OS_MAC || Q_OS_WIN
namespace Platform {
diff --git a/Telegram/SourceFiles/rpl/operators_tests.cpp b/Telegram/SourceFiles/rpl/operators_tests.cpp
index 548057f..feee15e 100644
--- a/Telegram/SourceFiles/rpl/operators_tests.cpp
+++ b/Telegram/SourceFiles/rpl/operators_tests.cpp
@@ -5,7 +5,11 @@ the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
+#if !defined(Q_OS_HAIKU)
#include "catch.hpp"
+#else
+#include "../ThirdParty/variant/test/include/catch.hpp"
+#endif
#include <rpl/rpl.h>
#include <string>
diff --git a/Telegram/SourceFiles/rpl/producer_tests.cpp b/Telegram/SourceFiles/rpl/producer_tests.cpp
index 0267f92..0e783b0 100644
--- a/Telegram/SourceFiles/rpl/producer_tests.cpp
+++ b/Telegram/SourceFiles/rpl/producer_tests.cpp
@@ -5,7 +5,11 @@ the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
+#if !defined(Q_OS_HAIKU)
#include "catch.hpp"
+#else
+#include "../ThirdParty/variant/test/include/catch.hpp"
+#endif
#include <rpl/producer.h>
#include <rpl/event_stream.h>
diff --git a/Telegram/SourceFiles/rpl/variable_tests.cpp b/Telegram/SourceFiles/rpl/variable_tests.cpp
index 9c697fc..36ddf56 100644
--- a/Telegram/SourceFiles/rpl/variable_tests.cpp
+++ b/Telegram/SourceFiles/rpl/variable_tests.cpp
@@ -5,7 +5,11 @@ the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
+#if !defined(Q_OS_HAIKU)
#include "catch.hpp"
+#else
+#include "../ThirdParty/variant/test/include/catch.hpp"
+#endif
#include <rpl/rpl.h>
#include <string>
diff --git a/Telegram/SourceFiles/settings.cpp b/Telegram/SourceFiles/settings.cpp
index 28d9988..98607b4 100644
--- a/Telegram/SourceFiles/settings.cpp
+++ b/Telegram/SourceFiles/settings.cpp
@@ -73,6 +73,8 @@ DBIPlatform gPlatform = dbipWindows;
DBIPlatform gPlatform = dbipMacOld;
#elif defined Q_OS_MAC
DBIPlatform gPlatform = dbipMac;
+#elif defined Q_OS_HAIKU
+DBIPlatform gPlatform = dbipHaiku;
#elif defined Q_OS_LINUX64
DBIPlatform gPlatform = dbipLinux64;
#elif defined Q_OS_LINUX32
diff --git a/Telegram/SourceFiles/settings/settings_notifications.cpp b/Telegram/SourceFiles/settings/settings_notifications.cpp
index 91efa99..344723c 100644
--- a/Telegram/SourceFiles/settings/settings_notifications.cpp
+++ b/Telegram/SourceFiles/settings/settings_notifications.cpp
@@ -584,6 +584,8 @@ void SetupNotificationsContent(not_null<Ui::VerticalLayout*> container) {
return LangKey();
} else if (cPlatform() == dbipWindows) {
return lng_settings_use_windows;
+ } else if (cPlatform() == dbipHaiku) {
+ return lng_settings_use_native_notifications;
} else if (cPlatform() == dbipLinux32
|| cPlatform() == dbipLinux64) {
return lng_settings_use_native_notifications;
diff --git a/Telegram/SourceFiles/storage/storage_encrypted_file_tests.cpp b/Telegram/SourceFiles/storage/storage_encrypted_file_tests.cpp
index 4d522a9..1ca7dd0 100644
--- a/Telegram/SourceFiles/storage/storage_encrypted_file_tests.cpp
+++ b/Telegram/SourceFiles/storage/storage_encrypted_file_tests.cpp
@@ -188,6 +188,7 @@ TEST_CASE("two process encrypted file", "[storage_encrypted_file]") {
constexpr auto kMaxPath = 1024;
char result[kMaxPath] = { 0 };
uint32_t size = kMaxPath;
+#ifndef Q_OS_HAIKU
#ifdef Q_OS_MAC
if (_NSGetExecutablePath(result, &size) == 0) {
return result;
@@ -198,6 +199,7 @@ TEST_CASE("two process encrypted file", "[storage_encrypted_file]") {
return result;
}
#endif // Q_OS_MAC
+#endif // Q_OS_HAIKU
return "tests_storage";
#endif // Q_OS_WIN
}();
diff --git a/Telegram/ThirdParty/minizip/ioapi.c b/Telegram/ThirdParty/minizip/ioapi.c
index 7f5c191..649255c 100644
--- a/Telegram/ThirdParty/minizip/ioapi.c
+++ b/Telegram/ThirdParty/minizip/ioapi.c
@@ -14,7 +14,7 @@
#define _CRT_SECURE_NO_WARNINGS
#endif
-#if defined(__APPLE__) || defined(IOAPI_NO_64)
+#if defined(__APPLE__) || defined(IOAPI_NO_64) || defined(__HAIKU__)
// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
#define FTELLO_FUNC(stream) ftello(stream)
diff --git a/Telegram/gyp/Telegram.gyp b/Telegram/gyp/Telegram.gyp
index 07193cf..e9244d0 100644
--- a/Telegram/gyp/Telegram.gyp
+++ b/Telegram/gyp/Telegram.gyp
@@ -61,6 +61,7 @@
'telegram_win.gypi',
'telegram_mac.gypi',
'telegram_linux.gypi',
+ 'telegram_haiku.gypi',
'openssl.gypi',
'qt.gypi',
'qt_moc.gypi',
@@ -95,7 +96,7 @@
'<(src_loc)',
'<(SHARED_INTERMEDIATE_DIR)',
'<(emoji_suggestions_loc)',
- '/usr/include/minizip',
+ '<(submodules_loc)/minizip',
'<(submodules_loc)/GSL/include',
'<(submodules_loc)/variant/include',
'<(submodules_loc)/crl/src',
diff --git a/Telegram/gyp/common.gypi b/Telegram/gyp/common.gypi
index eb90fe2..b12c1d6 100644
--- a/Telegram/gyp/common.gypi
+++ b/Telegram/gyp/common.gypi
@@ -8,6 +8,7 @@
'includes': [
'settings_win.gypi',
'settings_mac.gypi',
+ 'settings_haiku.gypi',
'settings_linux.gypi',
],
'variables': {
@@ -29,6 +30,11 @@
}, {
'build_mac': 0,
}],
+ [ 'build_os == "haiku"', {
+ 'build_haiku': 1,
+ }, {
+ 'build_haiku': 0,
+ }],
[ 'build_os == "linux"', {
'build_linux': 1,
}, {
@@ -40,11 +46,13 @@
'build_win%': '<(build_win)',
'build_mac%': '<(build_mac)',
'build_linux%': '<(build_linux)',
+ 'build_haiku%': '<(build_haiku)',
},
'build_os%': '<(build_os)',
'build_win%': '<(build_win)',
'build_mac%': '<(build_mac)',
'build_linux%': '<(build_linux)',
+ 'build_haiku%': '<(build_haiku)',
'official_build_target%': '',
},
@@ -52,6 +60,7 @@
'build_win%': '<(build_win)',
'build_mac%': '<(build_mac)',
'build_linux%': '<(build_linux)',
+ 'build_haiku%': '<(build_haiku)',
'official_build_target%': '<(official_build_target)',
# GYP does not support per-configuration libraries :(
diff --git a/Telegram/gyp/generate.py b/Telegram/gyp/generate.py
index 2326fa6..fb515ca 100644
--- a/Telegram/gyp/generate.py
+++ b/Telegram/gyp/generate.py
@@ -99,6 +99,11 @@ elif sys.platform == 'darwin':
gypScript = '../../../Libraries/gyp/gyp'
gypArguments.append('-Gxcode_upgrade_check_project_version=1010')
gypFormats.append('xcode')
+elif sys.platform == 'haiku1':
+ gypScript = 'gyp'
+ gypFormats.append('cmake')
+ cmakeConfigurations.append('Debug')
+ cmakeConfigurations.append('Release')
else:
gypScript = '../../../Libraries/gyp/gyp'
gypFormats.append('cmake')
diff --git a/Telegram/gyp/lib_base.gyp b/Telegram/gyp/lib_base.gyp
index 12dee1c..4876839 100644
--- a/Telegram/gyp/lib_base.gyp
+++ b/Telegram/gyp/lib_base.gyp
@@ -36,7 +36,7 @@
'include_dirs': [
'<(src_loc)',
'<(SHARED_INTERMEDIATE_DIR)',
- '<(libs_loc)/range-v3/include',
+ '<(submodules_loc)/range/include',
'<(submodules_loc)/GSL/include',
'<(submodules_loc)/variant/include',
'<(submodules_loc)/crl/src',
diff --git a/Telegram/gyp/lib_export.gyp b/Telegram/gyp/lib_export.gyp
index f73aabd..07c6b35 100644
--- a/Telegram/gyp/lib_export.gyp
+++ b/Telegram/gyp/lib_export.gyp
@@ -46,7 +46,7 @@
'include_dirs': [
'<(src_loc)',
'<(SHARED_INTERMEDIATE_DIR)',
- '<(libs_loc)/range-v3/include',
+ '<(submodules_loc)/range/include',
'<(submodules_loc)/GSL/include',
'<(submodules_loc)/variant/include',
'<(submodules_loc)/crl/src',
diff --git a/Telegram/gyp/lib_storage.gyp b/Telegram/gyp/lib_storage.gyp
index d72f4b5..e8740b9 100644
--- a/Telegram/gyp/lib_storage.gyp
+++ b/Telegram/gyp/lib_storage.gyp
@@ -41,7 +41,7 @@
'include_dirs': [
'<(src_loc)',
'<(SHARED_INTERMEDIATE_DIR)',
- '<(libs_loc)/range-v3/include',
+ '<(submodules_loc)/range/include',
'<(submodules_loc)/GSL/include',
'<(submodules_loc)/variant/include',
'<(submodules_loc)/crl/src',
diff --git a/Telegram/gyp/list_sources.py b/Telegram/gyp/list_sources.py
index 9efee62..d978ed6 100644
--- a/Telegram/gyp/list_sources.py
+++ b/Telegram/gyp/list_sources.py
@@ -113,6 +113,8 @@ if input_path != '':
platform_rules[file_path] = [ 'mac' ]
elif '/platform/linux/' in file_path:
platform_rules[file_path] = [ 'linux' ]
+ elif '/platform/haiku/' in file_path:
+ platform_rules[file_path] = [ 'haiku' ]
for replace in replaces:
replace_parts = replace.split('=', 1)
diff --git a/Telegram/gyp/qt.gypi b/Telegram/gyp/qt.gypi
index 3f91776..8f3e531 100644
--- a/Telegram/gyp/qt.gypi
+++ b/Telegram/gyp/qt.gypi
@@ -14,7 +14,7 @@
[ 'build_macold', {
'qt_version%': '5.3.2',
}, {
- 'qt_version%': '<!(echo /usr/include/qt/QtCore/*/ | grep -Po "\d+\.\d+\.\d+")',
+ 'qt_version%': '<!(pkg-config --modversion Qt5Core)',
}]
],
},
@@ -77,6 +77,15 @@
'Qt5Core',
],
}],
+ [ 'build_haiku', {
+ 'qt_lib_prefix': '',
+ 'qt_lib_debug_postfix': '',
+ 'qt_lib_release_postfix': '',
+ 'qt_libs': [
+ '<@(qt_libs)',
+ 'Qt5Core',
+ ],
+ }],
],
},
'qt_version%': '<(qt_version)',
@@ -152,14 +161,13 @@
},
'include_dirs': [
- '/usr/include/qt',
- '/usr/include/qt/QtCore',
- '/usr/include/qt/QtGui',
- '/usr/include/qt/QtDBus',
- '/usr/include/qt/QtCore/<(qt_version)',
- '/usr/include/qt/QtGui/<(qt_version)',
- '/usr/include/qt/QtCore/<(qt_version)/QtCore',
- '/usr/include/qt/QtGui/<(qt_version)/QtGui',
+ '@HAIKU_HEADERS@',
+ '@HAIKU_HEADERS@/QtCore',
+ '@HAIKU_HEADERS@/QtGui',
+ '@HAIKU_HEADERS@/QtCore/<(qt_version)',
+ '@HAIKU_HEADERS@/QtGui/<(qt_version)',
+ '@HAIKU_HEADERS@/QtCore/<(qt_version)/QtCore',
+ '@HAIKU_HEADERS@/QtGui/<(qt_version)/QtGui',
],
'library_dirs': [
'<(qt_loc)/lib',
@@ -199,6 +207,24 @@
'-rdynamic',
],
}],
+ [ 'build_haiku', {
+ 'library_dirs': [
+ '<(qt_loc)/plugins/platforminputcontexts',
+ ],
+ 'libraries': [
+ '<@(qt_libs_release)',
+ '-lcrypto',
+ '-lgthread-2.0',
+ '-lglib-2.0',
+ '-lroot',
+ ],
+ 'include_dirs': [
+ '<(qt_loc)/mkspecs/haiku-g++',
+ ],
+ 'ldflags': [
+ '-g',
+ ],
+ }],
[ 'build_mac', {
'xcode_settings': {
'OTHER_LDFLAGS': [
diff --git a/Telegram/gyp/qt_moc.gypi b/Telegram/gyp/qt_moc.gypi
index f350da8..f84a2d2 100644
--- a/Telegram/gyp/qt_moc.gypi
+++ b/Telegram/gyp/qt_moc.gypi
@@ -12,7 +12,7 @@
'<(SHARED_INTERMEDIATE_DIR)/<(_target_name)/moc/moc_<(RULE_INPUT_ROOT).cpp',
],
'action': [
- '/usr/bin/moc',
+ 'moc',
# Silence "Note: No relevant classes found. No output generated."
'--no-notes',
diff --git a/Telegram/gyp/qt_rcc.gypi b/Telegram/gyp/qt_rcc.gypi
index 1129a95..fd1e3bd 100644
--- a/Telegram/gyp/qt_rcc.gypi
+++ b/Telegram/gyp/qt_rcc.gypi
@@ -15,7 +15,7 @@
'<(SHARED_INTERMEDIATE_DIR)/<(_target_name)/qrc/qrc_<(RULE_INPUT_ROOT).cpp',
],
'action': [
- '/usr/bin/rcc',
+ 'rcc',
'-name', '<(RULE_INPUT_ROOT)',
'-no-compress',
'<(RULE_INPUT_PATH)',
diff --git a/Telegram/gyp/settings_haiku.gypi b/Telegram/gyp/settings_haiku.gypi
new file mode 100644
index 0000000..a1fe2c9
--- /dev/null
+++ b/Telegram/gyp/settings_haiku.gypi
@@ -0,0 +1,87 @@
+# This file is part of Telegram Desktop,
+# the official desktop version of Telegram messaging app, see https://telegram.org
+#
+# 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.
+#
+# In addition, as a special exception, the copyright holders give permission
+# to link the code of portions of this program with the OpenSSL library.
+#
+# Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
+# Copyright (c) 2014 John Preston, https://desktop.telegram.org
+
+{
+ 'conditions': [
+ [ 'build_haiku', {
+ 'variables': {
+ 'haiku_common_flags': [
+ '-pipe',
+ '-Wall',
+ '-W',
+ '-fPIC',
+ '-Wno-unused-variable',
+ '-Wno-unused-parameter',
+ '-Wno-unused-function',
+ '-Wno-switch',
+ '-Wno-comment',
+ '-Wno-unused-but-set-variable',
+ '-Wno-missing-field-initializers',
+ '-Wno-sign-compare',
+ ],
+ },
+ 'conditions': [
+ [ '"<!(uname -p)" == "x86_64"', {
+ 'defines': [
+ 'Q_OS_HAIKU',
+ 'TDESKTOP_DISABLE_CRASH_REPORTS',
+ 'TDESKTOP_DISABLE_AUTOUPDATE',
+ 'TDESKTOP_DISABLE_UNITY_INTEGRATION',
+ 'TDESKTOP_DISABLE_DESKTOP_FILE_GENERATION',
+ ],
+ 'conditions': [
+ [ '"<(official_build_target)" != "" and "<(official_build_target)" != "haiku"', {
+ 'sources': [ '__Wrong_Official_Build_Target_<(official_build_target)_' ],
+ }],
+ ],
+ }, {
+ 'defines': [
+ 'Q_OS_HAIKU',
+ 'TDESKTOP_DISABLE_CRASH_REPORTS',
+ 'TDESKTOP_DISABLE_AUTOUPDATE',
+ 'TDESKTOP_DISABLE_UNITY_INTEGRATION',
+ 'TDESKTOP_DISABLE_DESKTOP_FILE_GENERATION',
+ ],
+ 'conditions': [
+ [ '"<(official_build_target)" != "" and "<(official_build_target)" != "haiku"', {
+ 'sources': [ '__Wrong_Official_Build_Target_<(official_build_target)_' ],
+ }],
+ ],
+ }],
+ ],
+ 'defines': [
+ '_REENTRANT',
+ 'QT_PLUGIN',
+ ],
+ 'cflags_c': [
+ '<@(haiku_common_flags)',
+ '-std=gnu11',
+ ],
+ 'cflags_cc': [
+ '<@(haiku_common_flags)',
+ '-std=c++1z',
+ '-Wno-register',
+ ],
+ 'configurations': {
+ 'Debug': {
+ },
+ },
+ }],
+ ],
+}
diff --git a/Telegram/gyp/telegram_haiku.gypi b/Telegram/gyp/telegram_haiku.gypi
new file mode 100644
index 0000000..7c6f0b5
--- /dev/null
+++ b/Telegram/gyp/telegram_haiku.gypi
@@ -0,0 +1,73 @@
+# This file is part of Telegram Desktop,
+# the official desktop version of Telegram messaging app, see https://telegram.org
+#
+# 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.
+#
+# In addition, as a special exception, the copyright holders give permission
+# to link the code of portions of this program with the OpenSSL library.
+#
+# Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
+# Copyright (c) 2014 John Preston, https://desktop.telegram.org
+
+{
+ 'conditions': [[ 'build_haiku', {
+ 'variables': {
+ 'haiku_path_include%': '@HAIKU_HEADERS@',
+ 'haiku_path_lib%': '@HAIKU_LIBS@',
+ },
+ 'include_dirs': [
+ '<(haiku_path_include)',
+ '<(haiku_path_include)/openssl',
+ '<(haiku_path_include)/libavcodec',
+ '<(haiku_path_include)/AL',
+ '<(haiku_path_include)/breakpad',
+ '<(haiku_path_include)/opus',
+ '../ThirdParty/range/include',
+ ],
+ 'library_dirs': [
+ '<(haiku_path_lib)',
+ ],
+ 'libraries': [
+ 'openal',
+ 'avformat',
+ 'avcodec',
+ 'swresample',
+ 'swscale',
+ 'avutil',
+ 'media',
+ 'minizip',
+ 'opus',
+ 'network',
+ 'translation',
+ 'be',
+ 'lzma',
+ 'z',
+# '<!(pkg-config 2> /dev/null --libs <@(pkgconfig_libs))',
+ ],
+ 'configurations': {
+ 'Release': {
+ 'cflags': [
+ '-Ofast',
+ '-fno-strict-aliasing',
+ ],
+ 'cflags_cc': [
+ '-Ofast',
+ '-fno-strict-aliasing',
+ ],
+ 'ldflags': [
+ '-Ofast',
+ ],
+ },
+ },
+ 'cmake_precompiled_header': '<(src_loc)/stdafx.h',
+ 'cmake_precompiled_header_script': 'PrecompiledHeader.cmake',
+ }]],
+}
diff --git a/Telegram/gyp/telegram_qrc.gypi b/Telegram/gyp/telegram_qrc.gypi
index d9147d6..16c9d3f 100644
--- a/Telegram/gyp/telegram_qrc.gypi
+++ b/Telegram/gyp/telegram_qrc.gypi
@@ -25,6 +25,13 @@
],
}
}],
+ [ 'build_haiku', {
+ 'variables': {
+ 'qrc_files': [
+ '<(res_loc)/qrc/telegram_haiku.qrc',
+ ],
+ }
+ }],
[ 'build_mac', {
'variables': {
'qrc_files': [
diff --git a/Telegram/gyp/telegram_sources.txt b/Telegram/gyp/telegram_sources.txt
index 0e49bec..06ae892 100644
--- a/Telegram/gyp/telegram_sources.txt
+++ b/Telegram/gyp/telegram_sources.txt
@@ -539,6 +539,18 @@
<(src_loc)/platform/linux/notifications_manager_linux.h
<(src_loc)/platform/linux/specific_linux.cpp
<(src_loc)/platform/linux/specific_linux.h
+<(src_loc)/platform/haiku/file_utilities_haiku.cpp
+<(src_loc)/platform/haiku/file_utilities_haiku.h
+<(src_loc)/platform/haiku/haiku_desktop_environment.cpp
+<(src_loc)/platform/haiku/haiku_desktop_environment.h
+<(src_loc)/platform/haiku/launcher_haiku.cpp
+<(src_loc)/platform/haiku/launcher_haiku.h
+<(src_loc)/platform/haiku/notifications_manager_haiku.cpp
+<(src_loc)/platform/haiku/notifications_manager_haiku.h
+<(src_loc)/platform/haiku/main_window_haiku.cpp
+<(src_loc)/platform/haiku/main_window_haiku.h
+<(src_loc)/platform/haiku/specific_haiku.cpp
+<(src_loc)/platform/haiku/specific_haiku.h
<(src_loc)/platform/mac/file_utilities_mac.mm
<(src_loc)/platform/mac/file_utilities_mac.h
<(src_loc)/platform/mac/launcher_mac.mm
diff --git a/Telegram/gyp/utils.gyp b/Telegram/gyp/utils.gyp
index 622462e..e3ba800 100644
--- a/Telegram/gyp/utils.gyp
+++ b/Telegram/gyp/utils.gyp
@@ -82,6 +82,13 @@
'lzma',
],
}],
+ [ 'build_haiku', {
+ 'libraries': [
+ 'ssl',
+ 'crypto',
+ 'lzma',
+ ],
+ }],
[ 'build_mac', {
'include_dirs': [
'<(libs_loc)/openssl/include'
--
2.19.1
From 733717189728393b3fff7a14c4845df10d38130e Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sun, 3 Feb 2019 17:49:16 +1000
Subject: Fix build for hybrid
diff --git a/Telegram/SourceFiles/platform/haiku/notifications_manager_haiku.cpp b/Telegram/SourceFiles/platform/haiku/notifications_manager_haiku.cpp
index def91de..7747c72 100644
--- a/Telegram/SourceFiles/platform/haiku/notifications_manager_haiku.cpp
+++ b/Telegram/SourceFiles/platform/haiku/notifications_manager_haiku.cpp
@@ -14,8 +14,13 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2018 Gerasim Troeglazov, 3dEyes@gmail.com
*/
+#ifdef __x86_64__
#define int64 XXX
#define uint64 YYY
+#else
+#define int32 XXX
+#define uint32 YYY
+#endif
#include <stdio.h>
#include <unistd.h>
--
2.19.1