Remove a few more headers

This commit is contained in:
Nicolas Werner 2022-06-18 01:35:30 +02:00
parent 07228d336a
commit 35ff02ce48
No known key found for this signature in database
GPG Key ID: C8D75E610773F2D9
18 changed files with 48 additions and 52 deletions

View File

@ -4,13 +4,15 @@
//
// SPDX-License-Identifier: GPL-3.0-or-later
#include <limits>
#include "Cache.h"
#include "Cache_p.h"
#include <stdexcept>
#include <variant>
#include <QByteArray>
#include <QCoreApplication>
#include <QCryptographicHash>
#include <QDir>
#include <QFile>
#include <QHash>
#include <QMap>
@ -24,9 +26,8 @@
#endif
#include <mtx/responses/common.hpp>
#include <mtx/responses/messages.hpp>
#include "Cache.h"
#include "Cache_p.h"
#include "ChatPage.h"
#include "EventAccessors.h"
#include "Logging.h"

View File

@ -11,8 +11,6 @@
#include <optional>
#include <QDateTime>
#include <QDir>
#include <QImage>
#include <QString>
#if __has_include(<lmdbxx/lmdb++.h>)
@ -22,16 +20,19 @@
#endif
#include <nlohmann/json.hpp>
#include <mtx/responses/messages.hpp>
#include <mtx/responses/notifications.hpp>
#include <mtx/responses/sync.hpp>
#include <mtxclient/crypto/client.hpp>
#include <mtxclient/crypto/types.hpp>
#include <mtxclient/http/client.hpp>
#include "CacheCryptoStructs.h"
#include "CacheStructs.h"
#include "Logging.h"
namespace mtx::responses {
struct Messages;
}
class Cache : public QObject
{
Q_OBJECT

View File

@ -47,7 +47,7 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QObject *parent)
: QObject(parent)
, isConnected_(true)
, userSettings_{userSettings}
, notificationsManager(this)
, notificationsManager(new NotificationsManager(this))
, callManager_(new CallManager(this))
{
setObjectName(QStringLiteral("chatPage"));
@ -147,7 +147,7 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QObject *parent)
}
});
connect(&notificationsManager,
connect(notificationsManager,
&NotificationsManager::notificationClicked,
this,
[this](const QString &roomid, const QString &eventid) {
@ -160,7 +160,7 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QObject *parent)
MainWindow::instance()->requestActivate();
}
});
connect(&notificationsManager,
connect(notificationsManager,
&NotificationsManager::sendNotificationReply,
this,
[this](const QString &roomid, const QString &eventid, const QString &body) {
@ -396,7 +396,7 @@ ChatPage::bootstrap(QString userid, QString homeserver, QString token)
connect(cache::client(),
&Cache::removeNotification,
&notificationsManager,
notificationsManager,
&NotificationsManager::removeNotification);
} catch (const lmdb::error &e) {
@ -492,7 +492,7 @@ ChatPage::sendNotifications(const mtx::responses::Notifications &res)
96,
this,
[this, item](QPixmap image) {
notificationsManager.postNotification(
notificationsManager->postNotification(
item, image.toImage());
});
}

View File

@ -24,7 +24,6 @@
#include "CacheCryptoStructs.h"
#include "CacheStructs.h"
#include "notifications/Manager.h"
class TimelineViewManager;
class UserSettings;
@ -217,7 +216,7 @@ private:
// Global user settings.
QSharedPointer<UserSettings> userSettings_;
NotificationsManager notificationsManager;
NotificationsManager *notificationsManager;
CallManager *callManager_;
};

View File

@ -4,11 +4,14 @@
// SPDX-License-Identifier: GPL-3.0-or-later
#include "RoomDirectoryModel.h"
#include "Cache.h"
#include "ChatPage.h"
#include <algorithm>
#include "Cache.h"
#include "ChatPage.h"
#include "Logging.h"
#include "MatrixClient.h"
RoomDirectoryModel::RoomDirectoryModel(QObject *parent, const std::string &server)
: QAbstractListModel(parent)
, server_(server)

View File

@ -6,23 +6,11 @@
#pragma once
#include <QAbstractListModel>
#include <QHash>
#include <QString>
#include <string>
#include <vector>
#include "MatrixClient.h"
#include <mtx/responses/public_rooms.hpp>
#include <mtxclient/http/errors.hpp>
#include "Logging.h"
namespace mtx::http {
using RequestErr = const std::optional<mtx::http::ClientError> &;
}
namespace mtx::responses {
struct PublicRooms;
}
class RoomDirectoryModel : public QAbstractListModel
{

View File

@ -8,6 +8,8 @@
#include <QFile>
#include <QMimeDatabase>
#include <mtx/responses/media.hpp>
#include "Cache_p.h"
#include "ChatPage.h"
#include "Logging.h"

View File

@ -17,6 +17,7 @@
#include "Cache.h"
#include "Config.h"
#include "JdenticonProvider.h"
#include "MainWindow.h"
#include "MatrixClient.h"
#include "UserSettingsPage.h"
@ -152,6 +153,13 @@ UserSettings::load(std::optional<QString> profile)
applyTheme();
}
bool
UserSettings::useIdenticon() const
{
return useIdenticon_ && JdenticonProvider::isAvailable();
}
void
UserSettings::setMessageHoverHighlight(bool state)
{

View File

@ -11,7 +11,6 @@
#include <QSettings>
#include <QSharedPointer>
#include "JdenticonProvider.h"
#include <optional>
class Toggle;
@ -254,7 +253,7 @@ public:
QStringList hiddenPins() const { return hiddenPins_; }
QStringList hiddenWidgets() const { return hiddenWidgets_; }
QStringList recentReactions() const { return recentReactions_; }
bool useIdenticon() const { return useIdenticon_ && JdenticonProvider::isAvailable(); }
bool useIdenticon() const;
bool openImageExternal() const { return openImageExternal_; }
bool openVideoExternal() const { return openVideoExternal_; }
QList<QStringList> collapsedSpaces() const { return collapsedSpaces_; }

View File

@ -199,8 +199,8 @@ DeviceVerificationFlow::DeviceVerificationFlow(QObject *,
if (this->sender == false) {
this->sendVerificationKey();
} else {
if (this->commitment != mtx::crypto::bin2base64_unpadded(mtx::crypto::sha256(
msg.key + this->canonical_json.dump()))) {
if (this->commitment != mtx::crypto::bin2base64_unpadded(
mtx::crypto::sha256(msg.key + this->canonical_json))) {
this->cancelVerification(DeviceVerificationFlow::Error::MismatchedCommitment);
return;
}
@ -477,7 +477,7 @@ DeviceVerificationFlow::next()
} else {
switch (state_) {
case PromptStartVerification:
if (canonical_json.is_null())
if (canonical_json.empty())
sendVerificationReady();
else // legacy path without request and ready
acceptVerificationRequest();
@ -569,14 +569,14 @@ DeviceVerificationFlow::handleStartMessage(const mtx::events::msg::KeyVerificati
return;
}
if (!sender)
this->canonical_json = nlohmann::json(msg);
this->canonical_json = nlohmann::json(msg).dump();
else {
// resolve glare
if (std::tuple(this->toClient.to_string(), this->deviceId.toStdString()) <
std::tuple(utils::localUser().toStdString(), http::client()->device_id())) {
// treat this as if the user with the smaller mxid or smaller deviceid (if the mxid
// was the same) was the sender of "start"
this->canonical_json = nlohmann::json(msg);
this->canonical_json = nlohmann::json(msg).dump();
this->sender = false;
}
@ -610,7 +610,7 @@ DeviceVerificationFlow::acceptVerificationRequest()
else if (this->method == mtx::events::msg::SASMethods::Decimal)
req.short_authentication_string = {mtx::events::msg::SASMethods::Decimal};
req.commitment = mtx::crypto::bin2base64_unpadded(
mtx::crypto::sha256(this->sas->public_key() + this->canonical_json.dump()));
mtx::crypto::sha256(this->sas->public_key() + this->canonical_json));
send(req);
setState(WaitingForKeys);
@ -652,12 +652,12 @@ DeviceVerificationFlow::startVerificationRequest()
if (this->type == DeviceVerificationFlow::Type::ToDevice) {
mtx::requests::ToDeviceMessages<mtx::events::msg::KeyVerificationStart> body;
req.transaction_id = this->transaction_id;
this->canonical_json = nlohmann::json(req);
this->canonical_json = nlohmann::json(req).dump();
} else if (this->type == DeviceVerificationFlow::Type::RoomMsg && model_) {
req.relations.relations.push_back(this->relation);
// Set synthesized to surpress the nheko relation extensions
req.relations.synthesized = true;
this->canonical_json = nlohmann::json(req);
this->canonical_json = nlohmann::json(req).dump();
}
send(req);
setState(WaitingForOtherToAccept);

View File

@ -8,7 +8,6 @@
#include <QObject>
#include <mtx/responses/crypto.hpp>
#include <nlohmann/json.hpp>
#include "CacheCryptoStructs.h"
#include "Logging.h"
@ -211,7 +210,7 @@ private:
sas_ptr sas;
std::string mac_method;
std::string commitment;
nlohmann::json canonical_json;
std::string canonical_json;
std::vector<int> sasList;
UserKeyCache their_keys;

View File

@ -11,7 +11,6 @@
#include "Cache_p.h"
#include "ChatPage.h"
#include "Logging.h"
#include "MainWindow.h"
#include "MatrixClient.h"
#include "Olm.h"
#include "encryption/VerificationManager.h"

View File

@ -27,7 +27,6 @@
#include "CombinedImagePackModel.h"
#include "Config.h"
#include "Logging.h"
#include "MainWindow.h"
#include "MatrixClient.h"
#include "TimelineModel.h"
#include "TimelineViewManager.h"

View File

@ -9,7 +9,6 @@
#include <thread>
#include <type_traits>
#include <QCache>
#include <QClipboard>
#include <QDesktopServices>
#include <QFileDialog>
@ -28,9 +27,6 @@
#include "Logging.h"
#include "MainWindow.h"
#include "MatrixClient.h"
#include "MemberList.h"
#include "MxcImageProvider.h"
#include "ReadReceiptsModel.h"
#include "TimelineViewManager.h"
#include "Utils.h"
#include "encryption/Olm.h"

View File

@ -8,7 +8,6 @@
#include <QAbstractListModel>
#include <QColor>
#include <QDate>
#include <QHash>
#include <QSet>
#include <QTimer>
#include <QVariant>
@ -23,8 +22,6 @@
#include "MemberList.h"
#include "Permissions.h"
#include "ReadReceiptsModel.h"
#include "ui/RoomSettings.h"
#include "ui/UserProfile.h"
namespace mtx::http {
using RequestErr = const std::optional<mtx::http::ClientError> &;
@ -33,6 +30,7 @@ namespace mtx::responses {
struct Timeline;
struct Messages;
struct ClaimKeys;
struct StateEvents;
}
struct RelatedInfo;
@ -411,7 +409,7 @@ signals:
void lastMessageChanged();
void notificationsChanged();
void newState(mtx::responses::StateEvents events);
void newState(const mtx::responses::StateEvents &events);
void newMessageToSend(mtx::events::collections::TimelineEvents event);
void addPendingMessageToStore(mtx::events::collections::TimelineEvents event);

View File

@ -13,9 +13,12 @@
#include <mtx/common.hpp>
#include <mtx/responses/messages.hpp>
#include "ReadReceiptsModel.h"
#include "timeline/CommunitiesModel.h"
#include "timeline/PresenceEmitter.h"
#include "timeline/RoomlistModel.h"
#include "ui/RoomSettings.h"
#include "ui/UserProfile.h"
class MxcImageProvider;
class BlurhashProvider;

View File

@ -7,6 +7,7 @@
#include "Cache_p.h"
#include "MainWindow.h"
#include "MatrixClient.h"
#include "timeline/TimelineModel.h"
void
HiddenEvents::load()

View File

@ -8,7 +8,7 @@
#include <QString>
#include <QVariantList>
#include "timeline/TimelineModel.h"
#include <mtx/events/event_type.hpp>
class HiddenEvents : public QObject
{