diff --git a/net-im/telegram-desktop/additional-files/demo_apikey.txt b/net-im/telegram-desktop/additional-files/demo_apikey.txt deleted file mode 100644 index 8cefe5e6e..000000000 --- a/net-im/telegram-desktop/additional-files/demo_apikey.txt +++ /dev/null @@ -1 +0,0 @@ ---api-id 17349 --api-hash 344583e45741c457fe1862106095a5eb diff --git a/net-im/telegram-desktop/patches/telegram_desktop-1.4.4-libtgvoip.patchset b/net-im/telegram-desktop/patches/telegram_desktop-1.4.4-libtgvoip.patchset deleted file mode 100644 index 220585afa..000000000 --- a/net-im/telegram-desktop/patches/telegram_desktop-1.4.4-libtgvoip.patchset +++ /dev/null @@ -1,1052 +0,0 @@ -From 15130ecca47fcbfd3e15c9ace71b00a669042202 Mon Sep 17 00:00:00 2001 -From: Gerasim Troeglazov <3dEyes@gmail.com> -Date: Sun, 10 Jun 2018 11:08:42 +1000 -Subject: Fix for using external opus lib - - -diff --git a/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/OpusDecoder.h b/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/OpusDecoder.h -index 6425c97..848b930 100644 ---- a/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/OpusDecoder.h -+++ b/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/OpusDecoder.h -@@ -9,7 +9,7 @@ - - - #include "MediaStreamItf.h" --#include "opus.h" -+#include - #include "threading.h" - #include "BlockingQueue.h" - #include "Buffers.h" -diff --git a/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/OpusEncoder.h b/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/OpusEncoder.h -index 4726f6b..92d8c33 100644 ---- a/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/OpusEncoder.h -+++ b/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/OpusEncoder.h -@@ -9,7 +9,7 @@ - - - #include "MediaStreamItf.h" --#include "opus.h" -+#include - #include "threading.h" - #include "BlockingQueue.h" - #include "Buffers.h" --- -2.16.4 - - -From b4be4f2018dcc71fee9682e1f20f2a75799d9902 Mon Sep 17 00:00:00 2001 -From: Gerasim Troeglazov <3dEyes@gmail.com> -Date: Sun, 10 Jun 2018 11:10:12 +1000 -Subject: Add haiku modules - - -diff --git a/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/VoIPController.cpp b/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/VoIPController.cpp -index 6d266a5..d08296a 100644 ---- a/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/VoIPController.cpp -+++ b/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/VoIPController.cpp -@@ -8,6 +8,9 @@ - #include - #include - #endif -+#ifdef __HAIKU__ -+#include -+#endif - #include - #include - #include -@@ -2404,6 +2407,10 @@ double VoIPController::GetCurrentTime(){ - struct timespec ts; - clock_gettime(CLOCK_MONOTONIC, &ts); - return ts.tv_sec+(double)ts.tv_nsec/1000000000.0; -+#elif defined(__HAIKU__) -+ struct timeval tm; -+ gettimeofday(&tm, NULL); -+ return tm.tv_sec+(double)tm.tv_usec/1000000.0; - #elif defined(__APPLE__) - static pthread_once_t token = PTHREAD_ONCE_INIT; - pthread_once(&token, &initMachTimestart); -diff --git a/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/audio/AudioInput.cpp b/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/audio/AudioInput.cpp -index 062ca06..887889e 100644 ---- a/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/audio/AudioInput.cpp -+++ b/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/audio/AudioInput.cpp -@@ -22,6 +22,8 @@ - #elif defined(__linux__) - #include "../os/linux/AudioInputALSA.h" - #include "../os/linux/AudioInputPulse.h" -+#elif defined(__HAIKU__) -+#include "../os/haiku/AudioInputHaiku.h" - #else - #error "Unsupported operating system" - #endif -@@ -64,6 +66,8 @@ AudioInput *AudioInput::Create(std::string deviceID, void* platformSpecific){ - LOGW("in: PulseAudio available but not working; trying ALSA"); - } - return new AudioInputALSA(deviceID); -+#elif defined(__HAIKU__) -+ return new AudioInputHaiku(deviceID); - #endif - } - -diff --git a/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/audio/AudioOutput.cpp b/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/audio/AudioOutput.cpp -index 109d24d..c3cc014 100644 ---- a/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/audio/AudioOutput.cpp -+++ b/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/audio/AudioOutput.cpp -@@ -25,6 +25,8 @@ - #elif defined(__linux__) - #include "../os/linux/AudioOutputALSA.h" - #include "../os/linux/AudioOutputPulse.h" -+#elif defined(__HAIKU__) -+#include "../os/haiku/AudioOutputHaiku.h" - #else - #error "Unsupported operating system" - #endif -@@ -59,6 +61,9 @@ std::unique_ptr AudioOutput::Create(std::string deviceID, void* pla - LOGW("out: PulseAudio available but not working; trying ALSA"); - } - return std::unique_ptr(new AudioOutputALSA(deviceID)); -+#elif defined(__HAIKU__) -+ LOGW("out: MediaKitAudio enabled"); -+ return std::unique_ptr(new AudioOutputHaiku(deviceID)); - #endif - } - -diff --git a/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/libtgvoip.gyp b/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/libtgvoip.gyp -index f236987..24f017b 100644 ---- a/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/libtgvoip.gyp -+++ b/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/libtgvoip.gyp -@@ -100,6 +100,14 @@ - '<(tgvoip_src_loc)/os/linux/PulseAudioLoader.cpp', - '<(tgvoip_src_loc)/os/linux/PulseAudioLoader.h', - -+ # Haiku -+ '<(tgvoip_src_loc)/os/haiku/AudioInputHaiku.cpp', -+ '<(tgvoip_src_loc)/os/haiku/AudioInputHaiku.h', -+ '<(tgvoip_src_loc)/os/haiku/AudioOutputHaiku.cpp', -+ '<(tgvoip_src_loc)/os/haiku/AudioOutputHaiku.h', -+ '<(tgvoip_src_loc)/os/haiku/RingBuffer.cpp', -+ '<(tgvoip_src_loc)/os/haiku/RingBuffer.h', -+ - # POSIX - '<(tgvoip_src_loc)/os/posix/NetworkSocketPosix.cpp', - '<(tgvoip_src_loc)/os/posix/NetworkSocketPosix.h', -@@ -253,6 +261,11 @@ - 'sources/': [['exclude', '<(tgvoip_src_loc)/os/posix/']], - }, - ], -+ [ -+ '"<(OS)" != "haiku"', { -+ 'sources/': [['exclude', '<(tgvoip_src_loc)/os/haiku/']], -+ }, -+ ], - [ - '"<(OS)" != "mac"', { - 'sources/': [['exclude', '<(tgvoip_src_loc)/os/darwin/']], -@@ -378,6 +391,21 @@ - }, - ], - [ -+ '"<(OS)" == "haiku"', { -+ 'defines': [ -+ 'WEBRTC_POSIX', -+ ], -+ 'cflags_cc': [ -+ '-msse2', -+ '-std=gnu++14', -+ ], -+ 'direct_dependent_settings': { -+ 'libraries': [ -+ -+ ], -+ }, -+ }, -+ ], [ - '"<(OS)" == "linux"', { - 'defines': [ - 'WEBRTC_POSIX', -diff --git a/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/haiku/AudioInputHaiku.cpp b/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/haiku/AudioInputHaiku.cpp -new file mode 100644 -index 0000000..ce54b6e ---- /dev/null -+++ b/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/haiku/AudioInputHaiku.cpp -@@ -0,0 +1,198 @@ -+// -+// libtgvoip is free and unencumbered public domain software. -+// For more information, see http://unlicense.org or the UNLICENSE file -+// you should have received with this source code distribution. -+// -+ -+#include -+#include -+#include -+#include -+#include "AudioInputHaiku.h" -+#include "../../logging.h" -+#include "../../VoIPController.h" -+ -+#include "RingBuffer.h" -+ -+#define BUFFER_SIZE 960 -+ -+using namespace tgvoip::audio; -+ -+void RecordFile(void* cookie, bigtime_t timestamp, void* data, size_t size, const media_format &format) -+{ -+ AudioInputHaiku *obj = (AudioInputHaiku*)cookie; -+ if (!obj->IsRecording()) -+ return; -+ if (format.u.raw_audio.channel_count == 1) { -+ obj->fRingBuffer->Write((unsigned char*)data, size); -+ } else if (format.u.raw_audio.channel_count == 2) { -+ unsigned char *s = (unsigned char*)data; -+ for (int i=0; ifRingBuffer->Write(s, 2); -+ } -+ -+} -+ -+void NotifyRecordFile(void * cookie, BMediaRecorder::notification code, ...) -+{ -+ if (code == BMediaRecorder::B_WILL_STOP) { -+ } -+} -+ -+AudioInputHaiku::AudioInputHaiku(std::string devID) -+{ -+ fRecorder = NULL; -+ fRingBuffer = NULL; -+ isRecording = false; -+ -+ status_t error; -+ -+ fRoster = BMediaRoster::Roster(&error); -+ if (!fRoster) { -+ failed=true; -+ return; -+ } -+ error = fRoster->GetAudioInput(&fAudioInputNode); -+ if (error < B_OK) { -+ failed=true; -+ return; -+ } -+ error = fRoster->GetAudioMixer(&fAudioMixerNode); -+ if (error < B_OK) { -+ failed=true; -+ return; -+ } -+ fRecorder = new BMediaRecorder("Telegram", B_MEDIA_RAW_AUDIO); -+ if (fRecorder->InitCheck() < B_OK) { -+ failed=true; -+ return; -+ } -+ media_format output_format; -+ output_format.type = B_MEDIA_RAW_AUDIO; -+ output_format.u.raw_audio = media_raw_audio_format::wildcard; -+ output_format.u.raw_audio.channel_count = 1; -+ fRecorder->SetAcceptedFormat(output_format); -+ -+ const int maxInputCount = 64; -+ dormant_node_info dni[maxInputCount]; -+ -+ int32 real_count = maxInputCount; -+ -+ error = fRoster->GetDormantNodes(dni, &real_count, 0, &output_format, 0, B_BUFFER_PRODUCER | B_PHYSICAL_INPUT); -+ if (real_count > maxInputCount) -+ real_count = maxInputCount; -+ char selected_name[B_MEDIA_NAME_LENGTH] = "Default input"; -+ -+ for (int i = 0; i < real_count; i++) { -+ media_node_id ni[12]; -+ int32 ni_count = 12; -+ error = fRoster->GetInstancesFor(dni[i].addon, dni[i].flavor_id, ni, &ni_count); -+ if (error == B_OK) { -+ for (int j = 0; j < ni_count; j++) { -+ if (ni[j] == fAudioInputNode.node) { -+ strcpy(selected_name, dni[i].name); -+ break; -+ } -+ } -+ } -+ } -+ -+ media_output audioOutput; -+ if (!fRecorder->IsConnected()) { -+ int32 count = 0; -+ error = fRoster->GetFreeOutputsFor(fAudioInputNode, &audioOutput, 1, &count, B_MEDIA_RAW_AUDIO); -+ if (error < B_OK) { -+ failed=true; -+ return; -+ } -+ -+ if (count < 1) { -+ failed=true; -+ return; -+ } -+ fRecordFormat.u.raw_audio = audioOutput.format.u.raw_audio; -+ } else { -+ fRecordFormat.u.raw_audio = fRecorder->AcceptedFormat().u.raw_audio; -+ } -+ fRecordFormat.type = B_MEDIA_RAW_AUDIO; -+ -+ error = fRecorder->SetHooks(RecordFile, NotifyRecordFile, this); -+ if (error < B_OK) { -+ failed=true; -+ return; -+ } -+ -+ if (!fRecorder->IsConnected()) { -+ error = fRecorder->Connect(fAudioInputNode, &audioOutput, &fRecordFormat); -+ if (error < B_OK) { -+ fRecorder->SetHooks(NULL, NULL, NULL); -+ failed=true; -+ return; -+ } -+ } -+ -+ fRingBuffer = new RingBuffer(BUFFER_SIZE * 2 * 3); -+ if (fRingBuffer->InitCheck() != B_OK) { -+ failed=true; -+ return; -+ } -+} -+ -+AudioInputHaiku::~AudioInputHaiku(){ -+ if (fRecorder != NULL) { -+ if (fRecorder->InitCheck() == B_OK) { -+ if (fRecorder->IsConnected()) -+ fRecorder->Disconnect(); -+ } -+ delete fRecorder; -+ } -+ if (fRingBuffer != NULL) -+ delete fRingBuffer; -+} -+ -+void AudioInputHaiku::Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels){ -+ -+} -+ -+bool AudioInputHaiku::IsRecording(){ -+ return isRecording; -+} -+ -+void AudioInputHaiku::Start(){ -+ if(failed || isRecording) -+ return; -+ -+ isRecording=true; -+ -+ thread = new Thread(new MethodPointer(&AudioInputHaiku::RunThread, this), NULL); -+ thread->SetName("AudioInputHaiku"); -+ thread->Start(); -+ -+ fRecorder->Start(); -+} -+ -+void AudioInputHaiku::Stop(){ -+ if(!isRecording) -+ return; -+ -+ isRecording=false; -+ -+ fRecorder->Stop(); -+ -+ thread->Join(); -+ delete thread; -+ thread=NULL; -+} -+ -+void AudioInputHaiku::RunThread(void* arg){ -+ unsigned char buffer[BUFFER_SIZE*2]; -+ while (isRecording){ -+ if (fRingBuffer->GetReadAvailable() >= sizeof(buffer)) { -+ int readed = fRingBuffer->Read(buffer, sizeof(buffer)); -+ if (readed < sizeof(buffer)) -+ memset(buffer + readed, 0, sizeof(buffer) - readed); -+ InvokeCallback(buffer, sizeof(buffer)); -+ } else -+ snooze(100); -+ } -+} -diff --git a/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/haiku/AudioInputHaiku.h b/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/haiku/AudioInputHaiku.h -new file mode 100644 -index 0000000..80573df ---- /dev/null -+++ b/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/haiku/AudioInputHaiku.h -@@ -0,0 +1,57 @@ -+// -+// libtgvoip is free and unencumbered public domain software. -+// For more information, see http://unlicense.org or the UNLICENSE file -+// you should have received with this source code distribution. -+// -+ -+#ifndef LIBTGVOIP_AUDIOINPUTHAIKU_H -+#define LIBTGVOIP_AUDIOINPUTHAIKU_H -+ -+#include "../../audio/AudioInput.h" -+#include "../../threading.h" -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "RingBuffer.h" -+ -+namespace tgvoip{ -+namespace audio{ -+ -+class AudioInputHaiku : public AudioInput{ -+ -+public: -+ AudioInputHaiku(std::string devID); -+ virtual ~AudioInputHaiku(); -+ virtual void Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels); -+ virtual void Start(); -+ virtual void Stop(); -+ virtual bool IsRecording(); -+ -+ RingBuffer *fRingBuffer; -+private: -+ void RunThread(void* arg); -+ -+ bool isConfigured; -+ bool isRecording; -+ -+ BMediaRoster * fRoster; -+ BMediaRecorder * fRecorder; -+ media_format fRecordFormat; -+ media_node fAudioInputNode; -+ media_node fAudioMixerNode; -+ -+ Thread* thread; -+}; -+ -+} -+} -+ -+#endif //LIBTGVOIP_AUDIOINPUTALSA_H -diff --git a/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/haiku/AudioOutputHaiku.cpp b/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/haiku/AudioOutputHaiku.cpp -new file mode 100644 -index 0000000..4454323 ---- /dev/null -+++ b/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/haiku/AudioOutputHaiku.cpp -@@ -0,0 +1,101 @@ -+// -+// libtgvoip is free and unencumbered public domain software. -+// For more information, see http://unlicense.org or the UNLICENSE file -+// you should have received with this source code distribution. -+// -+ -+ -+#include -+#include -+#include "AudioOutputHaiku.h" -+#include "../../logging.h" -+#include "../../VoIPController.h" -+ -+#define BUFFER_SIZE 960 -+ -+using namespace tgvoip::audio; -+ -+static void playerProc(void *cookie, void *buffer, size_t len, const media_raw_audio_format &format) -+{ -+ AudioOutputHaiku *obj = (AudioOutputHaiku*)cookie; -+ obj->InvokeCallback((unsigned char*)buffer, len); -+} -+ -+ -+AudioOutputHaiku::AudioOutputHaiku(std::string devID){ -+ soundPlayer = NULL; -+ isPlaying = false; -+ isConfigured = false; -+ return; -+} -+ -+AudioOutputHaiku::~AudioOutputHaiku(){ -+ if (isConfigured) { -+ if (soundPlayer != NULL) { -+ soundPlayer->Stop(); -+ delete soundPlayer; -+ } -+ } -+} -+ -+void AudioOutputHaiku::Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels){ -+ media_raw_audio_format mediaKitFormat = { -+ (float)sampleRate, -+ (uint32)channels, -+ media_raw_audio_format::B_AUDIO_SHORT, -+ B_MEDIA_LITTLE_ENDIAN, -+ (uint32)BUFFER_SIZE * 2 * channels -+ }; -+ -+ switch (bitsPerSample) { -+ case 8: -+ mediaKitFormat.format = media_raw_audio_format::B_AUDIO_CHAR; -+ break; -+ case 16: -+ mediaKitFormat.format = media_raw_audio_format::B_AUDIO_SHORT; -+ break; -+ case 32: -+ mediaKitFormat.format = media_raw_audio_format::B_AUDIO_INT; -+ break; -+ default: -+ mediaKitFormat.format = media_raw_audio_format::B_AUDIO_SHORT; -+ break; -+ } -+ -+ soundPlayer = new BSoundPlayer(&mediaKitFormat, "Telegram", playerProc, NULL, (void*)this); -+ -+ if(soundPlayer->InitCheck() != B_OK) { -+ delete soundPlayer; -+ soundPlayer = NULL; -+ isPlaying = false; -+ return; -+ } -+ -+ isConfigured = true; -+} -+ -+void AudioOutputHaiku::Start(){ -+ if(soundPlayer == NULL || isPlaying) -+ return; -+ -+ soundPlayer->Start(); -+ soundPlayer->SetHasData(true); -+ -+ isPlaying=true; -+} -+ -+void AudioOutputHaiku::Stop(){ -+ if(!isPlaying) -+ return; -+ -+ soundPlayer->Stop(); -+ isPlaying=false; -+} -+ -+bool AudioOutputHaiku::IsPlaying(){ -+ return isPlaying; -+} -+ -+float AudioOutputHaiku::GetLevel(){ -+ return 0; -+} -diff --git a/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/haiku/AudioOutputHaiku.h b/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/haiku/AudioOutputHaiku.h -new file mode 100644 -index 0000000..6880709 ---- /dev/null -+++ b/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/haiku/AudioOutputHaiku.h -@@ -0,0 +1,36 @@ -+// -+// libtgvoip is free and unencumbered public domain software. -+// For more information, see http://unlicense.org or the UNLICENSE file -+// you should have received with this source code distribution. -+// -+ -+#ifndef LIBTGVOIP_AUDIOOUTPUTHAIKU_H -+#define LIBTGVOIP_AUDIOOUTPUTHAIKU_H -+ -+#include "../../audio/AudioOutput.h" -+#include "../../threading.h" -+ -+#include -+ -+namespace tgvoip{ -+namespace audio{ -+ -+class AudioOutputHaiku : public AudioOutput{ -+public: -+ AudioOutputHaiku(std::string devID); -+ virtual ~AudioOutputHaiku(); -+ virtual void Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels); -+ virtual void Start(); -+ virtual void Stop(); -+ virtual bool IsPlaying() override; -+ virtual float GetLevel() override; -+private: -+ bool isPlaying; -+ bool isConfigured; -+ BSoundPlayer *soundPlayer; -+}; -+ -+} -+} -+ -+#endif //LIBTGVOIP_AudioOutputHaiku_H -diff --git a/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/haiku/RingBuffer.cpp b/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/haiku/RingBuffer.cpp -new file mode 100644 -index 0000000..43236d3 ---- /dev/null -+++ b/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/haiku/RingBuffer.cpp -@@ -0,0 +1,130 @@ -+#include -+#include -+#include -+#include -+ -+#include "RingBuffer.h" -+ -+RingBuffer::RingBuffer( int size ) -+{ -+ initialized = false; -+ Buffer = new unsigned char[size]; -+ if(Buffer!=NULL) { -+ memset( Buffer, 0, size ); -+ BufferSize = size; -+ } else { -+ BufferSize = 0; -+ } -+ reader = 0; -+ writer = 0; -+ writeBytesAvailable = size; -+ if((locker=create_sem(1,"locker")) >= B_OK) { -+ initialized = true; -+ } else { -+ if(Buffer!=NULL) { -+ delete[] Buffer; -+ } -+ } -+} -+ -+RingBuffer::~RingBuffer( ) -+{ -+ if(initialized) { -+ delete[] Buffer; -+ delete_sem(locker); -+ } -+} -+ -+bool -+RingBuffer::Empty( void ) -+{ -+ memset( Buffer, 0, BufferSize ); -+ reader = 0; -+ writer = 0; -+ writeBytesAvailable = BufferSize; -+ return true; -+} -+ -+int -+RingBuffer::Read( unsigned char *data, int size ) -+{ -+ acquire_sem(locker); -+ -+ if( data == 0 || size <= 0 || writeBytesAvailable == BufferSize ) { -+ release_sem(locker); -+ return 0; -+ } -+ -+ int readBytesAvailable = BufferSize - writeBytesAvailable; -+ -+ if( size > readBytesAvailable ) { -+ size = readBytesAvailable; -+ } -+ -+ if(size > BufferSize - reader) { -+ int len = BufferSize - reader; -+ memcpy(data, Buffer + reader, len); -+ memcpy(data + len, Buffer, size-len); -+ } else { -+ memcpy(data, Buffer + reader, size); -+ } -+ -+ reader = (reader + size) % BufferSize; -+ writeBytesAvailable += size; -+ -+ release_sem(locker); -+ return size; -+} -+ -+int -+RingBuffer::Write( unsigned char *data, int size ) -+{ -+ acquire_sem(locker); -+ -+ if( data == 0 || size <= 0 || writeBytesAvailable == 0 ) { -+ release_sem(locker); -+ return 0; -+ } -+ -+ if( size > writeBytesAvailable ) { -+ size = writeBytesAvailable; -+ } -+ -+ if(size > BufferSize - writer) { -+ int len = BufferSize - writer; -+ memcpy(Buffer + writer, data, len); -+ memcpy(Buffer, data+len, size-len); -+ } else { -+ memcpy(Buffer + writer, data, size); -+ } -+ -+ writer = (writer + size) % BufferSize; -+ writeBytesAvailable -= size; -+ -+ release_sem(locker); -+ return size; -+} -+ -+int -+RingBuffer::GetSize( void ) -+{ -+ return BufferSize; -+} -+ -+int -+RingBuffer::GetWriteAvailable( void ) -+{ -+ return writeBytesAvailable; -+} -+ -+int -+RingBuffer::GetReadAvailable( void ) -+{ -+ return BufferSize - writeBytesAvailable; -+} -+ -+status_t -+RingBuffer::InitCheck( void ) -+{ -+ return initialized?B_OK:B_ERROR; -+} -diff --git a/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/haiku/RingBuffer.h b/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/haiku/RingBuffer.h -new file mode 100644 -index 0000000..4715632 ---- /dev/null -+++ b/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/haiku/RingBuffer.h -@@ -0,0 +1,31 @@ -+#ifndef __RING_BUFFER_H__ -+#define __RING_BUFFER_H__ -+ -+#include -+ -+class RingBuffer { -+ -+public: -+ RingBuffer(int size); -+ ~RingBuffer(); -+ int Read( unsigned char* dataPtr, int numBytes ); -+ int Write( unsigned char *dataPtr, int numBytes ); -+ -+ bool Empty( void ); -+ int GetSize( ); -+ int GetWriteAvailable( ); -+ int GetReadAvailable( ); -+ status_t InitCheck( ); -+private: -+ unsigned char *Buffer; -+ int BufferSize; -+ int reader; -+ int writer; -+ int writeBytesAvailable; -+ -+ sem_id locker; -+ -+ bool initialized; -+}; -+ -+#endif -diff --git a/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/posix/NetworkSocketPosix.cpp b/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/posix/NetworkSocketPosix.cpp -index 05ddbb9..fcf7580 100644 ---- a/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/posix/NetworkSocketPosix.cpp -+++ b/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/posix/NetworkSocketPosix.cpp -@@ -47,6 +47,7 @@ NetworkSocketPosix::~NetworkSocketPosix(){ - } - - void NetworkSocketPosix::SetMaxPriority(){ -+#ifndef __HAIKU__ - #ifdef __APPLE__ - int prio=NET_SERVICE_TYPE_VO; - int res=setsockopt(fd, SOL_SOCKET, SO_NET_SERVICE_TYPE, &prio, sizeof(prio)); -@@ -65,6 +66,7 @@ void NetworkSocketPosix::SetMaxPriority(){ - LOGE("error setting ip tos: %d / %s", errno, strerror(errno)); - } - #endif -+#endif //__HAIKU__ - } - - void NetworkSocketPosix::Send(NetworkPacket *packet){ -@@ -196,8 +198,10 @@ void NetworkSocketPosix::Open(){ - int res=setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &flag, sizeof(flag)); - if(res<0){ - LOGE("error enabling dual stack socket: %d / %s", errno, strerror(errno)); -+#ifndef __HAIKU__ - failed=true; - return; -+#endif - } - - SetMaxPriority(); -@@ -345,6 +349,8 @@ std::string NetworkSocketPosix::GetLocalInterfaceInfo(IPv4Address *v4addr, IPv6A - if(didAttach){ - sharedJVM->DetachCurrentThread(); - } -+#elif defined(__HAIKU__) -+ return name; - #else - struct ifaddrs* interfaces; - if(!getifaddrs(&interfaces)){ -diff --git a/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/threading.h b/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/threading.h -index 0b4933c..87ea3b7 100644 ---- a/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/threading.h -+++ b/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/threading.h -@@ -33,7 +33,7 @@ namespace tgvoip{ - }; - } - --#if defined(_POSIX_THREADS) || defined(_POSIX_VERSION) || defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__)) -+#if defined(_POSIX_THREADS) || defined(_POSIX_VERSION) || defined(__unix__) || defined(__unix) || defined(__HAIKU__) || (defined(__APPLE__) && defined(__MACH__)) - - #include - #include -@@ -94,11 +94,13 @@ namespace tgvoip{ - static void* ActualEntryPoint(void* arg){ - Thread* self=reinterpret_cast(arg); - if(self->name){ -+#ifndef __HAIKU__ - #ifndef __APPLE__ - pthread_setname_np(self->thread, self->name); - #else - pthread_setname_np(self->name); - #endif -+#endif //__HAKIU__ - } - self->entry->Invoke(self->arg); - return NULL; --- -2.16.4 - - -From 4dbfc02248dde7ae10d29d81f25575942f204c89 Mon Sep 17 00:00:00 2001 -From: Gerasim Troeglazov <3dEyes@gmail.com> -Date: Sun, 10 Jun 2018 22:01:28 +1000 -Subject: Add mix and resample for haiku audio input - - -diff --git a/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/haiku/AudioInputHaiku.cpp b/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/haiku/AudioInputHaiku.cpp -index ce54b6e..d7cc39a 100644 ---- a/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/haiku/AudioInputHaiku.cpp -+++ b/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/haiku/AudioInputHaiku.cpp -@@ -10,32 +10,104 @@ - #include - #include "AudioInputHaiku.h" - #include "../../logging.h" -+#include "../../audio/Resampler.h" - #include "../../VoIPController.h" - - #include "RingBuffer.h" - --#define BUFFER_SIZE 960 -- - using namespace tgvoip::audio; - --void RecordFile(void* cookie, bigtime_t timestamp, void* data, size_t size, const media_format &format) -+void RecordData(void* cookie, bigtime_t timestamp, void* data, size_t size, const media_format &format) - { -- AudioInputHaiku *obj = (AudioInputHaiku*)cookie; -- if (!obj->IsRecording()) -+ AudioInputHaiku *audioInput = (AudioInputHaiku*)cookie; -+ if (!audioInput->IsRecording()) -+ return; -+ -+ if (format.u.raw_audio.format == media_raw_audio_format::B_AUDIO_SHORT && -+ format.u.raw_audio.channel_count == 1) { -+ audioInput->fRingBuffer->Write((unsigned char*)data, size); - return; -- if (format.u.raw_audio.channel_count == 1) { -- obj->fRingBuffer->Write((unsigned char*)data, size); -- } else if (format.u.raw_audio.channel_count == 2) { -- unsigned char *s = (unsigned char*)data; -- for (int i=0; ifRingBuffer->Write(s, 2); - } -- -+ -+ uint32 bytesPerSample = 2; -+ switch (format.u.raw_audio.format) { -+ case media_raw_audio_format::B_AUDIO_CHAR: -+ bytesPerSample = 1; -+ break; -+ case media_raw_audio_format::B_AUDIO_SHORT: -+ bytesPerSample = 2; -+ break; -+ case media_raw_audio_format::B_AUDIO_INT: -+ bytesPerSample = 4; -+ break; -+ case media_raw_audio_format::B_AUDIO_FLOAT: -+ bytesPerSample = 4; -+ break; -+ default: -+ break; -+ } -+ -+ int frames = size / (format.u.raw_audio.channel_count * bytesPerSample); -+ int16_t *dst = audioInput->workBuffer; -+ -+ if (format.u.raw_audio.format == media_raw_audio_format::B_AUDIO_CHAR) { -+ unsigned char* src=reinterpret_cast(data); -+ for (int n=0; n < frames; n++) { -+ int32_t value = 0; -+ for (int j=0; j < format.u.raw_audio.channel_count; j++, src++) { -+ value += ((int32_t)(*src) - INT8_MAX) * UINT8_MAX; -+ } -+ value /= format.u.raw_audio.channel_count; -+ dst[n] = (int16_t)value; -+ } -+ } else if (format.u.raw_audio.format == media_raw_audio_format::B_AUDIO_SHORT) { -+ int16_t* src=reinterpret_cast(data); -+ for (int n=0; n < frames; n++) { -+ int32_t value = 0; -+ for (int j=0; j < format.u.raw_audio.channel_count; j++, src++) { -+ value += *src; -+ } -+ value /= format.u.raw_audio.channel_count; -+ dst[n] = (int16_t)value; -+ } -+ } else if (format.u.raw_audio.format == media_raw_audio_format::B_AUDIO_INT) { -+ int32_t* src=reinterpret_cast(data); -+ for (int n=0; n < frames; n++) { -+ int64_t value = 0; -+ for (int j=0; j < format.u.raw_audio.channel_count; j++, src++) { -+ value += (int64_t)(*src); -+ } -+ value /= format.u.raw_audio.channel_count; -+ dst[n] = (int16_t)(value / (UINT16_MAX + 1)); -+ } -+ } else if (format.u.raw_audio.format == media_raw_audio_format::B_AUDIO_FLOAT) { -+ float* src=reinterpret_cast(data); -+ for (int n=0; n < frames; n++) { -+ float value = 0; -+ for (int j=0; j < format.u.raw_audio.channel_count; j++, src++) { -+ value += *src; -+ } -+ value /= format.u.raw_audio.channel_count; -+ dst[n] = (int16_t)(value*INT16_MAX); -+ } -+ } -+ -+ if(format.u.raw_audio.frame_rate != audioInput->tgFrameRate) { -+ size_t len = tgvoip::audio::Resampler::Convert(dst, audioInput->convertBuffer, -+ frames, frames, audioInput->tgFrameRate, format.u.raw_audio.frame_rate) * audioInput->tgBytesPerSample; -+ audioInput->fRingBuffer->Write((unsigned char*)audioInput->convertBuffer, len); -+ } else { -+ audioInput->fRingBuffer->Write((unsigned char*)dst, frames * audioInput->tgBytesPerSample); -+ } - } - --void NotifyRecordFile(void * cookie, BMediaRecorder::notification code, ...) -+void NotifyRecordData(void * cookie, BMediaRecorder::notification code, ...) - { -+ AudioInputHaiku *audioInput = (AudioInputHaiku*)cookie; - if (code == BMediaRecorder::B_WILL_STOP) { -+ if (audioInput->IsRecording()) { -+ audioInput->Stop(); -+ } - } - } - -@@ -116,7 +188,7 @@ AudioInputHaiku::AudioInputHaiku(std::string devID) - } - fRecordFormat.type = B_MEDIA_RAW_AUDIO; - -- error = fRecorder->SetHooks(RecordFile, NotifyRecordFile, this); -+ error = fRecorder->SetHooks(RecordData, NotifyRecordData, this); - if (error < B_OK) { - failed=true; - return; -@@ -151,7 +223,9 @@ AudioInputHaiku::~AudioInputHaiku(){ - } - - void AudioInputHaiku::Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels){ -- -+ tgFrameRate = sampleRate; -+ tgChannelsCount = channels; -+ tgBytesPerSample = bitsPerSample / 8; - } - - bool AudioInputHaiku::IsRecording(){ -diff --git a/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/haiku/AudioInputHaiku.h b/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/haiku/AudioInputHaiku.h -index 80573df..746d7df 100644 ---- a/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/haiku/AudioInputHaiku.h -+++ b/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/haiku/AudioInputHaiku.h -@@ -22,6 +22,8 @@ - - #include "RingBuffer.h" - -+#define BUFFER_SIZE 960 -+ - namespace tgvoip{ - namespace audio{ - -@@ -34,8 +36,15 @@ public: - virtual void Start(); - virtual void Stop(); - virtual bool IsRecording(); -- -- RingBuffer *fRingBuffer; -+ -+ RingBuffer *fRingBuffer; -+ int16_t workBuffer[BUFFER_SIZE * 16]; -+ int16_t convertBuffer[BUFFER_SIZE * 16]; -+ -+ uint32 tgFrameRate; -+ uint32 tgChannelsCount; -+ uint32 tgBytesPerSample; -+ - private: - void RunThread(void* arg); - -@@ -47,11 +56,11 @@ private: - media_format fRecordFormat; - media_node fAudioInputNode; - media_node fAudioMixerNode; -- -+ - Thread* thread; - }; - - } - } - --#endif //LIBTGVOIP_AUDIOINPUTALSA_H -+#endif //LIBTGVOIP_AUDIOINPUTHAIKU_H -diff --git a/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/haiku/AudioOutputHaiku.cpp b/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/haiku/AudioOutputHaiku.cpp -index 4454323..11650da 100644 ---- a/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/haiku/AudioOutputHaiku.cpp -+++ b/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/haiku/AudioOutputHaiku.cpp -@@ -44,7 +44,7 @@ void AudioOutputHaiku::Configure(uint32_t sampleRate, uint32_t bitsPerSample, ui - (uint32)channels, - media_raw_audio_format::B_AUDIO_SHORT, - B_MEDIA_LITTLE_ENDIAN, -- (uint32)BUFFER_SIZE * 2 * channels -+ (uint32)BUFFER_SIZE * (bitsPerSample / 8) * channels - }; - - switch (bitsPerSample) { -@@ -68,6 +68,7 @@ void AudioOutputHaiku::Configure(uint32_t sampleRate, uint32_t bitsPerSample, ui - delete soundPlayer; - soundPlayer = NULL; - isPlaying = false; -+ failed = true; - return; - } - -diff --git a/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/haiku/AudioOutputHaiku.h b/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/haiku/AudioOutputHaiku.h -index 6880709..6a463fa 100644 ---- a/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/haiku/AudioOutputHaiku.h -+++ b/libtgvoip-697eea96aa90205db4fc368df4127eef56b2a5c6/os/haiku/AudioOutputHaiku.h -@@ -33,4 +33,4 @@ private: - } - } - --#endif //LIBTGVOIP_AudioOutputHaiku_H -+#endif //LIBTGVOIP_AUDIOOUTPUTHAIKU_H --- -2.16.4 - diff --git a/net-im/telegram-desktop/patches/telegram_desktop-1.4.4-systemqt.patch b/net-im/telegram-desktop/patches/telegram_desktop-1.4.4-systemqt.patch deleted file mode 100644 index 237d55d8e..000000000 --- a/net-im/telegram-desktop/patches/telegram_desktop-1.4.4-systemqt.patch +++ /dev/null @@ -1,538 +0,0 @@ -From: Giovanni Santini -Date: Sun, 02 Sep 2018 11:28:00 +0200 -Subject: [PATCH] Linux "clean" build -This patch is a refreshed version of the patch usually applied -during ArchLinux builds of Telegram Desktop. -diff --git a/Telegram/Resources/qrc/telegram_linux.qrc b/Telegram/Resources/qrc/telegram_linux.qrc -index 0554fa179..3ea027406 100644 ---- a/Telegram/Resources/qrc/telegram_linux.qrc -+++ b/Telegram/Resources/qrc/telegram_linux.qrc -@@ -1,5 +1,4 @@ - - -- ../etc/qt_linux.conf - - -diff --git a/Telegram/SourceFiles/core/launcher.cpp b/Telegram/SourceFiles/core/launcher.cpp -index d4bdadc17..8a420c74b 100644 ---- a/Telegram/SourceFiles/core/launcher.cpp -+++ b/Telegram/SourceFiles/core/launcher.cpp -@@ -39,9 +39,10 @@ void Launcher::init() { - - QCoreApplication::setApplicationName(qsl("TelegramDesktop")); - --#ifndef OS_MAC_OLD -+#if !defined(Q_OS_MAC) && QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) -+ // Retina display support is working fine, others are not. - QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling, true); --#endif // OS_MAC_OLD -+#endif // not defined Q_OS_MAC and QT_VERSION >= 5.6.0 - - initHook(); - } -@@ -59,6 +60,13 @@ int Launcher::exec() { - Logs::start(this); // must be started before Platform is started - Platform::start(); // must be started before QApplication is created - -+ // I don't know why path is not in QT_PLUGIN_PATH by default -+ QCoreApplication::addLibraryPath("/usr/lib/qt/plugins"); -+ // 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 -+ unsetenv("QT_QPA_PLATFORMTHEME"); -+ - auto result = executeApplication(); - - DEBUG_LOG(("Telegram finished, result: %1").arg(result)); -diff --git a/Telegram/SourceFiles/platform/linux/linux_libs.h b/Telegram/SourceFiles/platform/linux/linux_libs.h -index 6f93d69cd..df185d5a2 100644 ---- a/Telegram/SourceFiles/platform/linux/linux_libs.h -+++ b/Telegram/SourceFiles/platform/linux/linux_libs.h -@@ -17,7 +17,7 @@ extern "C" { - } // extern "C" - - #ifndef TDESKTOP_DISABLE_UNITY_INTEGRATION --#include -+typedef void UnityLauncherEntry; - #endif // !TDESKTOP_DISABLE_UNITY_INTEGRATION - #endif // !TDESKTOP_DISABLE_GTK_INTEGRATION - -diff --git a/Telegram/SourceFiles/qt_functions.cpp b/Telegram/SourceFiles/qt_functions.cpp -new file mode 100644 -index 000000000..4a722b8d7 ---- /dev/null -+++ b/Telegram/SourceFiles/qt_functions.cpp -@@ -0,0 +1,94 @@ -+/**************************************************************************** -+** -+** Copyright (C) 2015 The Qt Company Ltd. -+** Contact: http://www.qt.io/licensing/ -+** -+** This file contains some parts of the Qt Toolkit. -+** -+** $QT_BEGIN_LICENSE:LGPL21$ -+** Commercial License Usage -+** Licensees holding valid commercial Qt licenses may use this file in -+** accordance with the commercial license agreement provided with the -+** Software or, alternatively, in accordance with the terms contained in -+** a written agreement between you and The Qt Company. For licensing terms -+** and conditions see http://www.qt.io/terms-conditions. For further -+** information use the contact form at http://www.qt.io/contact-us. -+** -+** GNU Lesser General Public License Usage -+** Alternatively, this file may be used under the terms of the GNU Lesser -+** General Public License version 2.1 or version 3 as published by the Free -+** Software Foundation and appearing in the file LICENSE.LGPLv21 and -+** LICENSE.LGPLv3 included in the packaging of this file. Please review the -+** following information to ensure the GNU Lesser General Public License -+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -+** -+** As a special exception, The Qt Company gives you certain additional -+** rights. These rights are described in The Qt Company LGPL Exception -+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -+** -+** $QT_END_LICENSE$ -+** -+****************************************************************************/ -+ -+/* TODO: find a dynamic library with these symbols. */ -+ -+/* Debian maintainer: this function is taken from qfiledialog.cpp */ -+/* -+ Makes a list of filters from ;;-separated text. -+ Used by the mac and windows implementations -+*/ -+QStringList qt_make_filter_list(const QString &filter) -+{ -+ QString f(filter); -+ -+ if (f.isEmpty()) -+ return QStringList(); -+ -+ QString sep(QLatin1String(";;")); -+ int i = f.indexOf(sep, 0); -+ if (i == -1) { -+ if (f.indexOf(QLatin1Char('\n'), 0) != -1) { -+ sep = QLatin1Char('\n'); -+ i = f.indexOf(sep, 0); -+ } -+ } -+ -+ return f.split(sep); -+} -+ -+/* Debian maintainer: this constructor is taken from qtextengine.cpp for TextPainter::drawLine */ -+QTextItemInt::QTextItemInt(const QGlyphLayout &g, QFont *font, const QChar *chars_, int numChars, QFontEngine *fe, const QTextCharFormat &format) -+ : flags(0), justified(false), underlineStyle(QTextCharFormat::NoUnderline), charFormat(format), -+ num_chars(numChars), chars(chars_), logClusters(0), f(font), glyphs(g), fontEngine(fe) -+{ -+} -+ -+/* Debian maintainer: this method is also taken from qtextengine.cpp */ -+// Fix up flags and underlineStyle with given info -+void QTextItemInt::initWithScriptItem(const QScriptItem &si) -+{ -+ // explicitly initialize flags so that initFontAttributes can be called -+ // multiple times on the same TextItem -+ flags = 0; -+ if (si.analysis.bidiLevel %2) -+ flags |= QTextItem::RightToLeft; -+ ascent = si.ascent; -+ descent = si.descent; -+ -+ if (charFormat.hasProperty(QTextFormat::TextUnderlineStyle)) { -+ underlineStyle = charFormat.underlineStyle(); -+ } else if (charFormat.boolProperty(QTextFormat::FontUnderline) -+ || f->d->underline) { -+ underlineStyle = QTextCharFormat::SingleUnderline; -+ } -+ -+ // compat -+ if (underlineStyle == QTextCharFormat::SingleUnderline) -+ flags |= QTextItem::Underline; -+ -+ if (f->d->overline || charFormat.fontOverline()) -+ flags |= QTextItem::Overline; -+ if (f->d->strikeOut || charFormat.fontStrikeOut()) -+ flags |= QTextItem::StrikeOut; -+} -diff --git a/Telegram/SourceFiles/qt_static_plugins.cpp b/Telegram/SourceFiles/qt_static_plugins.cpp -index e29f348c8..122ff0f5d 100644 ---- a/Telegram/SourceFiles/qt_static_plugins.cpp -+++ b/Telegram/SourceFiles/qt_static_plugins.cpp -@@ -15,13 +15,4 @@ Q_IMPORT_PLUGIN(QWebpPlugin) - Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin) - Q_IMPORT_PLUGIN(QGenericEnginePlugin) - #elif defined Q_OS_LINUX // Q_OS_WIN | Q_OS_MAC --Q_IMPORT_PLUGIN(QWebpPlugin) --Q_IMPORT_PLUGIN(QXcbIntegrationPlugin) --Q_IMPORT_PLUGIN(QConnmanEnginePlugin) --Q_IMPORT_PLUGIN(QGenericEnginePlugin) --Q_IMPORT_PLUGIN(QNetworkManagerEnginePlugin) --Q_IMPORT_PLUGIN(QComposePlatformInputContextPlugin) --Q_IMPORT_PLUGIN(QIbusPlatformInputContextPlugin) --Q_IMPORT_PLUGIN(QFcitxPlatformInputContextPlugin) --Q_IMPORT_PLUGIN(QHimePlatformInputContextPlugin) - #endif // Q_OS_WIN | Q_OS_MAC | Q_OS_LINUX -diff --git a/Telegram/SourceFiles/ui/text/text.cpp b/Telegram/SourceFiles/ui/text/text.cpp -index 944f58479..887c1982f 100644 ---- a/Telegram/SourceFiles/ui/text/text.cpp -+++ b/Telegram/SourceFiles/ui/text/text.cpp -@@ -1750,11 +1750,11 @@ private: - if (item == -1) - return; - --#ifdef OS_MAC_OLD -+#if defined(OS_MAC_OLD) || QT_VERSION < QT_VERSION_CHECK(5, 6, 0) - auto end = _e->findItem(line.from + line.length - 1); --#else // OS_MAC_OLD -+#else - auto end = _e->findItem(line.from + line.length - 1, item); --#endif // OS_MAC_OLD -+#endif - - auto blockIndex = _lineStartBlock; - auto currentBlock = _t->_blocks[blockIndex].get(); -diff --git a/Telegram/SourceFiles/ui/text/text_block.cpp b/Telegram/SourceFiles/ui/text/text_block.cpp -index 2959cec77..04ad00645 100644 ---- a/Telegram/SourceFiles/ui/text/text_block.cpp -+++ b/Telegram/SourceFiles/ui/text/text_block.cpp -@@ -332,6 +332,9 @@ TextBlock::TextBlock(const style::font &font, const QString &str, QFixed minResi - - QStackTextEngine engine(part, blockFont->f); - BlockParser parser(&engine, this, minResizeWidth, _from, part); -+ QTextLayout layout(part, blockFont->f); -+ layout.beginLayout(); -+ layout.createLine(); - - CrashReports::ClearAnnotationRef("CrashString"); - } -diff --git a/Telegram/SourceFiles/ui/twidget.cpp b/Telegram/SourceFiles/ui/twidget.cpp -index 71f318229..461f52278 100644 ---- a/Telegram/SourceFiles/ui/twidget.cpp -+++ b/Telegram/SourceFiles/ui/twidget.cpp -@@ -233,9 +233,9 @@ void sendSynteticMouseEvent(QWidget *widget, QEvent::Type type, Qt::MouseButton - , button - , QGuiApplication::mouseButtons() | button - , QGuiApplication::keyboardModifiers() --#ifndef OS_MAC_OLD -+#if !defined(OS_MAC_OLD) && QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) - , Qt::MouseEventSynthesizedByApplication --#endif // OS_MAC_OLD -+#endif - ); - ev.setTimestamp(getms()); - QGuiApplication::sendEvent(windowHandle, &ev); -diff --git a/Telegram/gyp/PrecompiledHeader.cmake b/Telegram/gyp/PrecompiledHeader.cmake -index a0e1e0489..223113081 100644 ---- a/Telegram/gyp/PrecompiledHeader.cmake -+++ b/Telegram/gyp/PrecompiledHeader.cmake -@@ -114,7 +114,7 @@ function(add_precompiled_header _target _input) - set(_compiler_FLAGS "@${_pch_c_flags_file}") - add_custom_command( - OUTPUT "${_output_c}" -- COMMAND "${CMAKE_C_COMPILER}" ${_compiler_FLAGS} -x c-header -o "${_output_c}" -c "${_pchfile}" -+ COMMAND "${CMAKE_C_COMPILER}" ${_compiler_FLAGS} "$(C_DEFINES)" "$(C_INCLUDES)" "$(C_FLAGS)" -x c-header -o "${_output_c}" -c "${_pchfile}" - DEPENDS "${_pchfile}" "${_pch_c_flags_file}" - IMPLICIT_DEPENDS C "${_pch_header}" - COMMENT "Precompiling ${_name} for ${_target} (C)") -@@ -125,7 +125,7 @@ function(add_precompiled_header _target _input) - set(_compiler_FLAGS "@${_pch_cpp_flags_file}") - add_custom_command( - OUTPUT "${_output_cxx}" -- COMMAND "${CMAKE_CXX_COMPILER}" ${_compiler_FLAGS} -x c++-header -o "${_output_cxx}" -c "${_pchfile}" -+ COMMAND "${CMAKE_CXX_COMPILER}" ${_compiler_FLAGS} "$(CXX_DEFINES)" "$(CXX_INCLUDES)" "$(CXX_FLAGS)" -x c++-header -o "${_output_cxx}" -c "${_pchfile}" - DEPENDS "${_pchfile}" "${_pch_cpp_flags_file}" - IMPLICIT_DEPENDS CXX "${_pch_header}" - COMMENT "Precompiling header ${_name} for ${_target} (C++)") -diff --git a/Telegram/gyp/Telegram.gyp b/Telegram/gyp/Telegram.gyp -index 1cab5ae29..2c6ef58cb 100644 ---- a/Telegram/gyp/Telegram.gyp -+++ b/Telegram/gyp/Telegram.gyp -@@ -75,7 +75,6 @@ - 'codegen.gyp:codegen_numbers', - 'codegen.gyp:codegen_style', - 'tests/tests.gyp:tests', -- 'utils.gyp:Updater', - '../ThirdParty/libtgvoip/libtgvoip.gyp:libtgvoip', - 'crl.gyp:crl', - 'lib_base.gyp:lib_base', -@@ -84,7 +83,6 @@ - ], - - 'defines': [ -- 'AL_LIBTYPE_STATIC', - 'AL_ALEXT_PROTOTYPES', - 'TGVOIP_USE_CXX11_LIB', - 'XXH_INLINE_ALL', -diff --git a/Telegram/gyp/qt.gypi b/Telegram/gyp/qt.gypi -index 0b783ec21..3f917765a 100644 ---- a/Telegram/gyp/qt.gypi -+++ b/Telegram/gyp/qt.gypi -@@ -14,25 +14,21 @@ - [ 'build_macold', { - 'qt_version%': '5.3.2', - }, { -- 'qt_version%': '5.6.2', -+ 'qt_version%': ' /dev/null --libs <@(pkgconfig_libs))', - ], - 'cflags_cc': [ -@@ -96,10 +89,8 @@ - ], - }], ['not_need_gtk!="True"', { - 'cflags_cc': [ -- ' /dev/null --cflags appindicator-0.1)', -- ' /dev/null --cflags gtk+-2.0)', -- ' /dev/null --cflags glib-2.0)', -- ' /dev/null --cflags dee-1.0)', -+ ' /dev/null --cflags appindicator3-0.1)', -+ ' /dev/null --cflags gtk+-3.0)', - ], - }] - ], -diff --git a/Telegram/gyp/telegram_sources.txt b/Telegram/gyp/telegram_sources.txt -index dd4f848db..22cf8866c 100644 ---- a/Telegram/gyp/telegram_sources.txt -+++ b/Telegram/gyp/telegram_sources.txt -@@ -765,14 +765,7 @@ - <(emoji_suggestions_loc)/emoji_suggestions.cpp - <(emoji_suggestions_loc)/emoji_suggestions.h - --platforms: !win --<(minizip_loc)/crypt.h --<(minizip_loc)/ioapi.c --<(minizip_loc)/ioapi.h --<(minizip_loc)/zip.c --<(minizip_loc)/zip.h --<(minizip_loc)/unzip.c --<(minizip_loc)/unzip.h -+<(src_loc)/qt_functions.cpp - - platforms: win - <(res_loc)/winrc/Telegram.rc diff --git a/net-im/telegram-desktop/patches/telegram_desktop-1.4.4.patchset b/net-im/telegram-desktop/patches/telegram_desktop-1.4.4.patchset deleted file mode 100644 index 03c6539e1..000000000 --- a/net-im/telegram-desktop/patches/telegram_desktop-1.4.4.patchset +++ /dev/null @@ -1,2617 +0,0 @@ -From 20fbc592b43f673b3e1fb2a2c2cc9ebe9541567d Mon Sep 17 00:00:00 2001 -From: Gerasim Troeglazov <3dEyes@gmail.com> -Date: Fri, 19 Oct 2018 19:22:32 +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 @@ -+ -+ -+ ../etc/qt_haiku.conf -+ -+ -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 { 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 b2fc899..429a2c3 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 -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 - - int (*TestForkedMethod)()/* = nullptr*/; -diff --git a/Telegram/SourceFiles/core/launcher.cpp b/Telegram/SourceFiles/core/launcher.cpp -index 8a420c7..0ba85bd 100644 ---- a/Telegram/SourceFiles/core/launcher.cpp -+++ b/Telegram/SourceFiles/core/launcher.cpp -@@ -62,6 +62,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 -@@ -142,6 +146,9 @@ void Launcher::prepareSettings() { - case dbipMacOld: - gPlatformString = qsl("MacOSold"); - break; -+ case dbipHaiku: -+ gPlatformString = qsl("HaikuDepot"); -+ break; - case dbipLinux64: - gPlatformString = qsl("Linux64bit"); - break; -diff --git a/Telegram/SourceFiles/core/update_checker.cpp b/Telegram/SourceFiles/core/update_checker.cpp -index 0c71c39..32f29ee 100644 ---- a/Telegram/SourceFiles/core/update_checker.cpp -+++ b/Telegram/SourceFiles/core/update_checker.cpp -@@ -633,6 +633,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"; - } -@@ -2068,6 +2069,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 219dc22..7effe80 100644 ---- a/Telegram/SourceFiles/core/utils.h -+++ b/Telegram/SourceFiles/core/utils.h -@@ -396,6 +396,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 a2e26ed..f839c43 100644 ---- a/Telegram/SourceFiles/export/data/export_data_types.cpp -+++ b/Telegram/SourceFiles/export/data/export_data_types.cpp -@@ -225,6 +225,8 @@ Image ParseMaxImage( - const MTPVector &data, - const QString &suggestedPath) { - auto result = Image(); -+// GCC7 Segmentation violation for Haiku -+#ifndef __HAIKU__ - result.file.suggestedPath = suggestedPath; - - auto maxArea = int64(0); -@@ -247,6 +249,7 @@ Image ParseMaxImage( - } - }); - } -+#endif - return result; - } - -@@ -406,6 +409,8 @@ Document ParseDocument( - const QString &suggestedFolder, - TimeId date) { - auto result = Document(); -+// GCC7 Segmentation violation for Haiku -+#ifndef __HAIKU__ - data.match([&](const MTPDdocument &data) { - result.id = data.vid.v; - result.date = data.vdate.v; -@@ -442,6 +447,7 @@ Document ParseDocument( - }, [&](const MTPDdocumentEmpty &data) { - result.id = data.vid.v; - }); -+#endif - return result; - } - -@@ -1043,6 +1049,8 @@ Message ParseMessage( - const MTPMessage &data, - const QString &mediaFolder) { - auto result = Message(); -+// GCC7 Segmentation violation for Haiku -+#ifndef __HAIKU__ - data.match([&](const auto &data) { - result.id = data.vid.v; - if constexpr (!MTPDmessageEmpty::Is()) { -@@ -1131,6 +1139,7 @@ Message ParseMessage( - }, [&](const MTPDmessageEmpty &data) { - result.id = data.vid.v; - }); -+#endif - return result; - } - -diff --git a/Telegram/SourceFiles/export/export_api_wrap.cpp b/Telegram/SourceFiles/export/export_api_wrap.cpp -index f183f3b..a9791dc 100644 ---- a/Telegram/SourceFiles/export/export_api_wrap.cpp -+++ b/Telegram/SourceFiles/export/export_api_wrap.cpp -@@ -719,6 +719,8 @@ void ApiWrap::requestUserpics( - void ApiWrap::handleUserpicsSlice(const MTPphotos_Photos &result) { - Expects(_userpicsProcess != nullptr); - -+// GCC7 Segmentation violation for Haiku -+#ifndef __HAIKU__ - result.match([&](const auto &data) { - if constexpr (MTPDphotos_photos::Is()) { - _userpicsProcess->lastSlice = true; -@@ -727,6 +729,7 @@ void ApiWrap::handleUserpicsSlice(const MTPphotos_Photos &result) { - data.vphotos, - _userpicsProcess->processed)); - }); -+#endif - } - - void ApiWrap::loadUserpicsFiles(Data::UserpicsSlice &&slice) { -@@ -1240,6 +1243,8 @@ void ApiWrap::appendChatsSlice( - void ApiWrap::requestMessagesSlice() { - Expects(_chatProcess != nullptr); - -+// GCC7 Segmentation violation for Haiku -+#ifndef __HAIKU__ - const auto count = _chatProcess->info.messagesCountPerSplit[ - _chatProcess->localSplitIndex]; - if (!count) { -@@ -1268,6 +1273,7 @@ void ApiWrap::requestMessagesSlice() { - _chatProcess->info.relativePath)); - }); - }); -+#endif - } - - void ApiWrap::requestChatMessages( -diff --git a/Telegram/SourceFiles/logs.cpp b/Telegram/SourceFiles/logs.cpp -index ed2c7ce..1a6d4e1 100644 ---- a/Telegram/SourceFiles/logs.cpp -+++ b/Telegram/SourceFiles/logs.cpp -@@ -333,7 +333,7 @@ void start(not_null 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 fb46a00..752e7ef 100644 ---- a/Telegram/SourceFiles/media/media_audio.cpp -+++ b/Telegram/SourceFiles/media/media_audio.cpp -@@ -86,6 +86,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); -@@ -94,7 +95,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..58bc1c3 ---- /dev/null -+++ b/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.cpp -@@ -0,0 +1,138 @@ -+/* -+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-2017 John Preston, https://desktop.telegram.org -+*/ -+#include "platform/haiku/file_utilities_haiku.h" -+ -+#include "messenger.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 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..23e4a1f ---- /dev/null -+++ b/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.h -@@ -0,0 +1,71 @@ -+/* -+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-2017 John Preston, https://desktop.telegram.org -+*/ -+#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..37474d0 ---- /dev/null -+++ b/Telegram/SourceFiles/platform/haiku/haiku_desktop_environment.cpp -@@ -0,0 +1,71 @@ -+/* -+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-2017 John Preston, https://desktop.telegram.org -+*/ -+#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(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..e76c8fe ---- /dev/null -+++ b/Telegram/SourceFiles/platform/haiku/haiku_desktop_environment.h -@@ -0,0 +1,37 @@ -+/* -+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-2017 John Preston, https://desktop.telegram.org -+*/ -+#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..a7bea21 ---- /dev/null -+++ b/Telegram/SourceFiles/platform/haiku/launcher_haiku.cpp -@@ -0,0 +1,59 @@ -+/* -+This file is part of Telegram Desktop, -+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 "platform/haiku/launcher_haiku.h" -+ -+#include "core/crash_reports.h" -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+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 _argumentValues; -+ std::vector _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..0b7dea1 ---- /dev/null -+++ b/Telegram/SourceFiles/platform/haiku/launcher_haiku.h -@@ -0,0 +1,23 @@ -+/* -+This file is part of Telegram Desktop, -+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 -+*/ -+#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..a1ef5d8 ---- /dev/null -+++ b/Telegram/SourceFiles/platform/haiku/main_window_haiku.cpp -@@ -0,0 +1,136 @@ -+/* -+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-2017 John Preston, https://desktop.telegram.org -+*/ -+#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 "messenger.h" -+#include "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(Messenger::Instance().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() { -+ auto counter = App::histories().unreadBadge(); -+ auto muted = App::histories().unreadOnlyMuted(); -+ auto iconSizeSmall = QSize(16, 16); -+ auto &bg = (muted ? st::trayCounterBgMute : st::trayCounterBg); -+ auto &fg = st::trayCounterFg; -+ auto iconSmallPixmap16 = App::pixmapFromImageInPlace(iconWithCounter(16, counter, bg, fg, true)); -+ QIcon iconSmall; -+ iconSmall.addPixmap(iconSmallPixmap16); -+ if (trayIcon) { -+ QIcon forTrayIcon; -+ forTrayIcon.addPixmap(iconSmallPixmap16); -+ trayIcon->setIcon(forTrayIcon); -+ } -+} -+ -+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..56cc497 ---- /dev/null -+++ b/Telegram/SourceFiles/platform/haiku/main_window_haiku.h -@@ -0,0 +1,79 @@ -+/* -+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-2017 John Preston, https://desktop.telegram.org -+*/ -+#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..bf9c7be ---- /dev/null -+++ b/Telegram/SourceFiles/platform/haiku/notifications_haiku_gate.cpp -@@ -0,0 +1,40 @@ -+#include -+ -+#include -+#include -+ -+#define APPSIGNATURE "application/x-vnd.tg-notify-gate" -+ -+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) { -+ FILE *out=fopen("/tmp/tg_notify","wt"); -+ fprintf(out,"%s\n", argv[1]); -+ fclose(out); -+ } -+} -+ -+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..410bdf9 ---- /dev/null -+++ b/Telegram/SourceFiles/platform/haiku/notifications_manager_haiku.cpp -@@ -0,0 +1,214 @@ -+/* -+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-2017 John Preston, https://desktop.telegram.org -+*/ -+ -+#include -+#include -+#include -+#include -+ -+#include "platform/haiku/notifications_manager_haiku.h" -+ -+#include "window/notifications_utilities.h" -+#include "lang/lang_keys.h" -+#include "history/history.h" -+ -+#include -+#include -+#include -+#include -+#include -+ -+namespace Platform { -+namespace Notifications { -+namespace { -+ -+} // namespace -+ -+bool Supported() { -+ return true; -+} -+ -+std::unique_ptr Create(Window::Notifications::System *system) { -+ if (Global::NativeNotifications() && Supported()) { -+ auto result = std::make_unique(system); -+ if (result->init()) { -+ return std::move(result); -+ } -+ } -+ return nullptr; -+} -+ -+void Finish() { -+} -+ -+NotifyReader::NotifyReader() -+{ -+ unlink(NOTIFY_FIFO_NAME); -+ mkfifo(NOTIFY_FIFO_NAME, 0666); -+} -+ -+NotifyReader::~NotifyReader() -+{ -+ unlink(NOTIFY_FIFO_NAME); -+} -+ -+void NotifyReader::run() -+{ -+ char line[256]; -+ size_t n; -+ -+ for(;;) { -+ FILE *in=fopen(NOTIFY_FIFO_NAME, "rt"); -+ fgets(line, sizeof line, in); -+ fclose(in); -+ if (line[strlen(line)-1] == '\n') { -+ uint64 peerid = 0; -+ int32 msgid = 0; -+ QString paramsString = QString(line); -+ QStringList paramsList = paramsString.split(' '); -+ if (paramsList.count() == 2) { -+ bool peerStatus, msgStatus; -+ peerid = paramsList[0].toULongLong(&peerStatus, 16); -+ msgid = paramsList[1].toInt(&msgStatus, 16); -+ if (peerStatus & msgStatus) -+ notificationActivated(peerid, msgid); -+ } -+ } -+ } -+} -+ -+Manager::Private::Private(Manager *instance, Type type) -+: _guarded(std::make_shared(instance)) -+, _cachedUserpics(type) { -+ _weak = _guarded; -+} -+ -+bool Manager::Private::init() { -+ pipeReaderThread = new QThread; -+ pipeReader = new NotifyReader(); -+ pipeReader->moveToThread(pipeReaderThread); -+ connect(pipeReaderThread, SIGNAL(started()), pipeReader, SLOT(run())); -+ qRegisterMetaType("PeerId"); -+ qRegisterMetaType("MsgId"); -+ connect(pipeReader, SIGNAL(notificationActivated(PeerId, MsgId)), \ -+ this, SLOT(notificationActivatedSlot(PeerId, MsgId))); -+ pipeReaderThread->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); -+ -+ QString program = "/bin/notify"; -+ QStringList arguments; -+ arguments << "--icon" << userpicPath; -+ arguments << "--group" << "Telegram"; -+ arguments << "--title" << titleText; -+ arguments << "--onClickFile" << NOTIFY_GATE_NAME; -+ arguments << "--onClickArgv" << QString("0x%1 0x%2").arg(peer->id, 0, 16).arg(msgId, 0, 16); -+ arguments << msgText; -+ -+ QProcess *notifyProcess = new QProcess(); -+ notifyProcess->start(program, arguments); -+ -+ 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(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..53491b6 ---- /dev/null -+++ b/Telegram/SourceFiles/platform/haiku/notifications_manager_haiku.h -@@ -0,0 +1,126 @@ -+/* -+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-2017 John Preston, https://desktop.telegram.org -+*/ -+#pragma once -+ -+#include "platform/platform_notifications_manager.h" -+#include "window/notifications_utilities.h" -+ -+#include -+#include -+#include -+ -+#define NOTIFY_FIFO_NAME "/tmp/tg_notify" -+#define NOTIFY_GATE_NAME "/bin/tg-notify-gate" -+ -+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: -+ int pipeFD; -+}; -+ -+ -+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; -+}; -+ -+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 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 _guarded; -+ std::weak_ptr _weak; -+ QThread *pipeReaderThread; -+ NotifyReader *pipeReader; -+}; -+ -+} // 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..143fa79 ---- /dev/null -+++ b/Telegram/SourceFiles/platform/haiku/specific_haiku.cpp -@@ -0,0 +1,415 @@ -+/* -+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. -+ -+Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE -+Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org -+*/ -+#include "platform/haiku/specific_haiku.h" -+ -+#include "lang/lang_keys.h" -+#include "application.h" -+#include "mainwidget.h" -+#include "mainwindow.h" -+#include "storage/localstorage.h" -+#include "platform/haiku/file_utilities_haiku.h" -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+ -+#include -+ -+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::instance())->activeWindow() != nullptr; -+} -+ -+QString SystemCountry() { -+ return QString(); -+} -+ -+QString SystemLanguage() { -+ return QString(); -+} -+ -+void RegisterCustomScheme() { -+} -+ -+PermissionStatus GetPermissionStatus(PermissionType type){ -+ return PermissionStatus::Granted; -+} -+ -+void RequestPermission(PermissionType type, Fn resultCallback){ -+ resultCallback(PermissionStatus::Granted); -+} -+ -+void OpenSystemSettingsForPermission(PermissionType type){ -+} -+ -+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..99d13d5 ---- /dev/null -+++ b/Telegram/SourceFiles/platform/haiku/specific_haiku.h -@@ -0,0 +1,120 @@ -+/* -+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. -+ -+Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE -+Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org -+*/ -+#pragma once -+ -+//#include -+#include -+ -+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(); -+ } -+ -+}; -+ -+bool 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 03a32b2..1e17970 100644 ---- a/Telegram/SourceFiles/platform/platform_specific.h -+++ b/Telegram/SourceFiles/platform/platform_specific.h -@@ -49,6 +49,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 - #include -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 - #include -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 - #include -diff --git a/Telegram/SourceFiles/settings.cpp b/Telegram/SourceFiles/settings.cpp -index 0ab38d6..82f8a1f 100644 ---- a/Telegram/SourceFiles/settings.cpp -+++ b/Telegram/SourceFiles/settings.cpp -@@ -74,6 +74,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 641e485..a3acf2c 100644 ---- a/Telegram/SourceFiles/settings/settings_notifications.cpp -+++ b/Telegram/SourceFiles/settings/settings_notifications.cpp -@@ -552,6 +552,8 @@ void SetupNotificationsContent(not_null 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 7ff8dff..301e0f4 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', -@@ -98,7 +99,7 @@ - '<(libs_loc)/ffmpeg', - '<(libs_loc)/openal-soft/include', - '<(libs_loc)/opus/include', -- '<(libs_loc)/range-v3/include', -+ '<(submodules_loc)/range/include', - '<(minizip_loc)', - '<(sp_media_key_tap_loc)', - '<(emoji_suggestions_loc)', -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/lib_base.gyp b/Telegram/gyp/lib_base.gyp -index 1f3e9c3..d96dedd 100644 ---- a/Telegram/gyp/lib_base.gyp -+++ b/Telegram/gyp/lib_base.gyp -@@ -38,7 +38,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 2d1ac6c..d26d7c4 100644 ---- a/Telegram/gyp/lib_export.gyp -+++ b/Telegram/gyp/lib_export.gyp -@@ -48,7 +48,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 5277135..63996cf 100644 ---- a/Telegram/gyp/lib_storage.gyp -+++ b/Telegram/gyp/lib_storage.gyp -@@ -43,7 +43,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%': ' /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 a8c936d..86a58d7 100644 ---- a/Telegram/gyp/telegram_qrc.gypi -+++ b/Telegram/gyp/telegram_qrc.gypi -@@ -24,6 +24,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 3eedaab..1dac791 100644 ---- a/Telegram/gyp/telegram_sources.txt -+++ b/Telegram/gyp/telegram_sources.txt -@@ -473,6 +473,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 - diff --git a/net-im/telegram-desktop/patches/telegram_desktop-1.5.9-libtgvoip.patchset b/net-im/telegram-desktop/patches/telegram_desktop-1.5.11-libtgvoip.patchset similarity index 100% rename from net-im/telegram-desktop/patches/telegram_desktop-1.5.9-libtgvoip.patchset rename to net-im/telegram-desktop/patches/telegram_desktop-1.5.11-libtgvoip.patchset diff --git a/net-im/telegram-desktop/patches/telegram_desktop-1.5.9-systemqt.patch b/net-im/telegram-desktop/patches/telegram_desktop-1.5.11-systemqt.patch similarity index 97% rename from net-im/telegram-desktop/patches/telegram_desktop-1.5.9-systemqt.patch rename to net-im/telegram-desktop/patches/telegram_desktop-1.5.11-systemqt.patch index 90d84c0d1..02abdcc7d 100644 --- a/net-im/telegram-desktop/patches/telegram_desktop-1.5.9-systemqt.patch +++ b/net-im/telegram-desktop/patches/telegram_desktop-1.5.11-systemqt.patch @@ -33,19 +33,6 @@ index 1294075..faf45cd 100644 auto result = executeApplication(); DEBUG_LOG(("Telegram finished, result: %1").arg(result)); -diff --git a/Telegram/SourceFiles/platform/linux/linux_libs.h b/Telegram/SourceFiles/platform/linux/linux_libs.h -index 4834fee..2e60a65 100644 ---- a/Telegram/SourceFiles/platform/linux/linux_libs.h -+++ b/Telegram/SourceFiles/platform/linux/linux_libs.h -@@ -21,7 +21,7 @@ extern "C" { - } // extern "C" - - #ifndef TDESKTOP_DISABLE_UNITY_INTEGRATION --#include -+typedef void UnityLauncherEntry; - #endif // !TDESKTOP_DISABLE_UNITY_INTEGRATION - #endif // !TDESKTOP_DISABLE_GTK_INTEGRATION - diff --git a/Telegram/SourceFiles/qt_functions.cpp b/Telegram/SourceFiles/qt_functions.cpp new file mode 100644 index 0000000..4a722b8 diff --git a/net-im/telegram-desktop/patches/telegram_desktop-1.5.9.patchset b/net-im/telegram-desktop/patches/telegram_desktop-1.5.11.patchset similarity index 100% rename from net-im/telegram-desktop/patches/telegram_desktop-1.5.9.patchset rename to net-im/telegram-desktop/patches/telegram_desktop-1.5.11.patchset diff --git a/net-im/telegram-desktop/telegram_desktop-1.4.4.recipe b/net-im/telegram-desktop/telegram_desktop-1.4.4.recipe deleted file mode 100644 index f45705159..000000000 --- a/net-im/telegram-desktop/telegram_desktop-1.4.4.recipe +++ /dev/null @@ -1,157 +0,0 @@ -SUMMARY="Telegram Desktop Messenger" -DESCRIPTION="Official desktop version of Telegram messaging app." -HOMEPAGE="https://www.telegram.org/" -COPYRIGHT="2013-2018 Telegram" -LICENSE="GNU GPL v3" -REVISION="1" -SOURCE_URI="https://github.com/telegramdesktop/tdesktop/archive/v$portVersion.tar.gz" -CHECKSUM_SHA256="1a34737347b0fdd7f935213de9c39f40f7cf161a6cad10cceb1126ff74f7b4a9" -SOURCE_FILENAME="tdesktop-$portVersion.tar.gz" -SOURCE_DIR="tdesktop-$portVersion" -srcGitRev_2="697eea96aa90205db4fc368df4127eef56b2a5c6" -SOURCE_URI_2="https://github.com/telegramdesktop/libtgvoip/archive/$srcGitRev_2.tar.gz" -CHECKSUM_SHA256_2="1a7c7b7b3757a6eaec6ab283a0203426690775b2564b2ab5f5a26ab0518fe579" -SOURCE_FILENAME_2="libtgvoip-$srcGitRev_2.tar.gz" -srcGitRev_3="550ac2f159ca883d360c196149b466955c77a573" -SOURCE_URI_3="https://github.com/mapbox/variant/archive/$srcGitRev_3.tar.gz" -CHECKSUM_SHA256_3="aa794dfefe0a90501587e36d977b958d0df888503117a8d9aa43dc14f8526d9d" -SOURCE_FILENAME_3="variant-$srcGitRev_3.tar.gz" -srcGitRev_4="d846fe50a3f0bb7767c7e087a05f4be95f4da0ec" -SOURCE_URI_4="https://github.com/Microsoft/GSL/archive/$srcGitRev_4.tar.gz" -CHECKSUM_SHA256_4="be81db4ab1b57102a0fa1cd0c4a6469294eb9daf24294347592245b754f65ff6" -SOURCE_FILENAME_4="GSL-$srcGitRev_4.tar.gz" -srcGitRev_5="5ca44b68721833ae3731802ed99af67c6f38a53a" -SOURCE_URI_5="https://github.com/philsquared/Catch/archive/$srcGitRev_5.tar.gz" -CHECKSUM_SHA256_5="d24e6d9df2b8aa5739d3b9077c6b0ff0ef4d5ef8acc52c3a57e32893854d8d18" -SOURCE_FILENAME_5="Catch-$srcGitRev_5.tar.gz" -srcGitRev_6="4291015efab76bda5886a56b5007f4531be17d46" -SOURCE_URI_6="https://github.com/telegramdesktop/crl/archive/$srcGitRev_6.tar.gz" -CHECKSUM_SHA256_6="aee42a2fe003888d0d0133cd208a1524f5d95af6af506c1cd7e07e268d0d9081" -SOURCE_FILENAME_6="crl-$srcGitRev_6.tar.gz" -srcGitRev_7="4b10be9cbadd7d0880437f48f875185589fd86d3" -SOURCE_URI_7="https://github.com/ericniebler/range-v3/archive/$srcGitRev_7.tar.gz" -CHECKSUM_SHA256_7="86f6b8a2e2d8196d62312042af1953d0b16935550130a73ae0ec69f623b0b947" -SOURCE_FILENAME_7="range-$srcGitRev_7.tar.gz" -srcGitRev_8="7cc9639699f64b750c0b82333dced9ea77e8436e" -SOURCE_URI_8="https://github.com/Cyan4973/xxHash/archive/$srcGitRev_8.tar.gz" -CHECKSUM_SHA256_8="0d1e2b4ae15f98acc49084e23ba94853dba2b0f654865ecedb1072b3959421bf" -SOURCE_FILENAME_8="xxHash-$srcGitRev_8.tar.gz" -PATCHES=" - telegram_desktop-$portVersion-systemqt.patch - telegram_desktop-$portVersion.patchset - " -PATCHES_2=" - telegram_desktop-$portVersion-libtgvoip.patchset - " -ADDITIONAL_FILES="telegram_desktop.rdef.in" - -ARCHITECTURES="!x86_gcc2 x86_64" -SECONDARY_ARCHITECTURES="x86" - -PROVIDES=" - telegram_desktop$secondaryArchSuffix = $portVersion - app:Telegram$secondaryArchSuffix - cmd:tg_notify_gate - " -REQUIRES=" - haiku$secondaryArchSuffix - lib:libavcodec$secondaryArchSuffix - lib:libavformat$secondaryArchSuffix - lib:libavutil$secondaryArchSuffix - lib:libcrypto$secondaryArchSuffix - lib:libglib_2.0$secondaryArchSuffix - lib:libgthread_2.0$secondaryArchSuffix - lib:liblzma$secondaryArchSuffix - lib:libminizip$secondaryArchSuffix - lib:libopenal$secondaryArchSuffix - lib:libopus$secondaryArchSuffix - lib:libQt5Core$secondaryArchSuffix - lib:libQt5Gui$secondaryArchSuffix - lib:libQt5Network$secondaryArchSuffix - lib:libQt5Widgets$secondaryArchSuffix - lib:libswresample$secondaryArchSuffix - lib:libswscale$secondaryArchSuffix - lib:libz$secondaryArchSuffix - " - -BUILD_REQUIRES=" - haiku${secondaryArchSuffix}_devel - devel:libavcodec$secondaryArchSuffix - devel:libavformat$secondaryArchSuffix - devel:libavutil$secondaryArchSuffix - devel:libcrypto$secondaryArchSuffix - devel:libglib_2.0$secondaryArchSuffix - devel:libgthread_2.0$secondaryArchSuffix - devel:liblzma$secondaryArchSuffix - devel:libminizip$secondaryArchSuffix - devel:libopenal$secondaryArchSuffix - devel:libopus$secondaryArchSuffix - devel:libQt5Core$secondaryArchSuffix - devel:libQt5Gui$secondaryArchSuffix - devel:libQt5Network$secondaryArchSuffix - devel:libQt5Widgets$secondaryArchSuffix - devel:libswresample$secondaryArchSuffix - devel:libswscale$secondaryArchSuffix - devel:libz$secondaryArchSuffix - " -BUILD_PREREQUIRES=" - cmd:cmake - cmd:gcc$secondaryArchSuffix - cmd:gyp - cmd:make - cmd:pkg_config$secondaryArchSuffix - " - -PATCH() -{ - sed -i "s|@HAIKU_HEADERS@|/system/$relativeIncludeDir|" Telegram/gyp/telegram_haiku.gypi - sed -i "s|@HAIKU_HEADERS@|/system/$relativeIncludeDir|" Telegram/gyp/qt.gypi - sed -i "s|@HAIKU_LIBS@|/system/$relativeLibDir|" Telegram/gyp/telegram_haiku.gypi -} - -BUILD() -{ - # link submodules - rm -rf Telegram/ThirdParty/{libtgvoip,variant,GSL,Catch,crl,range,xxHash} - ln -sfn $sourceDir2/libtgvoip-$srcGitRev_2 Telegram/ThirdParty/libtgvoip - ln -sfn $sourceDir3/variant-$srcGitRev_3 Telegram/ThirdParty/variant - ln -sfn $sourceDir4/GSL-$srcGitRev_4 Telegram/ThirdParty/GSL - ln -sfn $sourceDir5/Catch2-$srcGitRev_5 Telegram/ThirdParty/Catch - ln -sfn $sourceDir6/crl-$srcGitRev_6 Telegram/ThirdParty/crl - ln -sfn $sourceDir7/range-v3-$srcGitRev_7 Telegram/ThirdParty/range - ln -sfn $sourceDir8/xxHash-$srcGitRev_8 Telegram/ThirdParty/xxHash - - Telegram/gyp/refresh.sh ; cd out/Release - # multi-job takes too much memory - make - - #build notify gate tool - gcc -o tg-notify-gate $sourceDir/Telegram/SourceFiles/platform/haiku/notifications_haiku_gate.cpp -lbe - rc -o tg-notify-gate.rsrc $sourceDir/Telegram/SourceFiles/platform/haiku/notifications_haiku_gate.rdef - xres -o tg-notify-gate tg-notify-gate.rsrc - mimeset --all tg-notify-gate -} - -INSTALL() -{ - mkdir -p $appsDir $prefix/bin - cp out/Release/tg-notify-gate $prefix/bin - cp out/Release/Telegram $appsDir - strip $appsDir/Telegram - - 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 > telegram_desktop.rdef - - addResourcesToBinaries telegram_desktop.rdef $appsDir/Telegram - addAppDeskbarSymlink $appsDir/Telegram -} diff --git a/net-im/telegram-desktop/telegram_desktop-1.5.9.recipe b/net-im/telegram-desktop/telegram_desktop-1.5.11.recipe similarity index 81% rename from net-im/telegram-desktop/telegram_desktop-1.5.9.recipe rename to net-im/telegram-desktop/telegram_desktop-1.5.11.recipe index ca18ceebf..e864f4ddb 100644 --- a/net-im/telegram-desktop/telegram_desktop-1.5.9.recipe +++ b/net-im/telegram-desktop/telegram_desktop-1.5.11.recipe @@ -5,7 +5,7 @@ COPYRIGHT="2013-2019 Telegram" LICENSE="GNU GPL v3" REVISION="1" SOURCE_URI="https://github.com/telegramdesktop/tdesktop/archive/v$portVersion.tar.gz" -CHECKSUM_SHA256="9f38732e9e90bbe94fc43a6b6502a5da322782001b9d19c56551856ded84025b" +CHECKSUM_SHA256="e7dde48fc0bb9d5e5a94d5f4300b68033700bb8bf7926d710334e0ba9b7d6af8" SOURCE_FILENAME="tdesktop-$portVersion.tar.gz" SOURCE_DIR="tdesktop-$portVersion" srcGitRev_2="59a975bf66c19ebddd8c82d9d501fddc02584d7c" @@ -36,6 +36,9 @@ srcGitRev_8="7cc9639699f64b750c0b82333dced9ea77e8436e" SOURCE_URI_8="https://github.com/Cyan4973/xxHash/archive/$srcGitRev_8.tar.gz" CHECKSUM_SHA256_8="0d1e2b4ae15f98acc49084e23ba94853dba2b0f654865ecedb1072b3959421bf" SOURCE_FILENAME_8="xxHash-$srcGitRev_8.tar.gz" +SOURCE_URI_9="https://salsa.debian.org/debian/telegram-desktop/raw/debian/master/debian/rules#noarchive" +CHECKSUM_SHA256_9="7ec2c62ee047ee003b267013719b17aa757278b07623fb9337b54d6c0c10d144" + PATCHES=" telegram_desktop-$portVersion-systemqt.patch telegram_desktop-$portVersion.patchset @@ -48,8 +51,8 @@ ADDITIONAL_FILES=" logo_256_no_margin.png " -ARCHITECTURES="!x86_gcc2 !x86_64" -SECONDARY_ARCHITECTURES="!x86" +ARCHITECTURES="!x86_gcc2 x86_64" +SECONDARY_ARCHITECTURES="x86" PROVIDES=" telegram_desktop$secondaryArchSuffix = $portVersion @@ -103,6 +106,7 @@ BUILD_PREREQUIRES=" cmd:gyp cmd:make cmd:pkg_config$secondaryArchSuffix + cmd:sed " PATCH() @@ -110,20 +114,7 @@ PATCH() sed -i "s|@HAIKU_HEADERS@|/system/$relativeIncludeDir|" Telegram/gyp/telegram_haiku.gypi sed -i "s|@HAIKU_HEADERS@|/system/$relativeIncludeDir|" Telegram/gyp/qt.gypi sed -i "s|@HAIKU_LIBS@|/system/$relativeLibDir|" Telegram/gyp/telegram_haiku.gypi - cp -f $sourceDir/../../../additional-files/logo_256_no_margin.png Telegram/Resources/art - - if [ -f $sourceDir/../../../additional-files/apikey.txt ]; then - echo "*********************************************************************" - echo "* INFO: additional-files/apikey.txt file found, use custom api key. *" - echo "*********************************************************************" - cp -f $sourceDir/../../../additional-files/apikey.txt Telegram/gyp/apikey.txt - else - echo "**************************************************************************" - echo "* WARNING: additional-files/apikey.txt file not found, use demo api key. *" - echo "**************************************************************************" - cp -f $sourceDir/../../../additional-files/demo_apikey.txt Telegram/gyp/apikey.txt - fi } BUILD() @@ -138,7 +129,23 @@ BUILD() ln -sfn $sourceDir7/range-v3-$srcGitRev_7 Telegram/ThirdParty/range ln -sfn $sourceDir8/xxHash-$srcGitRev_8 Telegram/ThirdParty/xxHash - Telegram/gyp/refresh.sh `cat Telegram/gyp/apikey.txt` + # get API_ID and API_HASH from Debian + local TELEGRAM_API_ID=`sed -n 's/TELEGRAM_API_ID = \(.*\)/\1/p' < $sourceDir9/rules` + local TELEGRAM_API_HASH=`sed -n 's/TELEGRAM_API_HASH = \(.*\)/\1/p' < $sourceDir9/rules` + + 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 + + Telegram/gyp/refresh.sh --api-id $TELEGRAM_API_ID --api-hash $TELEGRAM_API_HASH cd out/Release # multi-job takes too much memory make