From 9ff7a8371d1b7a3f35bc61932253f2e04512e0e3 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Mon, 30 May 2022 23:22:57 +0200 Subject: [PATCH] README: build instructions | Try to avoid ghost chats in main list --- README.md | 5 +++-- rpm/harbour-fernschreiber.spec | 2 +- rpm/harbour-fernschreiber.yaml | 2 +- src/chatlistmodel.cpp | 11 ++++++----- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index e745b83..765e970 100644 --- a/README.md +++ b/README.md @@ -48,16 +48,17 @@ const char TDLIB_API_HASH[] = "1234567890abcdef1234567890abcdef"; You get the Telegram API ID and hash as soon as you've registered your own application on [https://my.telegram.org](https://my.telegram.org). -Moreover, you need to have a compiled version of [TDLib 1.7](https://github.com/tdlib/td) in the sub-directory `tdlib`. This sub-directory must contain another sub-directory that fits to the target device architecture (e.g. armv7hl, i486). Within this directory, there needs to be a folder called `lib` that contains at least `libtdjson.so`. For armv7hl the relative path would consequently be `tdlib/armv7hl/lib`. +Moreover, you need to have a compiled version of [TDLib 1.8.3](https://github.com/tdlib/td) or higher in the sub-directory `tdlib`. This sub-directory must contain another sub-directory that fits to the target device architecture (e.g. armv7hl, i486). Within this directory, there needs to be a folder called `lib` that contains at least `libtdjson.so`. For armv7hl the relative path would consequently be `tdlib/armv7hl/lib`. You may just want to download the [tdlib.zip from our fork](https://github.com/Wunderfitz/td/releases) to just use the exact version of the latest official Fernschreiber release. To use it, you need to extract it into your local `tdlib/` folder as described above. If so, you're done and can compile Fernschreiber using the Sailfish SDK. If you want to build TDLib for yourself, please keep on reading. In case you want to use the same codebase which was used to compile the library that is shipped with Fernschreiber, please [check out the fork](https://github.com/Wunderfitz/td), be sure to use the branch `fernschreiber` and compile these sources using the following commands (be sure to have the Sailfish OS build engine running): - `alias sfdk=~/SailfishOS/bin/sfdk` -- `sfdk config target=SailfishOS-3.3.0.16-armv7hl` (this compiles the sources on SFOS 3.3 and ARM - the target needs to be adjusted according to the running SDK engine and the platform) +- `sfdk config target=SailfishOS-4.4.0.58-armv7hl` (this compiles the sources on SFOS 4.4 and ARM - the target needs to be adjusted according to the running SDK engine and the platform) - `mkdir build` - `cd build` +- `sfdk build-init` - `sfdk build-shell cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=../tdlib -DTD_ENABLE_LTO=ON ..` (in case of compilation issues, try removing the flag `-DTD_ENABLE_LTO=ON`) - `sfdk build-shell cmake --build . --target install` diff --git a/rpm/harbour-fernschreiber.spec b/rpm/harbour-fernschreiber.spec index cbf3ccc..10e247d 100644 --- a/rpm/harbour-fernschreiber.spec +++ b/rpm/harbour-fernschreiber.spec @@ -12,7 +12,7 @@ Name: harbour-fernschreiber Summary: Fernschreiber is a Telegram client for Sailfish OS Version: 0.16 -Release: 1 +Release: 2 Group: Qt/Qt License: LICENSE URL: http://werkwolf.eu/ diff --git a/rpm/harbour-fernschreiber.yaml b/rpm/harbour-fernschreiber.yaml index 5381e24..c3dd4f4 100644 --- a/rpm/harbour-fernschreiber.yaml +++ b/rpm/harbour-fernschreiber.yaml @@ -1,7 +1,7 @@ Name: harbour-fernschreiber Summary: Fernschreiber is a Telegram client for Sailfish OS Version: 0.16 -Release: 1 +Release: 2 # The contents of the Group field should be one of the groups listed here: # https://github.com/mer-tools/spectacle/blob/master/data/GROUPS Group: Qt/Qt diff --git a/src/chatlistmodel.cpp b/src/chatlistmodel.cpp index 01f84ad..f5fa42b 100644 --- a/src/chatlistmodel.cpp +++ b/src/chatlistmodel.cpp @@ -250,21 +250,22 @@ bool ChatListModel::ChatData::isHidden() const switch (memberStatus) { case TDLibWrapper::ChatMemberStatusLeft: case TDLibWrapper::ChatMemberStatusUnknown: + case TDLibWrapper::ChatMemberStatusBanned: return true; case TDLibWrapper::ChatMemberStatusCreator: case TDLibWrapper::ChatMemberStatusAdministrator: case TDLibWrapper::ChatMemberStatusMember: case TDLibWrapper::ChatMemberStatusRestricted: - case TDLibWrapper::ChatMemberStatusBanned: + if (chatData.value(LAST_MESSAGE).isNull()) { + return true; + } break; } break; case TDLibWrapper::ChatTypeUnknown: - break; + return true; case TDLibWrapper::ChatTypePrivate: - if (chatData.value(LAST_MESSAGE).isNull() - && chatData.value(LAST_READ_INBOX_MESSAGE_ID).toLongLong() == 0 - && chatData.value(LAST_READ_OUTBOX_MESSAGE_ID).toLongLong() == 0) { + if (chatData.value(LAST_MESSAGE).isNull()) { return true; } break;