From acd60eaba2e7a8156635360a8ca81ffd3ba90929 Mon Sep 17 00:00:00 2001 From: blue Date: Sun, 4 Feb 2024 09:44:19 -0300 Subject: [PATCH] Fixing build without omemo, release preparation, unnecessary inheritance removed, info widget fix --- .gitea/workflows/release.yml | 45 +++++++++++++++++++++++++++++++++++ CHANGELOG.md | 4 +++- CMakeLists.txt | 2 +- core/account.h | 12 ++++++---- core/delayManager/info.cpp | 3 +++ core/delayManager/manager.cpp | 4 ++++ core/delayManager/manager.h | 6 +++++ core/handlers/CMakeLists.txt | 12 +++++----- packaging/Archlinux/PKGBUILD | 6 ++--- shared/global.cpp | 2 +- shared/info.h | 2 +- ui/widgets/about.cpp | 20 +++++++--------- ui/widgets/about.h | 14 +++-------- 13 files changed, 92 insertions(+), 40 deletions(-) create mode 100644 .gitea/workflows/release.yml diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml new file mode 100644 index 0000000..f8bbef7 --- /dev/null +++ b/.gitea/workflows/release.yml @@ -0,0 +1,45 @@ +name: Squawk Release workflow +run-name: ${{ gitea.actor }} is running Squawk Release workflow on release ${{ gitea.event.release.tag_name }} +on: + release: + types: [published] + +jobs: + Archlinux: + runs-on: archlinux + steps: + - name: Download the release tarball + run: curl -sL ${{ gitea.server_url }}/${{ gitea.repository }}/archive/${{ gitea.event.release.tag_name }}.tar.gz --output tarball.tar.gz + + - name: Calculate SHA256 for the tarball + run: echo "tbSum=$(sha256sum tarball.tar.gz | cut -d ' ' -f 1)" >> $GITHUB_ENV + + - name: Unarchive tarball + run: tar -xvzf tarball.tar.gz + + - name: Clone the AUR repository + run: | + echo "${{ secrets.DEPLOY_TO_AUR_PRIVATE_KEY }}" > key + chmod 600 key + GIT_SSH_COMMAND="ssh -i key -o 'IdentitiesOnly yes' -o 'StrictHostKeyChecking no'" git clone ssh://aur@aur.archlinux.org/squawk.git aur + chmod 777 -R aur + cd aur + git config user.name ${{ secrets.DEPLOY_TO_AUR_USER_NAME }} + git config user.email ${{ secrets.DEPLOY_TO_AUR_EMAIL }} + + + - name: Copy PKGBUILD to the directory + run: cp squawk/packaging/Archlinux/PKGBUILD aur/ + + - name: Put SHA256 sum to PKGBUILD file, and generate .SRCINFO + working-directory: aur + run: | + sed -i "/sha256sums=/c\sha256sums=('${{ env.tbSum }}')" PKGBUILD + sudo -u build makepkg --printsrcinfo > .SRCINFO + + - name: Commit package to aur + working-directory: aur + run: | + git add PKGBUILD .SRCINFO + git commit -m "${{ gitea.event.release.body }}" + GIT_SSH_COMMAND="ssh -i ../key -o 'IdentitiesOnly yes' -o 'StrictHostKeyChecking no'" git push diff --git a/CHANGELOG.md b/CHANGELOG.md index f554982..0c11404 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,10 @@ # Changelog -## Squawk 0.2.3 (UNRELEASED) +## Squawk 0.2.3 (February 04, 2024) ### Bug fixes - "Add contact" and "Join conference" menu are enabled once again (pavavno)! - availability is now read from the same section of config file it was stored +- automatic avatars (if a contact doesn't have one) get generated once again ### Improvements - deactivated accounts now don't appear in combobox of "Add contact" and "Join conference" dialogues @@ -11,6 +12,7 @@ - settings file on the disk is not rewritten every roster element expansion or collapse - removed unnecessary own vcard request at sturtup (used to do it to discover my own avatar) - vcard window now is Info system and it can display more information +- reduced vcard request spam in MUCs ### New features - now you can enable tray icon from settings! diff --git a/CMakeLists.txt b/CMakeLists.txt index edf9297..e2465cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,7 @@ option(SYSTEM_LMDBAL "Use system lmdbal lib" ON) option(WITH_KWALLET "Build KWallet support module" ON) option(WITH_KIO "Build KIO support module" ON) option(WITH_KCONFIG "Build KConfig support module" ON) -option(WITH_OMEMO "Build OMEMO support module" ON) +option(WITH_OMEMO "Build OMEMO support module" OFF) #it should be off by default untill I sourt the problems out # Dependencies ## Qt diff --git a/core/account.h b/core/account.h index ea1a13d..4cd3316 100644 --- a/core/account.h +++ b/core/account.h @@ -60,11 +60,13 @@ #include "handlers/vcardhandler.h" #include "handlers/discoveryhandler.h" -#ifdef WITH_OMEMO -#include -#include -#include "handlers/trusthandler.h" -#include "handlers/omemohandler.h" +#if (QXMPP_VERSION) >= QT_VERSION_CHECK(1, 5, 0) + #include + #ifdef WITH_OMEMO + #include + #include "handlers/omemohandler.h" + #endif + #include "handlers/trusthandler.h" #endif namespace Core { diff --git a/core/delayManager/info.cpp b/core/delayManager/info.cpp index 9953fd4..1b8da8d 100644 --- a/core/delayManager/info.cpp +++ b/core/delayManager/info.cpp @@ -45,7 +45,10 @@ void Core::DelayManager::Info::receivedVCard(const Shared::VCard& card) { throw 245; info = new Shared::VCard(card); + +#ifdef WITH_OMEMO stage = Stage::waitingForBundles; +#endif } Shared::VCard * Core::DelayManager::Info::claim() { diff --git a/core/delayManager/manager.cpp b/core/delayManager/manager.cpp index de37d47..efafaf5 100644 --- a/core/delayManager/manager.cpp +++ b/core/delayManager/manager.cpp @@ -242,7 +242,9 @@ void Core::DelayManager::Manager::jobIsCanceled(Job* job, bool wasRunning) { emit gotVCard(jb->jid, Shared::VCard()); break; case InfoForUser::Stage::waitingForBundles: +#ifdef WITH_OMEMO requestedBundles.erase(jb->jid); +#endif break; default: break; @@ -356,6 +358,7 @@ void Core::DelayManager::Manager::receivedOwnVCard(const Shared::VCard& card) { } } +#ifdef WITH_OMEMO void Core::DelayManager::Manager::receivedBundles(const QString& jid, const std::list& keys) { std::map::const_iterator itr = requestedBundles.find(jid); if (itr == requestedBundles.end()) { @@ -397,6 +400,7 @@ void Core::DelayManager::Manager::receivedOwnBundles(const std::list& keys); void receivedOwnBundles(const std::list& keys); +#endif private: void preScheduleJob(Job* job); diff --git a/core/handlers/CMakeLists.txt b/core/handlers/CMakeLists.txt index 11a902d..ed359bd 100644 --- a/core/handlers/CMakeLists.txt +++ b/core/handlers/CMakeLists.txt @@ -3,7 +3,6 @@ set(SOURCE_FILES rosterhandler.cpp vcardhandler.cpp discoveryhandler.cpp - omemohandler.cpp trusthandler.cpp ) @@ -12,11 +11,12 @@ set(HEADER_FILES rosterhandler.h vcardhandler.h discoveryhandler.h - omemohandler.h trusthandler.h ) -target_sources(squawk PRIVATE - ${SOURCE_FILES} - ${HEADER_FILES} -) +if(WITH_OMEMO) + list(APPEND SOURCE_FILES omemohandler.cpp) + list(APPEND HEADER_FILES omemohandler.h) +endif() + +target_sources(squawk PRIVATE ${SOURCE_FILES}) diff --git a/packaging/Archlinux/PKGBUILD b/packaging/Archlinux/PKGBUILD index bd9c981..53347dc 100644 --- a/packaging/Archlinux/PKGBUILD +++ b/packaging/Archlinux/PKGBUILD @@ -6,15 +6,15 @@ pkgdesc="An XMPP desktop messenger, written on pure c++ (qt)" arch=('i686' 'x86_64') url="https://git.macaw.me/blue/squawk" license=('GPL3') -depends=('hicolor-icon-theme' 'desktop-file-utils' 'lmdbal' 'qxmpp>=1.1.0') +depends=('hicolor-icon-theme' 'desktop-file-utils' 'lmdbal' 'qxmpp-qt5') makedepends=('cmake>=3.3' 'imagemagick' 'qt5-tools' 'boost') optdepends=('kwallet: secure password storage (requires rebuild)' 'kconfig: system themes support (requires rebuild)' 'kconfigwidgets: system themes support (requires rebuild)' 'kio: better show in folder action (requires rebuild)') -source=("$pkgname-$pkgver.tar.gz") -sha256sums=('e4fa2174a3ba95159cc3b0bac3f00550c9e0ce971c55334e2662696a4543fc7e') +source=("$pkgname-$pkgver.tar.gz::https://git.macaw.me/blue/$pkgname/archive/$pkgver.tar.gz") +sha256sums=('SKIP') build() { cd "$srcdir/squawk" cmake . -D CMAKE_INSTALL_PREFIX=/usr -D CMAKE_BUILD_TYPE=Release diff --git a/shared/global.cpp b/shared/global.cpp index 97f3263..6618426 100644 --- a/shared/global.cpp +++ b/shared/global.cpp @@ -24,7 +24,7 @@ #ifdef WITH_OMEMO constexpr bool OMEMO_SUPPORT = true; #else -constexpr bool OMEMO_SUPPORT = false +constexpr bool OMEMO_SUPPORT = false; #endif QFont getFont (QFontDatabase::SystemFont type, bool bold = false, bool italic = false, qreal factor = 1.0) { diff --git a/shared/info.h b/shared/info.h index 90feadb..ae34ef2 100644 --- a/shared/info.h +++ b/shared/info.h @@ -31,7 +31,7 @@ namespace Shared { * * under development yet */ -class Info : public QObject, public VCard { +class Info { public: Info (); Info (const QString& address, EntryType = EntryType::none); diff --git a/ui/widgets/about.cpp b/ui/widgets/about.cpp index f46c661..ca1bfa2 100644 --- a/ui/widgets/about.cpp +++ b/ui/widgets/about.cpp @@ -19,13 +19,13 @@ #include #include -#if (QXMPP_VERSION) < QT_VERSION_CHECK(1, 3, 0) -static const std::string QXMPP_VERSION_PATCH(std::to_string(QXMPP_VERSION & 0xff)); -static const std::string QXMPP_VERSION_MINOR(std::to_string((QXMPP_VERSION & 0xff00) >> 8)); -static const std::string QXMPP_VERSION_MAJOR(std::to_string(QXMPP_VERSION >> 16)); -static const QString QXMPP_VERSION_STRING = QString::fromStdString(QXMPP_VERSION_MAJOR + "." + QXMPP_VERSION_MINOR + "." + QXMPP_VERSION_PATCH); +#if (QXMPP_VERSION) < QT_VERSION_CHECK(1, 2, 0) +static const std::string _QXMPP_PATCH_(std::to_string(QXMPP_VERSION & 0xff)); +static const std::string _QXMPP_MINOR_(std::to_string((QXMPP_VERSION & 0xff00) >> 8)); +static const std::string _QXMPP_MAJOR_(std::to_string(QXMPP_VERSION >> 16)); +static const QString SQUAWK_INNER_QXMPP_VERSION_STRING = QString::fromStdString(_QXMPP_MAJOR_ + "." + _QXMPP_MINOR_ + "." + _QXMPP_PATCH_); #else -static const QString QXMPP_VERSION_STRING = QXmppVersion(); +static const QString SQUAWK_INNER_QXMPP_VERSION_STRING = QXmppVersion(); #endif About::About(QWidget* parent): @@ -39,7 +39,7 @@ About::About(QWidget* parent): m_ui->qtBuiltAgainstVersion->setText(tr("(built against %1)").arg(QT_VERSION_STR)); m_ui->qxmppVersionValue->setText(QXmppVersion()); - m_ui->qxmppBuiltAgainstVersion->setText(tr("(built against %1)").arg(QXMPP_VERSION_STRING)); + m_ui->qxmppBuiltAgainstVersion->setText(tr("(built against %1)").arg(SQUAWK_INNER_QXMPP_VERSION_STRING)); setWindowFlag(Qt::Tool); @@ -52,8 +52,7 @@ About::~About() { } }; -void About::onLicenseActivated() -{ +void About::onLicenseActivated() { if (license == nullptr) { QFile file; bool found = false; @@ -106,7 +105,6 @@ void About::onLicenseActivated() license->show(); } -void About::onLicenseClosed() -{ +void About::onLicenseClosed() { license = nullptr; } diff --git a/ui/widgets/about.h b/ui/widgets/about.h index 1506b7f..35df9f4 100644 --- a/ui/widgets/about.h +++ b/ui/widgets/about.h @@ -14,8 +14,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#ifndef ABOUT_H -#define ABOUT_H +#pragma once #include #include @@ -24,16 +23,11 @@ #include #include -namespace Ui -{ +namespace Ui{ class About; } -/** - * @todo write docs - */ -class About : public QWidget -{ +class About : public QWidget { Q_OBJECT public: About(QWidget* parent = nullptr); @@ -47,5 +41,3 @@ private: QScopedPointer m_ui; QWidget* license; }; - -#endif // ABOUT_H