From 3c6b611a411e978d4b9e7e36709b342d6e344ba1 Mon Sep 17 00:00:00 2001 From: blue Date: Sun, 29 Jan 2023 20:26:54 +0300 Subject: [PATCH] keeping up with qxmpp --- CMakeLists.txt | 1 + core/account.cpp | 27 +++----- core/adapterfunctions.h | 15 +++++ core/handlers/messagehandler.cpp | 29 ++++++++ core/handlers/omemohandler.cpp | 54 +++++++-------- core/handlers/omemohandler.h | 23 +++---- core/handlers/trusthandler.cpp | 109 ++++++++++--------------------- core/handlers/trusthandler.h | 35 +++++----- external/qxmpp | 2 +- ui/widgets/about.cpp | 4 ++ 10 files changed, 146 insertions(+), 153 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b40e876..01a9bd1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -130,6 +130,7 @@ if (NOT SYSTEM_QXMPP) target_include_directories(squawk PRIVATE ${CMAKE_SOURCE_DIR}/external/qxmpp/src/base) target_include_directories(squawk PRIVATE ${CMAKE_SOURCE_DIR}/external/qxmpp/src/client) + target_include_directories(squawk PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/external/qxmpp/src) if (WITH_OMEMO) target_include_directories(squawk PRIVATE ${CMAKE_SOURCE_DIR}/external/qxmpp/src/omemo) diff --git a/core/account.cpp b/core/account.cpp index e1bbfb9..bb3ebea 100644 --- a/core/account.cpp +++ b/core/account.cpp @@ -108,23 +108,19 @@ Account::Account(const QString& p_login, const QString& p_server, const QString& client.addExtension(om); if (oh->hasOwnDevice()) { - QFuture future = om->load(); + QXmppTask future = om->load(); loadingOmemo = true; - - QFutureWatcher *watcher = new QFutureWatcher(this); - QObject::connect(watcher, &QFutureWatcherBase::finished, [watcher, this] () { + future.then(this, [this] (bool result) { loadingOmemo = false; if (state == Shared::ConnectionState::scheduled) { client.connectToServer(config, presence); } - if (watcher->result()) { + if (result) { qDebug() << "successfully loaded OMEMO data for account" << getName(); } else { qDebug() << "couldn't load OMEMO data for account" << getName(); } - watcher->deleteLater(); }); - watcher->setFuture(future); } #endif @@ -235,20 +231,17 @@ void Core::Account::onClientStateChange(QXmppClient::State st) #ifdef WITH_OMEMO if (!oh->hasOwnDevice()) { qDebug() << "setting up OMEMO data for account" << getName(); - QFuture future = om->setUp(); - QFutureWatcher *watcher = new QFutureWatcher(this); - QObject::connect(watcher, &QFutureWatcherBase::finished, [watcher, this] () { - if (watcher->result()) { + QXmppTask future = om->setUp(); + future.then(this, [this] (bool result) { + if (result) qDebug() << "successfully set up OMEMO data for account" << getName(); - } else { + else qDebug() << "couldn't set up OMEMO data for account" << getName(); - } - watcher->deleteLater(); - if (state == Shared::ConnectionState::connected) { + + if (state == Shared::ConnectionState::connected) runDiscoveryService(); - } + }); - watcher->setFuture(future); } else { runDiscoveryService(); } diff --git a/core/adapterfunctions.h b/core/adapterfunctions.h index 6e50a75..287816b 100644 --- a/core/adapterfunctions.h +++ b/core/adapterfunctions.h @@ -19,6 +19,8 @@ #define CORE_ADAPTER_FUNCTIONS_H #include +#include +#include #include namespace Core { @@ -26,6 +28,19 @@ namespace Core { void initializeVCard(Shared::VCard& vCard, const QXmppVCardIq& card); void initializeQXmppVCard(QXmppVCardIq& card, const Shared::VCard& vCard); +template +QXmppTask makeReadyTask(T &&value) { + QXmppPromise promise; + promise.finish(std::move(value)); + return promise.task(); +} + +inline QXmppTask makeReadyTask() { + QXmppPromise promise; + promise.finish(); + return promise.task(); +} + } diff --git a/core/handlers/messagehandler.cpp b/core/handlers/messagehandler.cpp index b6d32b9..b11ea2a 100644 --- a/core/handlers/messagehandler.cpp +++ b/core/handlers/messagehandler.cpp @@ -29,6 +29,35 @@ Core::MessageHandler::MessageHandler(Core::Account* account): void Core::MessageHandler::onMessageReceived(const QXmppMessage& msg) { +#if (QXMPP_VERSION) >= QT_VERSION_CHECK(1, 5, 0) +#ifdef WITH_OMEMO + switch (msg.encryptionMethod()) { + case QXmpp::NoEncryption: + break; //just do nothing + case QXmpp::UnknownEncryption: + qDebug() << "Account" << acc->getName() << "received a message with unknown encryption type"; + break; //let it go the way it is, there is nothing I can do here + case QXmpp::Otr: + qDebug() << "Account" << acc->getName() << "received an OTR encrypted message, not supported yet"; + break; //let it go the way it is, there is nothing I can do yet + case QXmpp::LegacyOpenPgp: + qDebug() << "Account" << acc->getName() << "received an LegacyOpenPgp encrypted message, not supported yet"; + break; //let it go the way it is, there is nothing I can do yet + case QXmpp::Ox: + qDebug() << "Account" << acc->getName() << "received an Ox encrypted message, not supported yet"; + break; //let it go the way it is, there is nothing I can do yet + case QXmpp::Omemo0: + qDebug() << "Account" << acc->getName() << "received an Omemo0 encrypted message, not supported yet"; + break; //let it go the way it is, there is nothing I can do yet + case QXmpp::Omemo1: + qDebug() << "Account" << acc->getName() << "received an Omemo1 encrypted message, not supported yet"; + break; //let it go the way it is, there is nothing I can do yet + case QXmpp::Omemo2: + qDebug() << "Account" << acc->getName() << "received an Omemo2 encrypted message, not supported yet"; + break; //let it go the way it is, there is nothing I can do yet + } +#endif +#endif bool handled = false; switch (msg.type()) { case QXmppMessage::Normal: diff --git a/core/handlers/omemohandler.cpp b/core/handlers/omemohandler.cpp index 57d9749..2b864e1 100644 --- a/core/handlers/omemohandler.cpp +++ b/core/handlers/omemohandler.cpp @@ -17,6 +17,7 @@ #include #include "omemohandler.h" #include "core/account.h" +#include "core/adapterfunctions.h" Core::OmemoHandler::OmemoHandler(Account* account) : QXmppOmemoStorage(), @@ -46,13 +47,7 @@ bool Core::OmemoHandler::hasOwnDevice() { return ownDevice.has_value(); } -QFuture Core::OmemoHandler::emptyVoidFuture() { - QFutureInterface result(QFutureInterfaceBase::Started); - result.reportFinished(); - return result.future(); -} - -QFuture Core::OmemoHandler::allData() { +QXmppTask Core::OmemoHandler::allData() { OmemoData data; data.ownDevice = ownDevice; @@ -72,13 +67,10 @@ QFuture Core::OmemoHandler::allData() { data.devices.insert(pair.first, pair.second); } - QFutureInterface result(QFutureInterfaceBase::Started); - result.reportResult(std::move(data)); - result.reportFinished(); - return result.future(); + return Core::makeReadyTask(std::move(data)); } -QFuture Core::OmemoHandler::addDevice(const QString& jid, uint32_t deviceId, const QXmppOmemoStorage::Device& device) { +QXmppTask Core::OmemoHandler::addDevice(const QString& jid, uint32_t deviceId, const QXmppOmemoStorage::Device& device) { QHash devs; bool had = true; try { @@ -94,23 +86,23 @@ QFuture Core::OmemoHandler::addDevice(const QString& jid, uint32_t deviceI devices->addRecord(jid, devs); } - return emptyVoidFuture(); + return Core::makeReadyTask(); } -QFuture Core::OmemoHandler::addPreKeyPairs(const QHash& keyPairs) { +QXmppTask Core::OmemoHandler::addPreKeyPairs(const QHash& keyPairs) { for (QHash::const_iterator itr = keyPairs.begin(), end = keyPairs.end(); itr != end; ++itr) { preKeyPairs->forceRecord(itr.key(), itr.value()); } - return emptyVoidFuture(); + return Core::makeReadyTask(); } -QFuture Core::OmemoHandler::addSignedPreKeyPair(uint32_t keyId, const QXmppOmemoStorage::SignedPreKeyPair& keyPair) { +QXmppTask Core::OmemoHandler::addSignedPreKeyPair(uint32_t keyId, const QXmppOmemoStorage::SignedPreKeyPair& keyPair) { signedPreKeyPairs->forceRecord(keyId, std::make_pair(keyPair.creationDate, keyPair.data)); - return emptyVoidFuture(); + return Core::makeReadyTask(); } -QFuture Core::OmemoHandler::removeDevice(const QString& jid, uint32_t deviceId) { +QXmppTask Core::OmemoHandler::removeDevice(const QString& jid, uint32_t deviceId) { QHash devs = devices->getRecord(jid); devs.remove(deviceId); if (devs.isEmpty()) { @@ -118,25 +110,27 @@ QFuture Core::OmemoHandler::removeDevice(const QString& jid, uint32_t devi } else { devices->changeRecord(jid, devs); } - return emptyVoidFuture(); + return Core::makeReadyTask(); } -QFuture Core::OmemoHandler::removeDevices(const QString& jid) { +QXmppTask Core::OmemoHandler::removeDevices(const QString& jid) { devices->removeRecord(jid); - return emptyVoidFuture(); + return Core::makeReadyTask(); } -QFuture Core::OmemoHandler::removePreKeyPair(uint32_t keyId) { +QXmppTask Core::OmemoHandler::removePreKeyPair(uint32_t keyId) { preKeyPairs->removeRecord(keyId); - return emptyVoidFuture(); + return Core::makeReadyTask(); } -QFuture Core::OmemoHandler::removeSignedPreKeyPair(uint32_t keyId) { - signedPreKeyPairs->removeRecord(keyId); - return emptyVoidFuture(); +QXmppTask Core::OmemoHandler::removeSignedPreKeyPair(uint32_t keyId) { + try { + signedPreKeyPairs->removeRecord(keyId); + } catch (const DataBase::NotFound& e) {} + return Core::makeReadyTask(); } -QFuture Core::OmemoHandler::setOwnDevice(const std::optional& device) { +QXmppTask Core::OmemoHandler::setOwnDevice(const std::optional& device) { bool had = ownDevice.has_value(); ownDevice = device; if (ownDevice.has_value()) { @@ -150,14 +144,14 @@ QFuture Core::OmemoHandler::setOwnDevice(const std::optional& d meta->removeRecord("ownDevice"); } } - return emptyVoidFuture(); + return Core::makeReadyTask(); } -QFuture Core::OmemoHandler::resetAll() { +QXmppTask Core::OmemoHandler::resetAll() { ownDevice = std::nullopt; db.drop(); - return emptyVoidFuture(); + return Core::makeReadyTask(); } QDataStream & operator >> (QDataStream& in, QXmppOmemoStorage::Device& device) { diff --git a/core/handlers/omemohandler.h b/core/handlers/omemohandler.h index cea9603..7783c04 100644 --- a/core/handlers/omemohandler.h +++ b/core/handlers/omemohandler.h @@ -34,27 +34,24 @@ public: OmemoHandler(Account* account); ~OmemoHandler() override; - QFuture allData() override; + QXmppTask allData() override; - QFuture setOwnDevice(const std::optional &device) override; + QXmppTask setOwnDevice(const std::optional &device) override; - QFuture addSignedPreKeyPair(uint32_t keyId, const QXmppOmemoStorage::SignedPreKeyPair &keyPair) override; - QFuture removeSignedPreKeyPair(uint32_t keyId) override; + QXmppTask addSignedPreKeyPair(uint32_t keyId, const QXmppOmemoStorage::SignedPreKeyPair &keyPair) override; + QXmppTask removeSignedPreKeyPair(uint32_t keyId) override; - QFuture addPreKeyPairs(const QHash &keyPairs) override; - QFuture removePreKeyPair(uint32_t keyId) override; + QXmppTask addPreKeyPairs(const QHash &keyPairs) override; + QXmppTask removePreKeyPair(uint32_t keyId) override; - QFuture addDevice(const QString &jid, uint32_t deviceId, const Device &device) override; - QFuture removeDevice(const QString &jid, uint32_t deviceId) override; - QFuture removeDevices(const QString &jid) override; + QXmppTask addDevice(const QString &jid, uint32_t deviceId, const Device &device) override; + QXmppTask removeDevice(const QString &jid, uint32_t deviceId) override; + QXmppTask removeDevices(const QString &jid) override; - QFuture resetAll() override; + QXmppTask resetAll() override; bool hasOwnDevice(); -private: - static QFuture emptyVoidFuture(); - private: Account* acc; std::optional ownDevice; diff --git a/core/handlers/trusthandler.cpp b/core/handlers/trusthandler.cpp index caaaf0e..3ea6e47 100644 --- a/core/handlers/trusthandler.cpp +++ b/core/handlers/trusthandler.cpp @@ -16,6 +16,7 @@ #include "trusthandler.h" #include "core/account.h" +#include "core/adapterfunctions.h" using namespace Core; @@ -75,37 +76,25 @@ Core::TrustHandler::KeyCache * Core::TrustHandler::createNewCache(const QString& return cache; } - -QFuture Core::TrustHandler::emptyVoidFuture() { - QFutureInterface result(QFutureInterfaceBase::Started); - result.reportFinished(); - return result.future(); -} - - -QFuture Core::TrustHandler::resetAll(const QString& encryption) { +QXmppTask Core::TrustHandler::resetAll(const QString& encryption) { securityPolicies->removeRecord(encryption); ownKeys->removeRecord(encryption); getCache(encryption)->drop(); - return emptyVoidFuture(); + return Core::makeReadyTask(); } -QFuture Core::TrustHandler::trustLevel( +QXmppTask Core::TrustHandler::trustLevel( const QString& encryption, const QString& keyOwnerJid, const QByteArray& keyId) { Keys map = getCache(encryption)->getRecord(keyOwnerJid); Shared::TrustLevel level = map.at(keyId); - - QFutureInterface result(QFutureInterfaceBase::Started); - result.reportResult(convert(level)); - result.reportFinished(); - return result.future(); + return Core::makeReadyTask(std::move(convert(level))); } -QFuture>> Core::TrustHandler::setTrustLevel( +QXmppTask>> Core::TrustHandler::setTrustLevel( const QString& encryption, const QList& keyOwnerJids, QXmpp::TrustLevel oldTrustLevel, @@ -130,14 +119,10 @@ QFuture>> Core::TrustHandler::set cache->changeRecord(keyOwnerJid, map); } } - - QFutureInterface>> result(QFutureInterfaceBase::Started); - result.reportResult(modifiedKeys); - result.reportFinished(); - return result.future(); + return Core::makeReadyTask(std::move(modifiedKeys)); } -QFuture>> Core::TrustHandler::setTrustLevel( +QXmppTask>> Core::TrustHandler::setTrustLevel( const QString& encryption, const QMultiHash& keyIds, QXmpp::TrustLevel trustLevel) @@ -160,14 +145,10 @@ QFuture>> Core::TrustHandler::set cache->changeRecord(keyOwnerJid, map); } } - - QFutureInterface>> result(QFutureInterfaceBase::Started); - result.reportResult(modifiedKeys); - result.reportFinished(); - return result.future(); + return Core::makeReadyTask(std::move(modifiedKeys)); } -QFuture TrustHandler::hasKey(const QString& encryption, +QXmppTask TrustHandler::hasKey(const QString& encryption, const QString& keyOwnerJid, QXmpp::TrustLevels trustLevels) { @@ -182,14 +163,10 @@ QFuture TrustHandler::hasKey(const QString& encryption, } } } catch (const DataBase::NotFound& e) {} - - QFutureInterface result(QFutureInterfaceBase::Started); - result.reportResult(found); - result.reportFinished(); - return result.future(); + return Core::makeReadyTask(std::move(found)); } -QFuture>> TrustHandler::keys( +QXmppTask>> TrustHandler::keys( const QString& encryption, const QList& keyOwnerJids, QXmpp::TrustLevels trustLevels) @@ -209,14 +186,10 @@ QFuture>> TrustHandler::keys } } catch (const DataBase::NotFound& e) {} } - - QFutureInterface result(QFutureInterfaceBase::Started); - result.reportResult(res); - result.reportFinished(); - return result.future(); + return Core::makeReadyTask(std::move(res)); } -QFuture>> TrustHandler::keys( +QXmppTask>> TrustHandler::keys( const QString& encryption, QXmpp::TrustLevels trustLevels) { @@ -231,24 +204,20 @@ QFuture>> TrustHandler: } } } - - QFutureInterface> result(QFutureInterfaceBase::Started); - result.reportResult(res); - result.reportFinished(); - return result.future(); + return Core::makeReadyTask(std::move(res)); } -QFuture TrustHandler::removeKeys(const QString& encryption) { +QXmppTask TrustHandler::removeKeys(const QString& encryption) { getCache(encryption)->drop(); - return emptyVoidFuture(); + return Core::makeReadyTask(); } -QFuture TrustHandler::removeKeys(const QString& encryption, const QString& keyOwnerJid) { +QXmppTask TrustHandler::removeKeys(const QString& encryption, const QString& keyOwnerJid) { getCache(encryption)->removeRecord(keyOwnerJid); - return emptyVoidFuture(); + return Core::makeReadyTask(); } -QFuture TrustHandler::removeKeys(const QString& encryption, const QList& keyIds) { +QXmppTask TrustHandler::removeKeys(const QString& encryption, const QList& keyIds) { std::set set; for (const QByteArray& keyId : keyIds) { set.insert(keyId); @@ -278,10 +247,10 @@ QFuture TrustHandler::removeKeys(const QString& encryption, const QListreplaceAll(data); } - return emptyVoidFuture(); + return Core::makeReadyTask(); } -QFuture TrustHandler::addKeys( +QXmppTask TrustHandler::addKeys( const QString& encryption, const QString& keyOwnerJid, const QList& keyIds, @@ -308,61 +277,53 @@ QFuture TrustHandler::addKeys( cache->addRecord(keyOwnerJid, data); } - return emptyVoidFuture(); + return Core::makeReadyTask(); } -QFuture TrustHandler::ownKey(const QString& encryption) { +QXmppTask TrustHandler::ownKey(const QString& encryption) { QByteArray res; try { res = ownKeys->getRecord(encryption); } catch (const DataBase::NotFound& e) {} - - QFutureInterface result(QFutureInterfaceBase::Started); - result.reportResult(res); - result.reportFinished(); - return result.future(); + return Core::makeReadyTask(std::move(res)); } -QFuture TrustHandler::resetOwnKey(const QString& encryption) { +QXmppTask TrustHandler::resetOwnKey(const QString& encryption) { try { ownKeys->removeRecord(encryption); } catch (const DataBase::NotFound& e) {} - return emptyVoidFuture(); + return Core::makeReadyTask(); } -QFuture TrustHandler::setOwnKey(const QString& encryption, const QByteArray& keyId) { +QXmppTask TrustHandler::setOwnKey(const QString& encryption, const QByteArray& keyId) { ownKeys->forceRecord(encryption, keyId); - return emptyVoidFuture(); + return Core::makeReadyTask(); } -QFuture TrustHandler::securityPolicy(const QString& encryption) { +QXmppTask TrustHandler::securityPolicy(const QString& encryption) { QXmpp::TrustSecurityPolicy res; try { res = static_cast(securityPolicies->getRecord(encryption)); } catch (const DataBase::NotFound& e) {} - - QFutureInterface result(QFutureInterfaceBase::Started); - result.reportResult(res); - result.reportFinished(); - return result.future(); + return Core::makeReadyTask(std::move(res)); } -QFuture TrustHandler::resetSecurityPolicy(const QString& encryption) { +QXmppTask TrustHandler::resetSecurityPolicy(const QString& encryption) { try { securityPolicies->removeRecord(encryption); } catch (const DataBase::NotFound& e) {} - return emptyVoidFuture(); + return Core::makeReadyTask(); } -QFuture TrustHandler::setSecurityPolicy( +QXmppTask TrustHandler::setSecurityPolicy( const QString& encryption, QXmpp::TrustSecurityPolicy securityPolicy) { uint8_t pol = securityPolicy; securityPolicies->forceRecord(encryption, pol); - return emptyVoidFuture(); + return Core::makeReadyTask(); } Shared::TrustLevel Core::TrustHandler::convert(Core::TrustHandler::TL level) diff --git a/core/handlers/trusthandler.h b/core/handlers/trusthandler.h index b1fe0b4..e46c7b3 100644 --- a/core/handlers/trusthandler.h +++ b/core/handlers/trusthandler.h @@ -41,29 +41,28 @@ public: typedef std::map Keys; typedef DataBase::Cache KeyCache; - virtual QFuture resetAll(CSR encryption); - virtual QFuture trustLevel(CSR encryption, CSR keyOwnerJid, const QByteArray& keyId); - virtual QFuture setTrustLevel(CSR encryption, CLSR keyOwnerJids, TL oldTrustLevel, TL newTrustLevel); - virtual QFuture setTrustLevel(CSR encryption, const MultySB& keyIds, TL trustLevel); - virtual QFuture hasKey(CSR encryption, CSR keyOwnerJid, QXmpp::TrustLevels trustLevels); - virtual QFuture keys(CSR encryption, CLSR keyOwnerJids, QXmpp::TrustLevels trustLevels); - virtual QFuture> keys(CSR encryption, QXmpp::TrustLevels trustLevels); - virtual QFuture removeKeys(CSR encryption); - virtual QFuture removeKeys(CSR encryption, CSR keyOwnerJid); - virtual QFuture removeKeys(CSR encryption, CLBAR keyIds); - virtual QFuture addKeys(CSR encryption, CSR keyOwnerJid, CLBAR keyIds, TL trustLevel); - virtual QFuture ownKey(CSR encryption); - virtual QFuture resetOwnKey(CSR encryption); - virtual QFuture setOwnKey(CSR encryption, const QByteArray& keyId); - virtual QFuture securityPolicy(CSR encryption); - virtual QFuture resetSecurityPolicy(CSR encryption); - virtual QFuture setSecurityPolicy(CSR encryption, QXmpp::TrustSecurityPolicy securityPolicy); + virtual QXmppTask resetAll(CSR encryption); + virtual QXmppTask trustLevel(CSR encryption, CSR keyOwnerJid, const QByteArray& keyId); + virtual QXmppTask setTrustLevel(CSR encryption, CLSR keyOwnerJids, TL oldTrustLevel, TL newTrustLevel); + virtual QXmppTask setTrustLevel(CSR encryption, const MultySB& keyIds, TL trustLevel); + virtual QXmppTask hasKey(CSR encryption, CSR keyOwnerJid, QXmpp::TrustLevels trustLevels); + virtual QXmppTask keys(CSR encryption, CLSR keyOwnerJids, QXmpp::TrustLevels trustLevels); + virtual QXmppTask> keys(CSR encryption, QXmpp::TrustLevels trustLevels); + virtual QXmppTask removeKeys(CSR encryption); + virtual QXmppTask removeKeys(CSR encryption, CSR keyOwnerJid); + virtual QXmppTask removeKeys(CSR encryption, CLBAR keyIds); + virtual QXmppTask addKeys(CSR encryption, CSR keyOwnerJid, CLBAR keyIds, TL trustLevel); + virtual QXmppTask ownKey(CSR encryption); + virtual QXmppTask resetOwnKey(CSR encryption); + virtual QXmppTask setOwnKey(CSR encryption, const QByteArray& keyId); + virtual QXmppTask securityPolicy(CSR encryption); + virtual QXmppTask resetSecurityPolicy(CSR encryption); + virtual QXmppTask setSecurityPolicy(CSR encryption, QXmpp::TrustSecurityPolicy securityPolicy); static TL convert(Shared::TrustLevel level); static Shared::TrustLevel convert(TL level); private: - static QFuture emptyVoidFuture(); KeyCache* createNewCache(const QString& encryption); KeyCache* getCache(const QString& encryption); diff --git a/external/qxmpp b/external/qxmpp index befab2f..d2c2acd 160000 --- a/external/qxmpp +++ b/external/qxmpp @@ -1 +1 @@ -Subproject commit befab2fe2e71330170bba48f173258be724c65b9 +Subproject commit d2c2acd4848f815d0dc3d108f8bc306f9015fc89 diff --git a/ui/widgets/about.cpp b/ui/widgets/about.cpp index 3782a94..f46c661 100644 --- a/ui/widgets/about.cpp +++ b/ui/widgets/about.cpp @@ -19,10 +19,14 @@ #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); +#else +static const QString QXMPP_VERSION_STRING = QXmppVersion(); +#endif About::About(QWidget* parent): QWidget(parent),