Replace Quotient::Connection with NeoChatConnection where possible
(cherry picked from commit 1e644587b3)
This commit is contained in:
@@ -19,7 +19,6 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
#include <Quotient/accountregistry.h>
|
#include <Quotient/accountregistry.h>
|
||||||
#include <Quotient/connection.h>
|
|
||||||
#include <Quotient/csapi/logout.h>
|
#include <Quotient/csapi/logout.h>
|
||||||
#include <Quotient/csapi/notifications.h>
|
#include <Quotient/csapi/notifications.h>
|
||||||
#include <Quotient/eventstats.h>
|
#include <Quotient/eventstats.h>
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ private:
|
|||||||
|
|
||||||
Quotient::AccountRegistry m_accountRegistry;
|
Quotient::AccountRegistry m_accountRegistry;
|
||||||
QStringList m_accountsLoading;
|
QStringList m_accountsLoading;
|
||||||
QMap<QString, QPointer<Quotient::Connection>> m_connectionsLoading;
|
QMap<QString, QPointer<NeoChatConnection>> m_connectionsLoading;
|
||||||
QString m_endpoint;
|
QString m_endpoint;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
#include "login.h"
|
#include "login.h"
|
||||||
|
|
||||||
#include <Quotient/accountregistry.h>
|
#include <Quotient/accountregistry.h>
|
||||||
#include <Quotient/connection.h>
|
|
||||||
#include <Quotient/qt_connection_util.h>
|
#include <Quotient/qt_connection_util.h>
|
||||||
|
|
||||||
#include "controller.h"
|
#include "controller.h"
|
||||||
@@ -54,7 +53,7 @@ void LoginHelper::init()
|
|||||||
m_connection = new NeoChatConnection();
|
m_connection = new NeoChatConnection();
|
||||||
}
|
}
|
||||||
m_connection->resolveServer(m_matrixId);
|
m_connection->resolveServer(m_matrixId);
|
||||||
connectSingleShot(m_connection, &Connection::loginFlowsChanged, this, [this]() {
|
connectSingleShot(m_connection.get(), &Connection::loginFlowsChanged, this, [this]() {
|
||||||
setHomeserverReachable(true);
|
setHomeserverReachable(true);
|
||||||
m_testing = false;
|
m_testing = false;
|
||||||
Q_EMIT testingChanged();
|
Q_EMIT testingChanged();
|
||||||
@@ -100,7 +99,7 @@ void LoginHelper::init()
|
|||||||
Q_EMIT Controller::instance().errorOccured(i18n("Network Error"), std::move(error));
|
Q_EMIT Controller::instance().errorOccured(i18n("Network Error"), std::move(error));
|
||||||
});
|
});
|
||||||
|
|
||||||
connectSingleShot(m_connection, &Connection::syncDone, this, [this]() {
|
connectSingleShot(m_connection.get(), &Connection::syncDone, this, [this]() {
|
||||||
Q_EMIT loaded();
|
Q_EMIT loaded();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -182,7 +181,7 @@ QUrl LoginHelper::ssoUrl() const
|
|||||||
void LoginHelper::loginWithSso()
|
void LoginHelper::loginWithSso()
|
||||||
{
|
{
|
||||||
m_connection->resolveServer(m_matrixId);
|
m_connection->resolveServer(m_matrixId);
|
||||||
connectSingleShot(m_connection, &Connection::loginFlowsChanged, this, [this]() {
|
connectSingleShot(m_connection.get(), &Connection::loginFlowsChanged, this, [this]() {
|
||||||
SsoSession *session = m_connection->prepareForSso(m_deviceName);
|
SsoSession *session = m_connection->prepareForSso(m_deviceName);
|
||||||
m_ssoUrl = session->ssoUrl();
|
m_ssoUrl = session->ssoUrl();
|
||||||
Q_EMIT ssoUrlChanged();
|
Q_EMIT ssoUrlChanged();
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ private:
|
|||||||
QString m_deviceName;
|
QString m_deviceName;
|
||||||
bool m_supportsSso = false;
|
bool m_supportsSso = false;
|
||||||
bool m_supportsPassword = false;
|
bool m_supportsPassword = false;
|
||||||
NeoChatConnection *m_connection = nullptr;
|
QPointer<NeoChatConnection> m_connection;
|
||||||
QUrl m_ssoUrl;
|
QUrl m_ssoUrl;
|
||||||
bool m_testing = false;
|
bool m_testing = false;
|
||||||
bool m_isLoggingIn = false;
|
bool m_isLoggingIn = false;
|
||||||
|
|||||||
@@ -14,8 +14,6 @@
|
|||||||
|
|
||||||
#include "neochatconnection.h"
|
#include "neochatconnection.h"
|
||||||
|
|
||||||
#include <Quotient/connection.h>
|
|
||||||
|
|
||||||
using namespace Quotient;
|
using namespace Quotient;
|
||||||
|
|
||||||
ThumbnailResponse::ThumbnailResponse(QString id, QSize size, NeoChatConnection *connection)
|
ThumbnailResponse::ThumbnailResponse(QString id, QSize size, NeoChatConnection *connection)
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ private:
|
|||||||
QSize requestedSize;
|
QSize requestedSize;
|
||||||
const QString localFile;
|
const QString localFile;
|
||||||
Quotient::MediaThumbnailJob *job = nullptr;
|
Quotient::MediaThumbnailJob *job = nullptr;
|
||||||
NeoChatConnection *m_connection;
|
QPointer<NeoChatConnection> m_connection;
|
||||||
|
|
||||||
QImage image;
|
QImage image;
|
||||||
QString errorStr;
|
QString errorStr;
|
||||||
@@ -75,6 +75,6 @@ public:
|
|||||||
QQuickImageResponse *requestImageResponse(const QString &id, const QSize &requestedSize) override;
|
QQuickImageResponse *requestImageResponse(const QString &id, const QSize &requestedSize) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NeoChatConnection *m_connection = nullptr;
|
QPointer<NeoChatConnection> m_connection;
|
||||||
MatrixImageProvider() = default;
|
MatrixImageProvider() = default;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
#include <Quotient/events/eventcontent.h>
|
#include <Quotient/events/eventcontent.h>
|
||||||
#include <qcoro/qcorosignal.h>
|
#include <qcoro/qcorosignal.h>
|
||||||
|
|
||||||
|
#include "neochatconnection.h"
|
||||||
|
|
||||||
using namespace Quotient;
|
using namespace Quotient;
|
||||||
|
|
||||||
AccountEmoticonModel::AccountEmoticonModel(QObject *parent)
|
AccountEmoticonModel::AccountEmoticonModel(QObject *parent)
|
||||||
@@ -77,12 +79,12 @@ QHash<int, QByteArray> AccountEmoticonModel::roleNames() const
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
Connection *AccountEmoticonModel::connection() const
|
NeoChatConnection *AccountEmoticonModel::connection() const
|
||||||
{
|
{
|
||||||
return m_connection;
|
return m_connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AccountEmoticonModel::setConnection(Connection *connection)
|
void AccountEmoticonModel::setConnection(NeoChatConnection *connection)
|
||||||
{
|
{
|
||||||
if (m_connection) {
|
if (m_connection) {
|
||||||
disconnect(m_connection, nullptr, this, nullptr);
|
disconnect(m_connection, nullptr, this, nullptr);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
#include <QQmlEngine>
|
#include <QQmlEngine>
|
||||||
|
|
||||||
#include <Quotient/connection.h>
|
class NeoChatConnection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class AccountEmoticonModel
|
* @class AccountEmoticonModel
|
||||||
@@ -29,7 +29,7 @@ class AccountEmoticonModel : public QAbstractListModel
|
|||||||
/**
|
/**
|
||||||
* @brief The connection to get emoticons from.
|
* @brief The connection to get emoticons from.
|
||||||
*/
|
*/
|
||||||
Q_PROPERTY(Quotient::Connection *connection READ connection WRITE setConnection NOTIFY connectionChanged)
|
Q_PROPERTY(NeoChatConnection *connection READ connection WRITE setConnection NOTIFY connectionChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum Roles {
|
enum Roles {
|
||||||
@@ -63,8 +63,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
[[nodiscard]] QHash<int, QByteArray> roleNames() const override;
|
[[nodiscard]] QHash<int, QByteArray> roleNames() const override;
|
||||||
|
|
||||||
[[nodiscard]] Quotient::Connection *connection() const;
|
[[nodiscard]] NeoChatConnection *connection() const;
|
||||||
void setConnection(Quotient::Connection *connection);
|
void setConnection(NeoChatConnection *connection);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Deletes the emoticon at the given index.
|
* @brief Deletes the emoticon at the given index.
|
||||||
@@ -96,7 +96,7 @@ Q_SIGNALS:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::optional<Quotient::ImagePackEventContent> m_images;
|
std::optional<Quotient::ImagePackEventContent> m_images;
|
||||||
QPointer<Quotient::Connection> m_connection;
|
QPointer<NeoChatConnection> m_connection;
|
||||||
QCoro::Task<void> doSetEmoticonImage(int index, QUrl source);
|
QCoro::Task<void> doSetEmoticonImage(int index, QUrl source);
|
||||||
QCoro::Task<void> doAddEmoticon(QUrl source, QString shortcode, QString description, QString type);
|
QCoro::Task<void> doAddEmoticon(QUrl source, QString shortcode, QString description, QString type);
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "actionsmodel.h"
|
#include "actionsmodel.h"
|
||||||
|
|
||||||
#include "chatbarcache.h"
|
#include "chatbarcache.h"
|
||||||
|
#include "neochatconnection.h"
|
||||||
#include "neochatroom.h"
|
#include "neochatroom.h"
|
||||||
#include "roommanager.h"
|
#include "roommanager.h"
|
||||||
#include <Quotient/events/roommemberevent.h>
|
#include <Quotient/events/roommemberevent.h>
|
||||||
@@ -260,7 +261,7 @@ QList<ActionsModel::Action> actions{
|
|||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
Q_EMIT room->showMessage(NeoChatRoom::Info, i18nc("Knocking room <roomname>.", "Knocking room %1.", text));
|
Q_EMIT room->showMessage(NeoChatRoom::Info, i18nc("Knocking room <roomname>.", "Knocking room %1.", text));
|
||||||
auto connection = room->connection();
|
auto connection = dynamic_cast<NeoChatConnection *>(room->connection());
|
||||||
const auto knownServer = roomName.mid(roomName.indexOf(":"_ls) + 1);
|
const auto knownServer = roomName.mid(roomName.indexOf(":"_ls) + 1);
|
||||||
if (parts.length() >= 2) {
|
if (parts.length() >= 2) {
|
||||||
RoomManager::instance().knockRoom(connection, roomName, parts[1], QStringList{knownServer});
|
RoomManager::instance().knockRoom(connection, roomName, parts[1], QStringList{knownServer});
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ Q_SIGNALS:
|
|||||||
private:
|
private:
|
||||||
explicit CustomEmojiModel(QObject *parent = nullptr);
|
explicit CustomEmojiModel(QObject *parent = nullptr);
|
||||||
QList<CustomEmoji> m_emojis;
|
QList<CustomEmoji> m_emojis;
|
||||||
NeoChatConnection *m_connection = nullptr;
|
QPointer<NeoChatConnection> m_connection;
|
||||||
|
|
||||||
void fetchEmojis();
|
void fetchEmojis();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,7 +5,8 @@
|
|||||||
|
|
||||||
#include "customemojimodel.h"
|
#include "customemojimodel.h"
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <connection.h>
|
|
||||||
|
class NeoChatConnection;
|
||||||
|
|
||||||
struct CustomEmoji {
|
struct CustomEmoji {
|
||||||
QString name; // with :semicolons:
|
QString name; // with :semicolons:
|
||||||
@@ -14,6 +15,6 @@ struct CustomEmoji {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct CustomEmojiModel::Private {
|
struct CustomEmojiModel::Private {
|
||||||
Quotient::Connection *conn = nullptr;
|
QPointer<NeoChatConnection> connection;
|
||||||
QList<CustomEmoji> emojies;
|
QList<CustomEmoji> emojies;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -11,9 +11,10 @@
|
|||||||
#include <KLocalizedString>
|
#include <KLocalizedString>
|
||||||
|
|
||||||
#include <Quotient/csapi/device_management.h>
|
#include <Quotient/csapi/device_management.h>
|
||||||
#include <Quotient/connection.h>
|
|
||||||
#include <Quotient/user.h>
|
#include <Quotient/user.h>
|
||||||
|
|
||||||
|
#include "neochatconnection.h"
|
||||||
|
|
||||||
using namespace Quotient;
|
using namespace Quotient;
|
||||||
|
|
||||||
DevicesModel::DevicesModel(QObject *parent)
|
DevicesModel::DevicesModel(QObject *parent)
|
||||||
@@ -152,12 +153,12 @@ void DevicesModel::setName(const QString &deviceId, const QString &name)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Connection *DevicesModel::connection() const
|
NeoChatConnection *DevicesModel::connection() const
|
||||||
{
|
{
|
||||||
return m_connection;
|
return m_connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DevicesModel::setConnection(Connection *connection)
|
void DevicesModel::setConnection(NeoChatConnection *connection)
|
||||||
{
|
{
|
||||||
if (m_connection) {
|
if (m_connection) {
|
||||||
disconnect(m_connection, nullptr, this, nullptr);
|
disconnect(m_connection, nullptr, this, nullptr);
|
||||||
|
|||||||
@@ -9,10 +9,7 @@
|
|||||||
|
|
||||||
#include <Quotient/csapi/definitions/client_device.h>
|
#include <Quotient/csapi/definitions/client_device.h>
|
||||||
|
|
||||||
namespace Quotient
|
class NeoChatConnection;
|
||||||
{
|
|
||||||
class Connection;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class DevicesModel
|
* @class DevicesModel
|
||||||
@@ -31,7 +28,7 @@ class DevicesModel : public QAbstractListModel
|
|||||||
/**
|
/**
|
||||||
* @brief The current connection that the model is getting its devices from.
|
* @brief The current connection that the model is getting its devices from.
|
||||||
*/
|
*/
|
||||||
Q_PROPERTY(Quotient::Connection *connection READ connection WRITE setConnection NOTIFY connectionChanged REQUIRED)
|
Q_PROPERTY(NeoChatConnection *connection READ connection WRITE setConnection NOTIFY connectionChanged REQUIRED)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
@@ -88,9 +85,8 @@ public:
|
|||||||
|
|
||||||
explicit DevicesModel(QObject *parent = nullptr);
|
explicit DevicesModel(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
[[nodiscard]] NeoChatConnection *connection() const;
|
||||||
[[nodiscard]] Quotient::Connection *connection() const;
|
void setConnection(NeoChatConnection *connection);
|
||||||
void setConnection(Quotient::Connection *connection);
|
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void connectionChanged();
|
void connectionChanged();
|
||||||
@@ -99,5 +95,5 @@ Q_SIGNALS:
|
|||||||
private:
|
private:
|
||||||
void fetchDevices();
|
void fetchDevices();
|
||||||
QList<Quotient::Device> m_devices;
|
QList<Quotient::Device> m_devices;
|
||||||
QPointer<Quotient::Connection> m_connection;
|
QPointer<NeoChatConnection> m_connection;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
#include "neochatconfig.h"
|
#include "neochatconfig.h"
|
||||||
|
|
||||||
#include <Quotient/connection.h>
|
|
||||||
#include <Quotient/csapi/rooms.h>
|
#include <Quotient/csapi/rooms.h>
|
||||||
#include <Quotient/events/redactionevent.h>
|
#include <Quotient/events/redactionevent.h>
|
||||||
#include <Quotient/events/roommessageevent.h>
|
#include <Quotient/events/roommessageevent.h>
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#include "notificationsmodel.h"
|
#include "notificationsmodel.h"
|
||||||
|
|
||||||
#include <Quotient/connection.h>
|
|
||||||
#include <Quotient/events/event.h>
|
#include <Quotient/events/event.h>
|
||||||
#include <Quotient/uri.h>
|
#include <Quotient/uri.h>
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,7 @@
|
|||||||
|
|
||||||
#include "publicroomlistmodel.h"
|
#include "publicroomlistmodel.h"
|
||||||
|
|
||||||
#include <Quotient/connection.h>
|
#include "neochatconnection.h"
|
||||||
|
|
||||||
#include "publicroomlist_logging.h"
|
#include "publicroomlist_logging.h"
|
||||||
|
|
||||||
using namespace Quotient;
|
using namespace Quotient;
|
||||||
@@ -14,14 +13,14 @@ PublicRoomListModel::PublicRoomListModel(QObject *parent)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Quotient::Connection *PublicRoomListModel::connection() const
|
NeoChatConnection *PublicRoomListModel::connection() const
|
||||||
{
|
{
|
||||||
return m_connection;
|
return m_connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PublicRoomListModel::setConnection(Connection *conn)
|
void PublicRoomListModel::setConnection(NeoChatConnection *connection)
|
||||||
{
|
{
|
||||||
if (m_connection == conn) {
|
if (m_connection == connection) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,7 +37,7 @@ void PublicRoomListModel::setConnection(Connection *conn)
|
|||||||
|
|
||||||
endResetModel();
|
endResetModel();
|
||||||
|
|
||||||
m_connection = conn;
|
m_connection = connection;
|
||||||
|
|
||||||
if (job) {
|
if (job) {
|
||||||
job->abandon();
|
job->abandon();
|
||||||
|
|||||||
@@ -9,10 +9,7 @@
|
|||||||
|
|
||||||
#include <Quotient/csapi/list_public_rooms.h>
|
#include <Quotient/csapi/list_public_rooms.h>
|
||||||
|
|
||||||
namespace Quotient
|
class NeoChatConnection;
|
||||||
{
|
|
||||||
class Connection;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class PublicRoomListModel
|
* @class PublicRoomListModel
|
||||||
@@ -33,7 +30,7 @@ class PublicRoomListModel : public QAbstractListModel
|
|||||||
/**
|
/**
|
||||||
* @brief The current connection that the model is getting its rooms from.
|
* @brief The current connection that the model is getting its rooms from.
|
||||||
*/
|
*/
|
||||||
Q_PROPERTY(Quotient::Connection *connection READ connection WRITE setConnection NOTIFY connectionChanged)
|
Q_PROPERTY(NeoChatConnection *connection READ connection WRITE setConnection NOTIFY connectionChanged)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The server to get the public room list from.
|
* @brief The server to get the public room list from.
|
||||||
@@ -95,8 +92,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
[[nodiscard]] QHash<int, QByteArray> roleNames() const override;
|
[[nodiscard]] QHash<int, QByteArray> roleNames() const override;
|
||||||
|
|
||||||
[[nodiscard]] Quotient::Connection *connection() const;
|
[[nodiscard]] NeoChatConnection *connection() const;
|
||||||
void setConnection(Quotient::Connection *conn);
|
void setConnection(NeoChatConnection *connection);
|
||||||
|
|
||||||
[[nodiscard]] QString server() const;
|
[[nodiscard]] QString server() const;
|
||||||
void setServer(const QString &value);
|
void setServer(const QString &value);
|
||||||
@@ -117,7 +114,7 @@ public:
|
|||||||
Q_INVOKABLE void search(int limit = 50);
|
Q_INVOKABLE void search(int limit = 50);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPointer<Quotient::Connection> m_connection = nullptr;
|
QPointer<NeoChatConnection> m_connection = nullptr;
|
||||||
QString m_server;
|
QString m_server;
|
||||||
QString m_searchText;
|
QString m_searchText;
|
||||||
bool m_showOnlySpaces = false;
|
bool m_showOnlySpaces = false;
|
||||||
|
|||||||
@@ -5,13 +5,13 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
#include <Quotient/connection.h>
|
|
||||||
#include <Quotient/converters.h>
|
#include <Quotient/converters.h>
|
||||||
#include <Quotient/csapi/definitions/push_ruleset.h>
|
#include <Quotient/csapi/definitions/push_ruleset.h>
|
||||||
#include <Quotient/csapi/pushrules.h>
|
#include <Quotient/csapi/pushrules.h>
|
||||||
#include <Quotient/jobs/basejob.h>
|
#include <Quotient/jobs/basejob.h>
|
||||||
|
|
||||||
#include "neochatconfig.h"
|
#include "neochatconfig.h"
|
||||||
|
#include "neochatconnection.h"
|
||||||
|
|
||||||
#include <KLazyLocalizedString>
|
#include <KLazyLocalizedString>
|
||||||
|
|
||||||
@@ -454,7 +454,7 @@ void PushRuleModel::setConnection(NeoChatConnection *connection)
|
|||||||
Q_EMIT connectionChanged();
|
Q_EMIT connectionChanged();
|
||||||
|
|
||||||
if (m_connection) {
|
if (m_connection) {
|
||||||
connect(m_connection, &Quotient::Connection::accountDataChanged, this, &PushRuleModel::updateNotificationRules);
|
connect(m_connection, &NeoChatConnection::accountDataChanged, this, &PushRuleModel::updateNotificationRules);
|
||||||
updateNotificationRules(QStringLiteral("m.push_rules"));
|
updateNotificationRules(QStringLiteral("m.push_rules"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ private Q_SLOTS:
|
|||||||
private:
|
private:
|
||||||
PushRuleAction::Action m_defaultKeywordAction;
|
PushRuleAction::Action m_defaultKeywordAction;
|
||||||
QList<Rule> m_rules;
|
QList<Rule> m_rules;
|
||||||
NeoChatConnection *m_connection;
|
QPointer<NeoChatConnection> m_connection;
|
||||||
|
|
||||||
void setRules(QList<Quotient::PushRule> rules, PushRuleKind::Kind kind);
|
void setRules(QList<Quotient::PushRule> rules, PushRuleKind::Kind kind);
|
||||||
|
|
||||||
|
|||||||
@@ -25,12 +25,12 @@ RoomListModel::RoomListModel(QObject *parent)
|
|||||||
|
|
||||||
RoomListModel::~RoomListModel() = default;
|
RoomListModel::~RoomListModel() = default;
|
||||||
|
|
||||||
Quotient::Connection *RoomListModel::connection() const
|
NeoChatConnection *RoomListModel::connection() const
|
||||||
{
|
{
|
||||||
return m_connection;
|
return m_connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RoomListModel::setConnection(Connection *connection)
|
void RoomListModel::setConnection(NeoChatConnection *connection)
|
||||||
{
|
{
|
||||||
if (connection == m_connection) {
|
if (connection == m_connection) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -12,10 +12,11 @@ class NeoChatRoom;
|
|||||||
|
|
||||||
namespace Quotient
|
namespace Quotient
|
||||||
{
|
{
|
||||||
class Connection;
|
|
||||||
class Room;
|
class Room;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class NeoChatConnection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class RoomListModel
|
* @class RoomListModel
|
||||||
*
|
*
|
||||||
@@ -29,7 +30,7 @@ class RoomListModel : public QAbstractListModel
|
|||||||
/**
|
/**
|
||||||
* @brief The current connection that the model is getting its rooms from.
|
* @brief The current connection that the model is getting its rooms from.
|
||||||
*/
|
*/
|
||||||
Q_PROPERTY(Quotient::Connection *connection READ connection WRITE setConnection NOTIFY connectionChanged)
|
Q_PROPERTY(NeoChatConnection *connection READ connection WRITE setConnection NOTIFY connectionChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
@@ -60,8 +61,8 @@ public:
|
|||||||
explicit RoomListModel(QObject *parent = nullptr);
|
explicit RoomListModel(QObject *parent = nullptr);
|
||||||
~RoomListModel() override;
|
~RoomListModel() override;
|
||||||
|
|
||||||
[[nodiscard]] Quotient::Connection *connection() const;
|
[[nodiscard]] NeoChatConnection *connection() const;
|
||||||
void setConnection(Quotient::Connection *connection);
|
void setConnection(NeoChatConnection *connection);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the given role value at the given index.
|
* @brief Get the given role value at the given index.
|
||||||
@@ -109,7 +110,7 @@ private Q_SLOTS:
|
|||||||
void refresh(NeoChatRoom *room, const QList<int> &roles = {});
|
void refresh(NeoChatRoom *room, const QList<int> &roles = {});
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Quotient::Connection *m_connection = nullptr;
|
QPointer<NeoChatConnection> m_connection;
|
||||||
QList<NeoChatRoom *> m_rooms;
|
QList<NeoChatRoom *> m_rooms;
|
||||||
|
|
||||||
QString m_activeSpaceId;
|
QString m_activeSpaceId;
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#include "roomtreemodel.h"
|
#include "roomtreemodel.h"
|
||||||
|
|
||||||
#include <Quotient/connection.h>
|
|
||||||
#include <Quotient/room.h>
|
#include <Quotient/room.h>
|
||||||
|
|
||||||
#include "eventhandler.h"
|
#include "eventhandler.h"
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
|
|
||||||
#include <Quotient/connection.h>
|
|
||||||
#include <Quotient/events/stickerevent.h>
|
#include <Quotient/events/stickerevent.h>
|
||||||
|
|
||||||
#include <KLocalizedString>
|
#include <KLocalizedString>
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
|
|
||||||
#include "serverlistmodel.h"
|
#include "serverlistmodel.h"
|
||||||
|
|
||||||
#include <Quotient/connection.h>
|
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
#include <KConfig>
|
#include <KConfig>
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ Q_SIGNALS:
|
|||||||
private:
|
private:
|
||||||
QList<Server> m_servers;
|
QList<Server> m_servers;
|
||||||
QPointer<Quotient::QueryPublicRoomsJob> m_checkServerJob = nullptr;
|
QPointer<Quotient::QueryPublicRoomsJob> m_checkServerJob = nullptr;
|
||||||
NeoChatConnection *m_connection = nullptr;
|
QPointer<NeoChatConnection> m_connection;
|
||||||
|
|
||||||
void initialize();
|
void initialize();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
#include "roomlistmodel.h"
|
#include "roomlistmodel.h"
|
||||||
|
|
||||||
|
#include "neochatconnection.h"
|
||||||
|
|
||||||
SortFilterRoomListModel::SortFilterRoomListModel(RoomListModel *sourceModel, QObject *parent)
|
SortFilterRoomListModel::SortFilterRoomListModel(RoomListModel *sourceModel, QObject *parent)
|
||||||
: QSortFilterProxyModel(parent)
|
: QSortFilterProxyModel(parent)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#include "spacechildrenmodel.h"
|
#include "spacechildrenmodel.h"
|
||||||
|
|
||||||
#include <Quotient/connection.h>
|
|
||||||
#include <Quotient/jobs/basejob.h>
|
#include <Quotient/jobs/basejob.h>
|
||||||
#include <Quotient/room.h>
|
#include <Quotient/room.h>
|
||||||
|
|
||||||
@@ -47,7 +46,7 @@ void SpaceChildrenModel::setSpace(NeoChatRoom *space)
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto connection = m_space->connection();
|
auto connection = m_space->connection();
|
||||||
connect(connection, &Quotient::Connection::loadedRoomState, this, [this](Quotient::Room *room) {
|
connect(connection, &NeoChatConnection::loadedRoomState, this, [this](Quotient::Room *room) {
|
||||||
if (m_pendingChildren.contains(room->name())) {
|
if (m_pendingChildren.contains(room->name())) {
|
||||||
m_pendingChildren.removeAll(room->name());
|
m_pendingChildren.removeAll(room->name());
|
||||||
refreshModel();
|
refreshModel();
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
// SPDX-FileCopyrightText: 2023 James Graham <james.h.graham@protonmail.com>
|
// SPDX-FileCopyrightText: 2023 James Graham <james.h.graham@protonmail.com>
|
||||||
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||||
|
|
||||||
|
#include <QPointer>
|
||||||
|
|
||||||
#include <Quotient/csapi/space_hierarchy.h>
|
#include <Quotient/csapi/space_hierarchy.h>
|
||||||
#include <Quotient/events/stateevent.h>
|
#include <Quotient/events/stateevent.h>
|
||||||
|
|
||||||
@@ -149,7 +151,7 @@ public:
|
|||||||
bool isSuggested() const;
|
bool isSuggested() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NeoChatConnection *m_connection;
|
QPointer<NeoChatConnection> m_connection;
|
||||||
std::vector<std::unique_ptr<SpaceTreeItem>> m_children;
|
std::vector<std::unique_ptr<SpaceTreeItem>> m_children;
|
||||||
SpaceTreeItem *m_parentItem;
|
SpaceTreeItem *m_parentItem;
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,10 @@
|
|||||||
|
|
||||||
#include "userdirectorylistmodel.h"
|
#include "userdirectorylistmodel.h"
|
||||||
|
|
||||||
#include <Quotient/connection.h>
|
|
||||||
#include <Quotient/room.h>
|
#include <Quotient/room.h>
|
||||||
|
|
||||||
|
#include "neochatconnection.h"
|
||||||
|
|
||||||
using namespace Quotient;
|
using namespace Quotient;
|
||||||
|
|
||||||
UserDirectoryListModel::UserDirectoryListModel(QObject *parent)
|
UserDirectoryListModel::UserDirectoryListModel(QObject *parent)
|
||||||
@@ -13,14 +14,14 @@ UserDirectoryListModel::UserDirectoryListModel(QObject *parent)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Quotient::Connection *UserDirectoryListModel::connection() const
|
NeoChatConnection *UserDirectoryListModel::connection() const
|
||||||
{
|
{
|
||||||
return m_connection;
|
return m_connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserDirectoryListModel::setConnection(Connection *conn)
|
void UserDirectoryListModel::setConnection(NeoChatConnection *connection)
|
||||||
{
|
{
|
||||||
if (m_connection == conn) {
|
if (m_connection == connection) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,7 +36,7 @@ void UserDirectoryListModel::setConnection(Connection *conn)
|
|||||||
|
|
||||||
endResetModel();
|
endResetModel();
|
||||||
|
|
||||||
m_connection = conn;
|
m_connection = connection;
|
||||||
Q_EMIT connectionChanged();
|
Q_EMIT connectionChanged();
|
||||||
|
|
||||||
if (m_job) {
|
if (m_job) {
|
||||||
|
|||||||
@@ -9,10 +9,7 @@
|
|||||||
|
|
||||||
#include <Quotient/csapi/users.h>
|
#include <Quotient/csapi/users.h>
|
||||||
|
|
||||||
namespace Quotient
|
class NeoChatConnection;
|
||||||
{
|
|
||||||
class Connection;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class UserDirectoryListModel
|
* @class UserDirectoryListModel
|
||||||
@@ -32,7 +29,7 @@ class UserDirectoryListModel : public QAbstractListModel
|
|||||||
/**
|
/**
|
||||||
* @brief The current connection that the model is getting users from.
|
* @brief The current connection that the model is getting users from.
|
||||||
*/
|
*/
|
||||||
Q_PROPERTY(Quotient::Connection *connection READ connection WRITE setConnection NOTIFY connectionChanged)
|
Q_PROPERTY(NeoChatConnection *connection READ connection WRITE setConnection NOTIFY connectionChanged)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The text to search the public room list for.
|
* @brief The text to search the public room list for.
|
||||||
@@ -57,8 +54,8 @@ public:
|
|||||||
|
|
||||||
explicit UserDirectoryListModel(QObject *parent = nullptr);
|
explicit UserDirectoryListModel(QObject *parent = nullptr);
|
||||||
|
|
||||||
[[nodiscard]] Quotient::Connection *connection() const;
|
[[nodiscard]] NeoChatConnection *connection() const;
|
||||||
void setConnection(Quotient::Connection *conn);
|
void setConnection(NeoChatConnection *connection);
|
||||||
|
|
||||||
[[nodiscard]] QString searchText() const;
|
[[nodiscard]] QString searchText() const;
|
||||||
void setSearchText(const QString &searchText);
|
void setSearchText(const QString &searchText);
|
||||||
@@ -99,7 +96,7 @@ Q_SIGNALS:
|
|||||||
void searchingChanged();
|
void searchingChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Quotient::Connection *m_connection = nullptr;
|
QPointer<NeoChatConnection> m_connection;
|
||||||
QString m_searchText;
|
QString m_searchText;
|
||||||
|
|
||||||
bool attempted = false;
|
bool attempted = false;
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
|
|
||||||
#include <Quotient/connection.h>
|
|
||||||
#include <Quotient/events/roompowerlevelsevent.h>
|
#include <Quotient/events/roompowerlevelsevent.h>
|
||||||
|
|
||||||
#include "neochatroom.h"
|
#include "neochatroom.h"
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ void Registration::testHomeserver()
|
|||||||
delete m_connection;
|
delete m_connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_connection = new Connection(this);
|
m_connection = new NeoChatConnection(this);
|
||||||
m_connection->resolveServer("@user:%1"_ls.arg(m_homeserver));
|
m_connection->resolveServer("@user:%1"_ls.arg(m_homeserver));
|
||||||
connectSingleShot(m_connection.data(), &Connection::loginFlowsChanged, this, [this]() {
|
connectSingleShot(m_connection.data(), &Connection::loginFlowsChanged, this, [this]() {
|
||||||
if (m_testServerJob) {
|
if (m_testServerJob) {
|
||||||
|
|||||||
@@ -13,17 +13,16 @@
|
|||||||
|
|
||||||
#include <Quotient/csapi/registration.h>
|
#include <Quotient/csapi/registration.h>
|
||||||
|
|
||||||
#include <Quotient/connection.h>
|
|
||||||
|
|
||||||
#include <Quotient/jobs/basejob.h>
|
#include <Quotient/jobs/basejob.h>
|
||||||
#include <Quotient/util.h>
|
#include <Quotient/util.h>
|
||||||
|
|
||||||
namespace Quotient
|
namespace Quotient
|
||||||
{
|
{
|
||||||
class Connection;
|
|
||||||
class CheckUsernameAvailabilityJob;
|
class CheckUsernameAvailabilityJob;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class NeoChatConnection;
|
||||||
|
|
||||||
class NeoChatRegisterJob : public Quotient::BaseJob
|
class NeoChatRegisterJob : public Quotient::BaseJob
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -159,7 +158,7 @@ private:
|
|||||||
QPointer<Quotient::CheckUsernameAvailabilityJob> m_usernameJob;
|
QPointer<Quotient::CheckUsernameAvailabilityJob> m_usernameJob;
|
||||||
QPointer<NeoChatRegisterJob> m_testServerJob;
|
QPointer<NeoChatRegisterJob> m_testServerJob;
|
||||||
QList<QList<QString>> m_flows;
|
QList<QList<QString>> m_flows;
|
||||||
QPointer<Quotient::Connection> m_connection;
|
QPointer<NeoChatConnection> m_connection;
|
||||||
|
|
||||||
void testHomeserver();
|
void testHomeserver();
|
||||||
void testUsername();
|
void testUsername();
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ void RoomManager::resolveResource(const QString &idOrUri, const QString &action)
|
|||||||
Q_ASSERT(result == Quotient::UriResolved);
|
Q_ASSERT(result == Quotient::UriResolved);
|
||||||
|
|
||||||
if (uri.type() == Uri::RoomAlias || uri.type() == Uri::RoomId) {
|
if (uri.type() == Uri::RoomAlias || uri.type() == Uri::RoomId) {
|
||||||
connectSingleShot(m_connection, &Connection::newRoom, this, [this, uri](Room *room) {
|
connectSingleShot(m_connection.get(), &NeoChatConnection::newRoom, this, [this, uri](Room *room) {
|
||||||
resolveResource(room->id());
|
resolveResource(room->id());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -303,7 +303,7 @@ void RoomManager::joinRoom(Quotient::Connection *account, const QString &roomAli
|
|||||||
auto job = account->joinRoom(roomAliasOrId, viaServers);
|
auto job = account->joinRoom(roomAliasOrId, viaServers);
|
||||||
connectSingleShot(job, &Quotient::BaseJob::finished, this, [this, account](Quotient::BaseJob *finish) {
|
connectSingleShot(job, &Quotient::BaseJob::finished, this, [this, account](Quotient::BaseJob *finish) {
|
||||||
if (finish->status() == Quotient::BaseJob::Success) {
|
if (finish->status() == Quotient::BaseJob::Success) {
|
||||||
connectSingleShot(account, &Quotient::Connection::newRoom, this, [this](Quotient::Room *room) {
|
connectSingleShot(account, &NeoChatConnection::newRoom, this, [this](Quotient::Room *room) {
|
||||||
resolveResource(room->id());
|
resolveResource(room->id());
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -312,7 +312,7 @@ void RoomManager::joinRoom(Quotient::Connection *account, const QString &roomAli
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void RoomManager::knockRoom(Quotient::Connection *account, const QString &roomAliasOrId, const QString &reason, const QStringList &viaServers)
|
void RoomManager::knockRoom(NeoChatConnection *account, const QString &roomAliasOrId, const QString &reason, const QStringList &viaServers)
|
||||||
{
|
{
|
||||||
auto *const job = account->callApi<KnockRoomJob>(roomAliasOrId, viaServers, reason);
|
auto *const job = account->callApi<KnockRoomJob>(roomAliasOrId, viaServers, reason);
|
||||||
// Upon completion, ensure a room object is created in case it hasn't come
|
// Upon completion, ensure a room object is created in case it hasn't come
|
||||||
@@ -321,7 +321,7 @@ void RoomManager::knockRoom(Quotient::Connection *account, const QString &roomAl
|
|||||||
// to overtake clients that may add their own slots to finished().
|
// to overtake clients that may add their own slots to finished().
|
||||||
connectSingleShot(job, &BaseJob::finished, this, [this, job, account] {
|
connectSingleShot(job, &BaseJob::finished, this, [this, job, account] {
|
||||||
if (job->status() == Quotient::BaseJob::Success) {
|
if (job->status() == Quotient::BaseJob::Success) {
|
||||||
connectSingleShot(account, &Quotient::Connection::newRoom, this, [this](Quotient::Room *room) {
|
connectSingleShot(account, &NeoChatConnection::newRoom, this, [this](Quotient::Room *room) {
|
||||||
Q_EMIT currentRoom()->showMessage(NeoChatRoom::Info, i18n("You requested to join '%1'", room->name()));
|
Q_EMIT currentRoom()->showMessage(NeoChatRoom::Info, i18n("You requested to join '%1'", room->name()));
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ public:
|
|||||||
* See https://spec.matrix.org/latest/client-server-api/#knocking-on-rooms for
|
* See https://spec.matrix.org/latest/client-server-api/#knocking-on-rooms for
|
||||||
* knocking on rooms.
|
* knocking on rooms.
|
||||||
*/
|
*/
|
||||||
void knockRoom(Quotient::Connection *account, const QString &roomAliasOrId, const QString &reason, const QStringList &viaServers);
|
void knockRoom(NeoChatConnection *account, const QString &roomAliasOrId, const QString &reason, const QStringList &viaServers);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Show a media item maximized.
|
* @brief Show a media item maximized.
|
||||||
@@ -358,7 +358,7 @@ private:
|
|||||||
TimelineModel *m_timelineModel;
|
TimelineModel *m_timelineModel;
|
||||||
MessageFilterModel *m_messageFilterModel;
|
MessageFilterModel *m_messageFilterModel;
|
||||||
MediaMessageFilterModel *m_mediaMessageFilterModel;
|
MediaMessageFilterModel *m_mediaMessageFilterModel;
|
||||||
NeoChatConnection *m_connection;
|
QPointer<NeoChatConnection> m_connection;
|
||||||
|
|
||||||
void setCurrentRoom(const QString &roomId);
|
void setCurrentRoom(const QString &roomId);
|
||||||
|
|
||||||
|
|||||||
@@ -116,5 +116,5 @@ private:
|
|||||||
QHash<QString, Quotient::Omittable<QString>> m_nextBatchTokens;
|
QHash<QString, Quotient::Omittable<QString>> m_nextBatchTokens;
|
||||||
void populateSpaceHierarchy(const QString &spaceId);
|
void populateSpaceHierarchy(const QString &spaceId);
|
||||||
void addBatch(const QString &spaceId, Quotient::GetSpaceHierarchyJob *job);
|
void addBatch(const QString &spaceId, Quotient::GetSpaceHierarchyJob *job);
|
||||||
NeoChatConnection *m_connection;
|
QPointer<NeoChatConnection> m_connection;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
#include <Quotient/connection.h>
|
||||||
|
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
|
|
||||||
using namespace Quotient;
|
using namespace Quotient;
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
#include <QQmlEngine>
|
#include <QQmlEngine>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
|
|
||||||
#include <Quotient/connection.h>
|
|
||||||
#include <Quotient/user.h>
|
#include <Quotient/user.h>
|
||||||
|
|
||||||
class QmlUtils : public QObject
|
class QmlUtils : public QObject
|
||||||
|
|||||||
Reference in New Issue
Block a user