Remove a few more headers

pull/1101/head
Nicolas Werner 2 years ago
parent 07228d336a
commit 35ff02ce48
No known key found for this signature in database
GPG Key ID: C8D75E610773F2D9
  1. 9
      src/Cache.cpp
  2. 9
      src/Cache_p.h
  3. 10
      src/ChatPage.cpp
  4. 3
      src/ChatPage.h
  5. 7
      src/RoomDirectoryModel.cpp
  6. 12
      src/RoomDirectoryModel.h
  7. 2
      src/SingleImagePackModel.cpp
  8. 8
      src/UserSettingsPage.cpp
  9. 3
      src/UserSettingsPage.h
  10. 16
      src/encryption/DeviceVerificationFlow.cpp
  11. 3
      src/encryption/DeviceVerificationFlow.h
  12. 1
      src/encryption/SelfVerificationStatus.cpp
  13. 1
      src/timeline/InputBar.cpp
  14. 4
      src/timeline/TimelineModel.cpp
  15. 6
      src/timeline/TimelineModel.h
  16. 3
      src/timeline/TimelineViewManager.h
  17. 1
      src/ui/HiddenEvents.cpp
  18. 2
      src/ui/HiddenEvents.h

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

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

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

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

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

@ -6,23 +6,11 @@
#pragma once #pragma once
#include <QAbstractListModel> #include <QAbstractListModel>
#include <QHash>
#include <QString> #include <QString>
#include <string> #include <string>
#include <vector> #include <vector>
#include "MatrixClient.h"
#include <mtx/responses/public_rooms.hpp> #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 class RoomDirectoryModel : public QAbstractListModel
{ {

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

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

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

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

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

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

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

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

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

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

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

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

Loading…
Cancel
Save