Commit 593ab253 authored by LNJ's avatar LNJ 💬

Drop support for QXmpp < 1.0.0

parent e01cbbd0
......@@ -57,7 +57,7 @@ kde_enable_exceptions()
find_package(PkgConfig REQUIRED)
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core Qml Quick Svg Sql QuickControls2 Xml)
find_package(KF5Kirigami2 REQUIRED)
pkg_search_module(QXmpp REQUIRED qxmpp>=0.9)
pkg_search_module(QXmpp REQUIRED qxmpp>=1.0)
# Optional QtQuickCompiler
if(QUICK_COMPILER)
......
......@@ -40,7 +40,7 @@ how to do that:
Here are the general dependencies of Kaidan listed:
* [Qt](https://doc.qt.io/qt-5/build-sources.html) (Core Qml Quick Svg Sql QuickControls2) (>= 5.8.0)
* [QXmpp][qxmpp] (>= 0.9.0)
* [QXmpp][qxmpp] (>= 1.0.0)
* [Kirigami 2](https://phabricator.kde.org/source/kirigami/) (>= 5.42.0)
* [ECM (extra-cmake-modules)](https://api.kde.org/ecm/manual/ecm.7.html)
* [KNotifications][knotif] (`-DUSE_KNOTIFICATIONS=OFF` to disable)
......
......@@ -82,10 +82,8 @@ ClientWorker::ClientWorker(Caches *caches, Kaidan *kaidan, bool enableLogging, Q
client->versionManager().setClientVersion(VERSION_STRING);
client->versionManager().setClientOs(QSysInfo::prettyProductName());
#if (QXMPP_VERSION) >= QT_VERSION_CHECK(1, 0, 0)
// Client State Indication
connect(app, &QGuiApplication::applicationStateChanged, this, &ClientWorker::setCsiState);
#endif
}
void ClientWorker::main()
......@@ -190,7 +188,6 @@ QString ClientWorker::generateRandomString(unsigned int length) const
return randomString;
}
#if (QXMPP_VERSION) >= QT_VERSION_CHECK(1, 0, 0)
void ClientWorker::setCsiState(Qt::ApplicationState state)
{
if (state == Qt::ApplicationActive)
......@@ -198,4 +195,3 @@ void ClientWorker::setCsiState(Qt::ApplicationState state)
else
client->setActive(false);
}
#endif
......@@ -159,12 +159,10 @@ private slots:
*/
void onConnectionError(QXmppClient::Error error);
#if (QXMPP_VERSION) >= QT_VERSION_CHECK(1, 0, 0)
/**
* Uses the QGuiApplication state to reduce network traffic when window is minimized
*/
void setCsiState(Qt::ApplicationState state);
#endif
private:
/**
......
......@@ -34,13 +34,11 @@
#include <QMimeDatabase>
#include <QUrl>
// QXmpp
#include <QXmppCarbonManager.h>
#include <QXmppClient.h>
#include <QXmppDiscoveryManager.h>
#include <QXmppRosterManager.h>
#include <QXmppUtils.h>
#if (QXMPP_VERSION) >= QT_VERSION_CHECK(1, 0, 0)
#include <QXmppCarbonManager.h>
#endif
// Kaidan
#include "Kaidan.h"
#include "Message.h"
......@@ -61,7 +59,6 @@ MessageHandler::MessageHandler(Kaidan *kaidan, QXmppClient *client, MessageModel
emit model->setMessageAsDeliveredRequested(id);
});
#if (QXMPP_VERSION) >= QT_VERSION_CHECK(1, 0, 0)
carbonManager = new QXmppCarbonManager();
client->addExtension(carbonManager);
......@@ -79,14 +76,11 @@ MessageHandler::MessageHandler(Kaidan *kaidan, QXmppClient *client, MessageModel
connect(discoManager, &QXmppDiscoveryManager::infoReceived,
this, &MessageHandler::handleDiscoInfo);
#endif
}
MessageHandler::~MessageHandler()
{
#if (QXMPP_VERSION) >= QT_VERSION_CHECK(1, 0, 0)
delete carbonManager;
#endif
}
void MessageHandler::handleMessage(const QXmppMessage &msg)
......@@ -117,9 +111,7 @@ void MessageHandler::handleMessage(const QXmppMessage &msg)
// check if message contains a link and also check out of band url
QStringList bodyWords = message.body().split(" ");
#if QXMPP_VERSION >= QT_VERSION_CHECK(1, 0, 0)
bodyWords.prepend(msg.outOfBandUrl());
#endif
for (const QString &word : bodyWords) {
if (!word.startsWith("https://") && !word.startsWith("http://"))
continue;
......@@ -152,7 +144,6 @@ void MessageHandler::handleMessage(const QXmppMessage &msg)
: msg.stamp().toUTC());
// save the message to the database
#if (QXMPP_VERSION) >= QT_VERSION_CHECK(1, 0, 0)
// in case of message correction, replace old message
if (msg.replaceId().isEmpty()) {
emit model->addMessageRequested(message);
......@@ -164,10 +155,6 @@ void MessageHandler::handleMessage(const QXmppMessage &msg)
m = message;
});
}
#else
// no message correction with old QXmpp
emit model->addMessageRequested(message);
#endif
// Send a message notification
......@@ -269,9 +256,7 @@ void MessageHandler::correctMessage(const QString& toJid,
msg.setSentByMe(true);
msg.setMediaType(MessageType::MessageText); // text message without media
msg.setIsEdited(true);
#if (QXMPP_VERSION) >= QT_VERSION_CHECK(1, 0, 0)
msg.setReplaceId(msgId);
#endif
emit model->updateMessageRequested(msgId, [=] (Message &msg) {
msg.setBody(body);
......@@ -285,11 +270,9 @@ void MessageHandler::correctMessage(const QString& toJid,
void MessageHandler::handleDiscoInfo(const QXmppDiscoveryIq &info)
{
#if (QXMPP_VERSION) >= QT_VERSION_CHECK(1, 0, 0)
if (info.from() != client->configuration().domain())
return;
// enable carbons, if feature found
if (info.features().contains(NS_CARBONS))
carbonManager->setCarbonsEnabled(true);
#endif
}
......@@ -42,9 +42,7 @@ class MessageModel;
class QMimeType;
class QXmppMessage;
class QXmppDiscoveryIq;
#if (QXMPP_VERSION) >= QT_VERSION_CHECK(1, 0, 0)
class QXmppCarbonManager;
#endif
/**
* @class MessageHandler Handler for incoming and outgoing messages.
......@@ -85,9 +83,7 @@ private:
QXmppClient *client;
QXmppMessageReceiptManager receiptManager;
MessageModel *model;
#if (QXMPP_VERSION) >= QT_VERSION_CHECK(1, 0, 0)
QXmppCarbonManager *carbonManager;
#endif
QString chatPartner;
};
......
......@@ -129,9 +129,7 @@ void UploadManager::handleUploadSucceeded(const QXmppHttpUpload *upload)
: originalMsg->body() + "\n" + oobUrl;
emit msgModel->updateMessageRequested(originalMsg->id(), [=] (Message &msg) {
#if (QXMPP_VERSION) >= QT_VERSION_CHECK(1, 0, 0)
msg.setOutOfBandUrl(oobUrl);
#endif
msg.setBody(body);
});
......@@ -140,9 +138,7 @@ void UploadManager::handleUploadSucceeded(const QXmppHttpUpload *upload)
m.setId(originalMsg->id());
m.setReceiptRequested(true);
m.setStamp(originalMsg->stamp());
#if (QXMPP_VERSION) >= QT_VERSION_CHECK(1, 0, 0)
m.setOutOfBandUrl(upload->slot().getUrl().toEncoded());
#endif
bool success = client->sendPacket(m);
if (success)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment